-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure add mondoo labels works for all mondoo labels
Signed-off-by: Ivan Milchev <[email protected]>
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Mondoo, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package inventory | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAddMondooLabels(t *testing.T) { | ||
asset := &Asset{ | ||
Labels: map[string]string{ | ||
"foo": "bar", | ||
}, | ||
} | ||
|
||
rootAsset := &Asset{ | ||
Labels: map[string]string{ | ||
"k8s.mondoo.com/test": "val", | ||
"mondoo.com/sample": "example", | ||
"random": "random-val", | ||
}, | ||
} | ||
|
||
asset.AddMondooLabels(rootAsset) | ||
assert.Equal( | ||
t, | ||
asset.Labels, | ||
map[string]string{ | ||
"foo": "bar", | ||
"k8s.mondoo.com/test": "val", | ||
"mondoo.com/sample": "example", | ||
}) | ||
} |