mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
* 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>
40 lines
794 B
Go
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)
|
|
}
|