(t *testing.T)
| 343 | } |
| 344 | |
| 345 | func TestConfirmRemoteIncludes(t *testing.T) { |
| 346 | ctrl := gomock.NewController(t) |
| 347 | defer ctrl.Finish() |
| 348 | cli := mocks.NewMockCli(ctrl) |
| 349 | |
| 350 | tests := []struct { |
| 351 | name string |
| 352 | opts buildOptions |
| 353 | assumeYes bool |
| 354 | userInput string |
| 355 | wantErr bool |
| 356 | errMessage string |
| 357 | wantPrompt bool |
| 358 | wantOutput string |
| 359 | }{ |
| 360 | { |
| 361 | name: "no remote includes", |
| 362 | opts: buildOptions{ |
| 363 | ProjectOptions: &ProjectOptions{ |
| 364 | ConfigPaths: []string{ |
| 365 | "docker-compose.yaml", |
| 366 | "./local/path/compose.yaml", |
| 367 | }, |
| 368 | }, |
| 369 | }, |
| 370 | assumeYes: false, |
| 371 | wantErr: false, |
| 372 | wantPrompt: false, |
| 373 | }, |
| 374 | { |
| 375 | name: "assume yes with remote includes", |
| 376 | opts: buildOptions{ |
| 377 | ProjectOptions: &ProjectOptions{ |
| 378 | ConfigPaths: []string{ |
| 379 | "oci://registry.example.com/stack:latest", |
| 380 | "git://github.com/user/repo.git", |
| 381 | }, |
| 382 | }, |
| 383 | }, |
| 384 | assumeYes: true, |
| 385 | wantErr: false, |
| 386 | wantPrompt: false, |
| 387 | }, |
| 388 | { |
| 389 | name: "user confirms remote includes", |
| 390 | opts: buildOptions{ |
| 391 | ProjectOptions: &ProjectOptions{ |
| 392 | ConfigPaths: []string{ |
| 393 | "oci://registry.example.com/stack:latest", |
| 394 | "git://github.com/user/repo.git", |
| 395 | }, |
| 396 | }, |
| 397 | }, |
| 398 | assumeYes: false, |
| 399 | userInput: "y\n", |
| 400 | wantErr: false, |
| 401 | wantPrompt: true, |
| 402 | wantOutput: "\nWarning: This Compose project includes files from remote sources:\n" + |
nothing calls this directly
no test coverage detected