Skip to content

Commit

Permalink
chore: Exclude unwanted tags in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
nilo19 authored and k8s-infra-cherrypick-robot committed Jul 30, 2024
1 parent 61baa28 commit 0f9b70b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/e2e/network/service_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,9 @@ func waitComparePIPTags(tc *utils.AzureTestClient, expectedTags map[string]*stri
delete(tags, consts.LegacyClusterNameKey)
delete(tags, consts.ServiceTagKey)
delete(tags, consts.LegacyServiceTagKey)
for _, k := range utils.UnwantedTagKeys {
delete(tags, k)
}

printTags := func(name string, ts map[string]*string) {
msg := ""
Expand Down
15 changes: 15 additions & 0 deletions tests/e2e/utils/network_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var (
false: "",
true: "-IPv6",
}

UnwantedTagKeys = []string{"DateCreated"}
)

// getVirtualNetworkList returns the list of virtual networks in the cluster resource group.
Expand Down Expand Up @@ -287,9 +289,19 @@ func WaitCreatePIP(azureTestClient *AzureTestClient, ipName, rgName string, ipPa
}
return pip.Properties.IPAddress != nil, nil
})
if err == nil {
pip.Tags = cleanupTags(pip.Tags, UnwantedTagKeys)
}
return pip, err
}

func cleanupTags(tags map[string]*string, unwantedKeys []string) map[string]*string {
for _, key := range unwantedKeys {
delete(tags, key)
}
return tags
}

func WaitCreatePIPPrefix(
cli *AzureTestClient,
name, rgName string,
Expand Down Expand Up @@ -414,6 +426,9 @@ func WaitGetPIP(azureTestClient *AzureTestClient, ipName string) (pip *aznetwork
}
return true, nil
})
if err == nil {
pip.Tags = cleanupTags(pip.Tags, UnwantedTagKeys)
}
return
}

Expand Down

0 comments on commit 0f9b70b

Please sign in to comment.