Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Sep 19, 2023
1 parent e38ee44 commit 41966ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion kubernetes/metadata/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func generateMapSubset(input map[string]string, keys []string, dedot bool) mapst
for _, key := range keys {
for label, value := range input {
matched, _ = regexp.MatchString(key, label)
if matched == true {
if matched {
if dedot {
dedotKey := utils.DeDot(label)
_, _ = output.Put(dedotKey, value)
Expand Down
24 changes: 12 additions & 12 deletions kubernetes/metadata/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func TestNamespaceAwareResource_GenerateWithNamespace(t *testing.T) {

func Test_generateMapSubset(t *testing.T) {

Labels_dedot := map[string]string{
Labelsdedot := map[string]string{
"app.kubernetes.io/name": "no",
"foo": "bar",
}
Expand All @@ -285,7 +285,7 @@ func Test_generateMapSubset(t *testing.T) {
"foo*",
"test",
}
expected_result1 := mapstr.M{
expectedresult1 := mapstr.M{
"foo": "bar",
"foo1": "bar1",
"foo2": "bar2",
Expand All @@ -301,7 +301,7 @@ func Test_generateMapSubset(t *testing.T) {
key2 := []string{
"0?1",
}
expected_result2 := mapstr.M{
expectedresult2 := mapstr.M{
"foo1": "bar1",
}
output2 := generateMapSubset(Labels, key2, false)
Expand All @@ -310,7 +310,7 @@ func Test_generateMapSubset(t *testing.T) {
key3 := []string{
"^test",
}
expected_result3 := mapstr.M{
expectedresult3 := mapstr.M{
"test": "test1",
}
output3 := generateMapSubset(Labels, key3, false)
Expand All @@ -319,7 +319,7 @@ func Test_generateMapSubset(t *testing.T) {
key4 := []string{
"test$",
}
expected_result4 := mapstr.M{
expectedresult4 := mapstr.M{
"test": "test1",
"footest": "footest1",
}
Expand All @@ -329,16 +329,16 @@ func Test_generateMapSubset(t *testing.T) {
key5 := []string{
"t{2}",
}
expected_result5 := mapstr.M{
expectedresult5 := mapstr.M{
"nottomatch": "no",
}
output5 := generateMapSubset(Labels, key5, false)

assert.Equal(t, expected_result1, output1)
assert.Equal(t, expected_result2, output2)
assert.Equal(t, expected_result3, output3)
assert.Equal(t, expected_result4, output4)
assert.Equal(t, expected_result5, output5)
assert.Equal(t, expectedresult1, output1)
assert.Equal(t, expectedresult2, output2)
assert.Equal(t, expectedresult3, output3)
assert.Equal(t, expectedresult4, output4)
assert.Equal(t, expectedresult5, output5)

//Dedot Validation
key6 := []string{
Expand All @@ -347,7 +347,7 @@ func Test_generateMapSubset(t *testing.T) {
expected_result6 := mapstr.M{
"app_kubernetes_io/name": "no",
}
output6 := generateMapSubset(Labels_dedot, key6, true)
output6 := generateMapSubset(Labelsdedot, key6, true)
assert.Equal(t, expected_result6, output6)

}

0 comments on commit 41966ae

Please sign in to comment.