go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers-sdk/v1/inventory/asset_test.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package inventory 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestAddMondooLabels(t *testing.T) { 13 asset := &Asset{ 14 Labels: map[string]string{ 15 "foo": "bar", 16 }, 17 } 18 19 rootAsset := &Asset{ 20 Labels: map[string]string{ 21 "k8s.mondoo.com/test": "val", 22 "mondoo.com/sample": "example", 23 "random": "random-val", 24 }, 25 } 26 27 asset.AddMondooLabels(rootAsset) 28 assert.Equal( 29 t, 30 asset.Labels, 31 map[string]string{ 32 "foo": "bar", 33 "k8s.mondoo.com/test": "val", 34 "mondoo.com/sample": "example", 35 }) 36 }