Merge pull request #1256 from ulyssessouza/e2e-secrets

Add content based e2e tests for configs and secrets
This commit is contained in:
Guillaume Tardif 2021-02-08 16:18:36 +01:00 committed by GitHub
commit ec26ba5230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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