syft/test/cli/dir_root_scan_regression_test.go
Christopher Angelo Phillips 1e3d2a2927
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>
2025-07-01 14:11:36 +00:00

40 lines
794 B
Go

package cli
import (
"os/exec"
"testing"
"time"
)
func TestDirectoryScanCompletesWithinTimeout(t *testing.T) {
image := "alpine:latest"
// we want to pull the image ahead of the test as to not affect the timeout value
pullDockerImage(t, image)
var cmd *exec.Cmd
var stdout, stderr string
done := make(chan struct{})
go func() {
defer close(done)
cmd, stdout, stderr = runSyftInDocker(t, nil, image, "dir:/", "-vv")
}()
select {
case <-done:
break
case <-time.After(10 * time.Second):
t.Fatalf("directory scan is taking too long")
}
assertions := []traitAssertion{
assertTableReport,
assertSuccessfulReturnCode,
}
for _, traitFn := range assertions {
traitFn(t, stdout, stderr, cmd.ProcessState.ExitCode())
}
logOutputOnFailure(t, cmd, stdout, stderr)
}