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 8557140 commit a946c84
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_OUTPUT"
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:$GITHUB_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:$GITHUB_OUTPUT"
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:$GITHUB_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:$GITHUB_OUTPUT"
echo "Status $status"
echo "Output"
echo -e $output
Expand Down

0 comments on commit a946c84

Please sign in to comment.