chore: publish IntegraCI build modules a11ec75d3e09

This commit is contained in:
dhimaz0445 committed 2026-11-11 03:41:55 +00:00
1 parent 694710104a
commit 3c2b80914e
78 files changed
+4982 -405

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package main
import "testing"
func TestVulnDBUpdatedAt(t *testing.T) {
cases := []struct{ name, in, want string }{
{
"trivy version --format json",
`{"Version":"0.76.1","VulnerabilityDB":{"Version":2,"NextUpdate":"2026-11-04T12:00:00Z","UpdatedAt":"2026-11-04T06:00:00.5Z","DownloadedAt":"2026-11-04T07:00:00Z"},"JavaDB":{"Version":1,"UpdatedAt":"2020-01-01T00:00:00Z"}}`,
"2026-11-04T06:00:00.5Z",
},
// The Java DB's date is not the vulnerability DB's: never borrow it.
{"only the java db", `{"Version":"0.76.1","JavaDB":{"UpdatedAt":"2026-11-04T06:00:00Z"}}`, ""},
{"no db in the cache", `{"Version":"0.76.1"}`, ""},
{"not json", `Version: 0.76.1`, ""},
{"empty", ``, ""},
}
for _, c := range cases {
if got := vulnDBUpdatedAt(c.in); got != c.want {
t.Errorf("%s: got %q, want %q", c.name, got, c.want)
}
}
}