Skip to content

Commit 1207ab1

Browse files
committed
review: trim redundant comments on mergeLabels and its regression test
1 parent 37af339 commit 1207ab1

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

modules/gcp/compute.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,7 @@ func (i *Instance) SetLabelsWithClient(ctx context.Context, service *compute.Ser
442442
return nil
443443
}
444444

445-
// mergeLabels merges new key-value pairs into existing labels, preserving any keys not in the new set.
446-
// Keys present in newLabels overwrite the existing values.
445+
// mergeLabels returns a new map with existing labels overlaid by newLabels.
447446
func mergeLabels(existing, newLabels map[string]string) map[string]string {
448447
merged := make(map[string]string, len(existing)+len(newLabels))
449448
for k, v := range existing {

modules/gcp/compute_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ func TestSetLabelsWithClient(t *testing.T) {
195195
require.NoError(t, inst.SetLabelsWithClient(context.Background(), svc, map[string]string{"env": "unit"}))
196196
}
197197

198-
// TestSetLabelsWithClientMergesExisting — regression test for the SetLabels-clobbers-existing bug.
199-
// The instance already carries a label; SetLabels should merge the new label in, not drop the
200-
// existing one.
201198
func TestSetLabelsWithClientMergesExisting(t *testing.T) {
202199
t.Parallel()
203200

0 commit comments

Comments
 (0)