Skip to content

Commit

Permalink
test: add tests for UID/GID
Browse files Browse the repository at this point in the history
Pick unconventional numbers to avoid collitions
  • Loading branch information
virtualroot committed Aug 1, 2023
1 parent c91df6e commit 61d30de
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/alpine.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ setup() {
[ "${lines[0]}" = "app" ]
}

@test "uid" {
run docker run virtualroot/hardened-alpine:3.18 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "gid" {
run docker run virtualroot/hardened-alpine:3.18 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "workdir" {
run docker run virtualroot/hardened-alpine:3.18 pwd
[ $status -eq 0 ]
Expand Down
12 changes: 12 additions & 0 deletions test/debian.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ setup() {
[ "${lines[0]}" = "app" ]
}

@test "uid" {
run docker run virtualroot/hardened-debian:12 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "gid" {
run docker run virtualroot/hardened-debian:12 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "workdir" {
run docker run virtualroot/hardened-debian:12 pwd
[ $status -eq 0 ]
Expand Down
12 changes: 12 additions & 0 deletions test/ubuntu.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ setup() {
[ "${lines[0]}" = "app" ]
}

@test "uid" {
run docker run virtualroot/hardened-ubuntu:22.04 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "gid" {
run docker run virtualroot/hardened-ubuntu:22.04 id -g
[ $status -eq 0 ]
[ "${lines[0]}" = "12123" ]
}

@test "workdir" {
run docker run virtualroot/hardened-ubuntu:22.04 pwd
[ $status -eq 0 ]
Expand Down

0 comments on commit 61d30de

Please sign in to comment.