feat: [sc-103119] URI is not replacing the spec but merging instead (#1537)

fix uri spec to replace origin spec
This commit is contained in:
Gerard Nguyen
2024-04-30 12:13:35 +10:00
committed by GitHub
parent f3bad5f409
commit c2f72ecd0c
2 changed files with 5 additions and 3 deletions

View File

@@ -273,7 +273,8 @@ func loadSupportBundleSpecsFromURIs(ctx context.Context, kinds *loader.Troublesh
return err
}
kinds.Add(moreKinds)
// uri spec replaces the original spec
*kinds = *moreKinds
return nil
}

View File

@@ -57,8 +57,9 @@ spec:
err = loadSupportBundleSpecsFromURIs(ctx, kinds)
require.NoError(t, err)
require.Len(t, kinds.SupportBundlesV1Beta2, 2)
assert.NotNil(t, kinds.SupportBundlesV1Beta2[1].Spec.Collectors[0].ClusterInfo)
// valid uri spec will replace the original spec
require.Len(t, kinds.SupportBundlesV1Beta2, 1)
assert.NotNil(t, kinds.SupportBundlesV1Beta2[0].Spec.Collectors[0].ClusterInfo)
}
func Test_loadSupportBundleSpecsFromURIs_TimeoutError(t *testing.T) {