(t *testing.T)
| 495 | } |
| 496 | |
| 497 | func TestBuildFromDevcontainerWithFeatures(t *testing.T) { |
| 498 | t.Parallel() |
| 499 | |
| 500 | registry := registrytest.New(t) |
| 501 | feature1Ref := registrytest.WriteContainer(t, registry, emptyRemoteOpts, "coder/test1:latest", features.TarLayerMediaType, map[string]any{ |
| 502 | "devcontainer-feature.json": &features.Spec{ |
| 503 | ID: "test1", |
| 504 | Name: "test1", |
| 505 | Version: "1.0.0", |
| 506 | Options: map[string]features.Option{ |
| 507 | "bananas": { |
| 508 | Type: "string", |
| 509 | }, |
| 510 | }, |
| 511 | }, |
| 512 | "install.sh": "echo $BANANAS > /test1output", |
| 513 | }) |
| 514 | |
| 515 | feature2Ref := registrytest.WriteContainer(t, registry, emptyRemoteOpts, "coder/test2:latest", features.TarLayerMediaType, map[string]any{ |
| 516 | "devcontainer-feature.json": &features.Spec{ |
| 517 | ID: "test2", |
| 518 | Name: "test2", |
| 519 | Version: "1.0.0", |
| 520 | Options: map[string]features.Option{ |
| 521 | "pineapple": { |
| 522 | Type: "string", |
| 523 | }, |
| 524 | }, |
| 525 | }, |
| 526 | "install.sh": "echo $PINEAPPLE > /test2output", |
| 527 | }) |
| 528 | |
| 529 | feature3Spec, err := json.Marshal(features.Spec{ |
| 530 | ID: "test3", |
| 531 | Name: "test3", |
| 532 | Version: "1.0.0", |
| 533 | Options: map[string]features.Option{ |
| 534 | "grape": { |
| 535 | Type: "string", |
| 536 | }, |
| 537 | }, |
| 538 | }) |
| 539 | require.NoError(t, err) |
| 540 | |
| 541 | // Ensures that a Git repository with a devcontainer.json is cloned and built. |
| 542 | srv := gittest.CreateGitServer(t, gittest.Options{ |
| 543 | Files: map[string]string{ |
| 544 | ".devcontainer/devcontainer.json": `{ |
| 545 | "name": "Test", |
| 546 | "build": { |
| 547 | "dockerfile": "Dockerfile" |
| 548 | }, |
| 549 | "features": { |
| 550 | "` + feature1Ref + `": { |
| 551 | "bananas": "hello from test 1!" |
| 552 | }, |
| 553 | "` + feature2Ref + `": { |
| 554 | "pineapple": "hello from test 2!" |
nothing calls this directly
no test coverage detected