Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pohanhuangtw committed Mar 19, 2024
1 parent e3b53ac commit fffe0ea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/scan-image.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setup_file() {
}

@test "docker daemon not reachable" {
run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -14,7 +14,7 @@ setup_file() {
}

@test "invalid scanner image" {
run docker run --rm -e NV_SCANNER_IMAGE=invalid-image:latest -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e NV_SCANNER_IMAGE=invalid-image:latest -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -23,7 +23,7 @@ setup_file() {
}

@test "scan image with vulnerabilities but don't fail" {
run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -32,7 +32,7 @@ setup_file() {
}

@test "scan image with vulnerabilities and high severity fail" {
run docker run --rm -e HIGH_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e HIGH_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -41,7 +41,7 @@ setup_file() {
}

@test "scan image with vulnerabilities and medium severity fail" {
run docker run --rm -e MEDIUM_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e MEDIUM_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -50,7 +50,7 @@ setup_file() {
}

@test "scan image with vulnerabilities and specific CVE fail" {
run docker run --rm -e VUL_NAMES_TO_FAIL=invalid,CVE-2020-16156 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e VUL_NAMES_TO_FAIL=invalid,CVE-2020-16156 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -59,7 +59,7 @@ setup_file() {
}

@test "scan image with json output" {
run docker run --rm -e OUTPUT=json -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e OUTPUT=json -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand All @@ -68,7 +68,7 @@ setup_file() {
}

@test "scan image with csv output" {
run docker run --rm -e OUTPUT=csv -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp"
run docker run --rm -e OUTPUT=csv -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "/github/output:/tmp" bashofmann/neuvector-image-scan-action
echo "Status $status"
echo "Output"
echo -e $output
Expand Down

0 comments on commit fffe0ea

Please sign in to comment.