diff --git a/cmd/troubleshoot/cli/run.go b/cmd/troubleshoot/cli/run.go index 92d8ec37..bd39e498 100644 --- a/cmd/troubleshoot/cli/run.go +++ b/cmd/troubleshoot/cli/run.go @@ -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 } diff --git a/cmd/troubleshoot/cli/run_test.go b/cmd/troubleshoot/cli/run_test.go index 26d75c3f..30442d52 100644 --- a/cmd/troubleshoot/cli/run_test.go +++ b/cmd/troubleshoot/cli/run_test.go @@ -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) {