diff --git a/.gitignore b/.gitignore index d6022a7d398140be9a394b9ce97586b13935ac8a..fdc4b42b2b59448cee8761eb8aa9284be137ec7e 100644 --- a/.gitignore +++ b/.gitignore @@ -46,8 +46,4 @@ dist/ *.lock *.env .bundle/ -debian -ubuntu -centos -fedora -alpine +*.touch diff --git a/.travis.yml b/.travis.yml index 681d296a878bd848d43d8291a7c1fe37b113b3c5..658db49298215c231665efc7deb2be5fc79ab80f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ services: - docker script: - - make test clean + - bats test.bats notifications: email: false diff --git a/Makefile b/Makefile deleted file mode 100644 index 9fc05b3158141f7b502ad57481cf730fbe0826c3..0000000000000000000000000000000000000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: test clean - -test: - bats test.bats - -clean: - docker image ls --format '{{.ID}}' runas-* | xargs -r docker image rm - rm -f debian fedora ubuntu alpine diff --git a/test.bats b/test.bats old mode 100644 new mode 100755 index fdd10b579981d5fd67cf0330a08f637bf0ce651e..74d7ff57d100898f36ee7b0451c282be10aa58f5 --- a/test.bats +++ b/test.bats @@ -5,9 +5,14 @@ _test () { tag="${2:-latest}" userland="${3:-gnu}" docker build -t "runas-$name" --build-arg "image=$name:$tag" --build-arg "userland=$userland" ./ - docker run --rm -v "$BATS_TEST_DIRNAME:/volume" "runas-$name" touch "$name" - test "$(id -u)" = "$(stat -c '%u' $name)" - test "$(id -g)" = "$(stat -c '%g' $name)" + docker run --rm -v "$BATS_TEST_DIRNAME:/volume" "runas-$name" touch "$name.touch" + test "$(id -u)" = "$(stat -c '%u' $name.touch)" + test "$(id -g)" = "$(stat -c '%g' $name.touch)" +} + +teardown () { + docker image ls --format '{{.ID}}' runas-* | xargs -r docker image rm + rm -f *.touch } @test "ubuntu" { _test; }