mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 14:36:33 +01:00
chore: update tests to read from latest test-fixture-cache and fix cache publish (#4042)
* feat: update integration test with correct package for httpd Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> * chore: update integration and cli tests with new upstream expectations - php interpreter 8.3.21 => 8.3.22 - runCycloneDXInDocker update for local arm64 qemu emulation CycloneDX - getSyftBinaryLocationByOS update to detect arm64 v8.0 artifact path Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> * chore: add snalshot to test command for fixture builds Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> * chore: update cdx in docker for all GOOS Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com> --------- Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
+19
-10
@@ -81,18 +81,23 @@ func pullDockerImage(t testing.TB, image string) {
|
||||
|
||||
// docker run -v $(pwd)/sbom:/sbom cyclonedx/cyclonedx-cli:latest validate --input-format json --input-version v1_4 --input-file /sbom
|
||||
func runCycloneDXInDocker(t testing.TB, env map[string]string, image string, f *os.File, args ...string) (*exec.Cmd, string, string) {
|
||||
allArgs := append(
|
||||
[]string{
|
||||
"run",
|
||||
"-t",
|
||||
"-v",
|
||||
fmt.Sprintf("%s:/sbom", f.Name()),
|
||||
image,
|
||||
},
|
||||
args...,
|
||||
)
|
||||
t.Helper()
|
||||
|
||||
allArgs := []string{"run", "-t"}
|
||||
|
||||
if runtime.GOARCH == "arm64" {
|
||||
t.Logf("Detected %s/%s — adding --platform=linux/amd64 for emulation", runtime.GOOS, runtime.GOARCH)
|
||||
allArgs = append(allArgs, "--platform=linux/amd64")
|
||||
}
|
||||
|
||||
allArgs = append(allArgs, "-v", fmt.Sprintf("%s:/sbom", f.Name()))
|
||||
|
||||
allArgs = append(allArgs, image)
|
||||
allArgs = append(allArgs, args...)
|
||||
|
||||
cmd := exec.Command("docker", allArgs...)
|
||||
stdout, stderr, _ := runCommand(cmd, env)
|
||||
|
||||
return cmd, stdout, stderr
|
||||
}
|
||||
|
||||
@@ -287,6 +292,10 @@ func getSyftBinaryLocationByOS(t testing.TB, goOS string) string {
|
||||
if runtime.GOARCH == "amd64" {
|
||||
archPath = fmt.Sprintf("%s_v1", archPath)
|
||||
}
|
||||
|
||||
if runtime.GOARCH == "arm64" {
|
||||
archPath = fmt.Sprintf("%s_v8.0", archPath)
|
||||
}
|
||||
// note: there is a subtle - vs _ difference between these versions
|
||||
switch goOS {
|
||||
case "darwin", "linux":
|
||||
|
||||
Reference in New Issue
Block a user