Skip to content

Commit 9040635

Browse files
committed
add test case with labels as nil
1 parent c8742f8 commit 9040635

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/entity/register/worker_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -592,3 +592,23 @@ func TestUpdateEntityMetadata(t *testing.T) {
592592
updateEntityMetadata(entity, labels)
593593
assert.Equal(t, expected, entity)
594594
}
595+
func TestUpdateEntityMetadata_NilLabels(t *testing.T) {
596+
t.Parallel()
597+
expected := &entity.Fields{
598+
Name: "WIN_SERVICE:testWindows:newrelic-infra",
599+
Type: "WIN_SERVICE",
600+
IDAttributes: nil,
601+
DisplayName: "New Relic Infrastructure Agent",
602+
Metadata: map[string]interface{}{},
603+
}
604+
var labels map[string]string
605+
entity := &entity.Fields{
606+
Name: "WIN_SERVICE:testWindows:newrelic-infra",
607+
Type: "WIN_SERVICE",
608+
IDAttributes: nil,
609+
DisplayName: "New Relic Infrastructure Agent",
610+
Metadata: map[string]interface{}{},
611+
}
612+
updateEntityMetadata(entity, labels)
613+
assert.Equal(t, expected, entity)
614+
}

0 commit comments

Comments
 (0)