(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestLocalComposeConfig(t *testing.T) { |
| 26 | c := NewParallelCLI(t) |
| 27 | |
| 28 | const projectName = "compose-e2e-config" |
| 29 | |
| 30 | t.Run("yaml", func(t *testing.T) { |
| 31 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config") |
| 32 | res.Assert(t, icmd.Expected{Out: ` |
| 33 | ports: |
| 34 | - mode: ingress |
| 35 | target: 80 |
| 36 | published: "8080" |
| 37 | protocol: tcp`}) |
| 38 | }) |
| 39 | |
| 40 | t.Run("json", func(t *testing.T) { |
| 41 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--format", "json") |
| 42 | res.Assert(t, icmd.Expected{Out: `"published": "8080"`}) |
| 43 | }) |
| 44 | |
| 45 | t.Run("--no-interpolate", func(t *testing.T) { |
| 46 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--no-interpolate") |
| 47 | res.Assert(t, icmd.Expected{Out: `- ${PORT:-8080}:80`}) |
| 48 | }) |
| 49 | |
| 50 | t.Run("--variables --format json", func(t *testing.T) { |
| 51 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "json") |
| 52 | res.Assert(t, icmd.Expected{Out: `{ |
| 53 | "PORT": { |
| 54 | "Name": "PORT", |
| 55 | "DefaultValue": "8080", |
| 56 | "PresenceValue": "", |
| 57 | "Required": false |
| 58 | } |
| 59 | }`}) |
| 60 | }) |
| 61 | |
| 62 | t.Run("--variables --format yaml", func(t *testing.T) { |
| 63 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/config/compose.yaml", "--project-name", projectName, "config", "--variables", "--format", "yaml") |
| 64 | res.Assert(t, icmd.Expected{Out: `PORT: |
| 65 | name: PORT |
| 66 | defaultvalue: "8080" |
| 67 | presencevalue: "" |
| 68 | required: false`}) |
| 69 | }) |
| 70 | } |
nothing calls this directly
no test coverage detected