From 0d5c9e70e45533062cd330a20c19f796c219bc01 Mon Sep 17 00:00:00 2001 From: Alejandro Lazaro Date: Thu, 27 Jul 2023 23:04:45 +0200 Subject: [PATCH] feat: add tests Inspired by gliderlabs/docker-alpine --- test/alpine.bats | 15 +++++++++++++++ test/debian.bats | 16 ++++++++++++++++ test/ubuntu.bats | 16 ++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 test/alpine.bats create mode 100644 test/debian.bats create mode 100644 test/ubuntu.bats diff --git a/test/alpine.bats b/test/alpine.bats new file mode 100644 index 0000000..6c773f9 --- /dev/null +++ b/test/alpine.bats @@ -0,0 +1,15 @@ +setup() { + docker history alpine >/dev/null 2>&1 +} + +@test "whoami" { + run docker run alpine whoami + [ $status -eq 0 ] + [ "${lines[0]}" = "app" ] +} + +@test "workdir" { + run docker run alpine pwd + [ $status -eq 0 ] + [ "${lines[0]}" = "/app" ] +} diff --git a/test/debian.bats b/test/debian.bats new file mode 100644 index 0000000..a5e7508 --- /dev/null +++ b/test/debian.bats @@ -0,0 +1,16 @@ +setup() { + docker history debian >/dev/null 2>&1 +} + +@test "whoami app" { + run docker run debian whoami + [ $status -eq 0 ] + [ "${lines[0]}" = "app" ] +} + +@test "workdir" { + run docker run debian pwd + [ $status -eq 0 ] + [ "${lines[0]}" = "/app" ] +} + diff --git a/test/ubuntu.bats b/test/ubuntu.bats new file mode 100644 index 0000000..59d04b9 --- /dev/null +++ b/test/ubuntu.bats @@ -0,0 +1,16 @@ +setup() { + docker history ubuntu >/dev/null 2>&1 +} + +@test "whoami app" { + run docker run ubuntu whoami + [ $status -eq 0 ] + [ "${lines[0]}" = "app" ] +} + +@test "workdir" { + run docker run ubuntu pwd + [ $status -eq 0 ] + [ "${lines[0]}" = "/app" ] +} +