(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func TestRunVariablesAllowsTemplatedPortFields(t *testing.T) { |
| 310 | ctrl := gomock.NewController(t) |
| 311 | defer ctrl.Finish() |
| 312 | |
| 313 | dir := t.TempDir() |
| 314 | composePath := filepath.Join(dir, "compose.yaml") |
| 315 | assert.NilError(t, os.WriteFile(composePath, []byte(` |
| 316 | name: remote-defaults |
| 317 | services: |
| 318 | web: |
| 319 | image: nginx |
| 320 | ports: |
| 321 | - host_ip: "${LXKNS_ADDRESS:-127.0.0.1}" |
| 322 | published: "${LXKNS_PORT:-5010}" |
| 323 | target: 80 |
| 324 | protocol: tcp |
| 325 | `), 0o600)) |
| 326 | |
| 327 | buf := new(bytes.Buffer) |
| 328 | cli := mocks.NewMockCli(ctrl) |
| 329 | cli.EXPECT().Out().Return(streams.NewOut(buf)).AnyTimes() |
| 330 | |
| 331 | opts := configOptions{ |
| 332 | Format: "json", |
| 333 | ProjectOptions: &ProjectOptions{ |
| 334 | ConfigPaths: []string{composePath}, |
| 335 | ProjectDir: dir, |
| 336 | }, |
| 337 | } |
| 338 | assert.NilError(t, runVariables(t.Context(), cli, opts, nil)) |
| 339 | |
| 340 | output := buf.String() |
| 341 | assert.Assert(t, strings.Contains(output, `"LXKNS_ADDRESS"`), output) |
| 342 | assert.Assert(t, strings.Contains(output, `"LXKNS_PORT"`), output) |
| 343 | } |
| 344 | |
| 345 | func TestConfirmRemoteIncludes(t *testing.T) { |
| 346 | ctrl := gomock.NewController(t) |
nothing calls this directly
no test coverage detected