diff --git a/Makefile b/Makefile index f722458..b08ddd7 100644 --- a/Makefile +++ b/Makefile @@ -58,10 +58,9 @@ test: test.docker # Docker commands # ################### -docker-registries = $(strip $(if $(call eq,$(registries),),\ - $(REGISTRIES),$(subst $(comma), ,$(registries)))) -docker-tags = $(strip $(if $(call eq,$(tags),),\ - $(TAGS),$(subst $(comma), ,$(tags)))) +docker-registries = $(strip \ + $(or $(subst $(comma), ,$(registries)),$(REGISTRIES))) +docker-tags = $(strip $(or $(subst $(comma), ,$(tags)),$(TAGS))) # Build Docker image with the given tag. @@ -173,6 +172,7 @@ endif IMAGE=$(OWNER)/$(NAME):$(or $(tag),$(VERSION)) \ node_modules/.bin/bats \ --timing $(if $(call eq,$(CI),),--pretty,--formatter tap) \ + --print-output-on-failure \ tests/main.bats diff --git a/package.json b/package.json index 84e240a..99180f2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "bats": "^1.1" + "bats": "^1.8" } } diff --git a/tests/main.bats b/tests/main.bats index 027dfea..faa0d8f 100644 --- a/tests/main.bats +++ b/tests/main.bats @@ -2,12 +2,14 @@ @test "pure-ftpd is installed" { - run docker run --rm --entrypoint sh $IMAGE -c 'which pure-ftpd' + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ + 'which pure-ftpd' [ "$status" -eq 0 ] } @test "pure-ftpd runs ok" { - run docker run --rm --entrypoint sh $IMAGE -c 'pure-ftpd --help' + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ + 'pure-ftpd --help' [ "$status" -eq 0 ] } @@ -17,7 +19,7 @@ [ ! "$output" = '' ] expected="$output" - run docker run --rm --entrypoint sh $IMAGE -c \ + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ "pure-ftpd --help | head -1 | cut -d ' ' -f 2" [ "$status" -eq 0 ] [ ! "$output" = '' ] @@ -28,25 +30,27 @@ @test "pure-pw is installed" { - run docker run --rm --entrypoint sh $IMAGE -c 'which pure-pw' + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ + 'which pure-pw' [ "$status" -eq 0 ] } @test "pure-pw runs ok" { - run docker run --rm --entrypoint sh $IMAGE -c 'pure-pw --help' + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ + 'pure-pw --help' [ "$status" -eq 0 ] } @test "PURE_PASSWDFILE is converted to PURE_DBFILE on container start" { - run docker run --rm \ + run docker run --rm --pull never \ -v $(pwd)/tests/resources/pureftpd.passwd:/etc/pureftpd.passwd:ro \ $IMAGE test -f /etc/pureftpd.pdb [ "$status" -eq 0 ] } @test "PURE_PASSWDFILE is converted to PURE_DBFILE from custom location" { - run docker run --rm \ + run docker run --rm --pull never \ -e PURE_PASSWDFILE=/tmp/pureftpd.passwd \ -e PURE_DBFILE=/pureftpd.pdb \ -v $(pwd)/tests/resources/pureftpd.passwd:/tmp/pureftpd.passwd:ro \ @@ -56,6 +60,7 @@ @test "syslogd runs ok" { - run docker run --rm --entrypoint sh $IMAGE -c '/sbin/syslogd --help' + run docker run --rm --pull never --entrypoint sh $IMAGE -c \ + '/sbin/syslogd --help' [ "$status" -eq 0 ] }