Add content based e2e tests for configs and secrets

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2021-02-08 02:57:02 -03:00
parent a5b148bda1
commit b9f34a168b
2 changed files with 16 additions and 0 deletions

View File

@ -280,6 +280,16 @@ func TestLocalComposeVolume(t *testing.T) {
assert.Assert(t, strings.Contains(output, `"Destination":"/myconfig","Mode":"","RW":false,"Propagation":"rprivate"`), output)
})
t.Run("check config content", func(t *testing.T) {
output := c.RunDockerCmd("exec", "compose-e2e-volume_nginx2_1", "cat", "/myconfig").Stdout()
assert.Assert(t, strings.Contains(output, `Hello from Nginx container`), output)
})
t.Run("check secrets content", func(t *testing.T) {
output := c.RunDockerCmd("exec", "compose-e2e-volume_nginx2_1", "cat", "/run/secrets/mysecret").Stdout()
assert.Assert(t, strings.Contains(output, `Hello from Nginx container`), output)
})
t.Run("check container bind-mounts specs", func(t *testing.T) {
res := c.RunDockerCmd("inspect", "compose-e2e-volume_nginx_1", "--format", "{{ json .HostConfig.Mounts }}")
output := res.Stdout()

View File

@ -16,6 +16,8 @@ services:
- 9090:80
configs:
- myconfig
secrets:
- mysecret
volumes:
staticVol:
@ -25,3 +27,7 @@ volumes:
configs:
myconfig:
file: ./static/index.html
secrets:
mysecret:
file: ./static/index.html