Skip to content

Commit c2f72ec

Browse files
authored
feat: [sc-103119] URI is not replacing the spec but merging instead (#1537)
fix uri spec to replace origin spec
1 parent f3bad5f commit c2f72ec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cmd/troubleshoot/cli/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ func loadSupportBundleSpecsFromURIs(ctx context.Context, kinds *loader.Troublesh
273273
return err
274274
}
275275

276-
kinds.Add(moreKinds)
276+
// uri spec replaces the original spec
277+
*kinds = *moreKinds
277278
return nil
278279
}
279280

cmd/troubleshoot/cli/run_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ spec:
5757
err = loadSupportBundleSpecsFromURIs(ctx, kinds)
5858
require.NoError(t, err)
5959

60-
require.Len(t, kinds.SupportBundlesV1Beta2, 2)
61-
assert.NotNil(t, kinds.SupportBundlesV1Beta2[1].Spec.Collectors[0].ClusterInfo)
60+
// valid uri spec will replace the original spec
61+
require.Len(t, kinds.SupportBundlesV1Beta2, 1)
62+
assert.NotNil(t, kinds.SupportBundlesV1Beta2[0].Spec.Collectors[0].ClusterInfo)
6263
}
6364

6465
func Test_loadSupportBundleSpecsFromURIs_TimeoutError(t *testing.T) {

0 commit comments

Comments
 (0)