Przeglądaj źródła

Merge pull request #1256 from ulyssessouza/e2e-secrets

Add content based e2e tests for configs and secrets
Guillaume Tardif 4 lat temu
rodzic
commit
ec26ba5230

+ 10 - 0
local/e2e/compose/compose_test.go

@@ -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()

+ 6 - 0
local/e2e/compose/fixtures/volume-test/compose.yml

@@ -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