From 7113773c3474caed8beb0d1459871400ca0033c4 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 7 Feb 2018 13:54:44 +0200
Subject: [PATCH] No more Makefile and a little cleanup.

---
 .gitignore  |  6 +-----
 .travis.yml |  2 +-
 Makefile    |  8 --------
 test.bats   | 11 ++++++++---
 4 files changed, 10 insertions(+), 17 deletions(-)
 delete mode 100644 Makefile
 mode change 100644 => 100755 test.bats

diff --git a/.gitignore b/.gitignore
index d6022a7..fdc4b42 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 681d296..658db49 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 9fc05b3..0000000
--- 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 fdd10b5..74d7ff5
--- 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; }
-- 
GitLab