|
7 | 7 | "testing"
|
8 | 8 |
|
9 | 9 | "get.porter.sh/porter/pkg/cnab"
|
| 10 | + "get.porter.sh/porter/pkg/config" |
10 | 11 | "get.porter.sh/porter/pkg/printer"
|
11 | 12 | "get.porter.sh/porter/pkg/secrets"
|
12 | 13 | "get.porter.sh/porter/pkg/storage"
|
@@ -884,3 +885,35 @@ func TestPorter_ParametersApply(t *testing.T) {
|
884 | 885 | assert.Equal(t, "foo_secret", ps.Parameters[0].Source.Hint, "expected the foo parameter mapping to use foo_secret")
|
885 | 886 | })
|
886 | 887 | }
|
| 888 | + |
| 889 | +func TestParameterRemovedFromBundle(t *testing.T) { |
| 890 | + ctx := context.Background() |
| 891 | + p := NewTestPorter(t) |
| 892 | + p.TestConfig.TestContext.AddTestFile("testdata/porter.yaml", "porter.yaml") |
| 893 | + opts := InstallOptions{ |
| 894 | + BundleExecutionOptions: &BundleExecutionOptions{ |
| 895 | + Driver: "docker", |
| 896 | + BundleReferenceOptions: &BundleReferenceOptions{ |
| 897 | + installationOptions: installationOptions{ |
| 898 | + BundleDefinitionOptions: BundleDefinitionOptions{ |
| 899 | + File: config.Name, |
| 900 | + }, |
| 901 | + Name: "MyInstallation", |
| 902 | + }, |
| 903 | + }, |
| 904 | + }, |
| 905 | + } |
| 906 | + |
| 907 | + installation := storage.NewInstallation(opts.Namespace, opts.Name) |
| 908 | + installation.Parameters.Parameters = make([]secrets.SourceMap, 1) |
| 909 | + installation.Parameters.Parameters[0] = secrets.SourceMap{ |
| 910 | + Name: "removedParam", |
| 911 | + Source: secrets.Source{ |
| 912 | + Strategy: "value", |
| 913 | + Hint: "1", |
| 914 | + }, |
| 915 | + } |
| 916 | + |
| 917 | + err := p.applyActionOptionsToInstallation(ctx, opts, &installation) |
| 918 | + require.NoError(t, err) |
| 919 | +} |
0 commit comments