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 fdc156e commit 8701e0c
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 @@ -1503,6 +1503,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 @@ -45,6 +45,8 @@ var (
false: "",
true: "-IPv6",
}

UnwantedTagKeys = []string{"DateCreated"}
)

// getVirtualNetworkList returns the list of virtual networks in the cluster resource group.
Expand Down Expand Up @@ -285,9 +287,19 @@ func WaitCreatePIP(azureTestClient *AzureTestClient, ipName, rgName string, ipPa
}
return pip.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 @@ -424,6 +436,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 8701e0c

Please sign in to comment.