Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the AZ name to AZ ID mapping in tests. #2766

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/integration/cni/pod_traffic_across_az_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var _ = Describe("[STATIC_CANARY] test pod networking", FlakeAttempts(retries),
})
})

// Functio to Az to Pod mapping and Az to AZ ID mapping
// Function for AZ to Pod mapping and AZ to AZ ID mapping
func GetAZMappings(nodes coreV1.NodeList) (map[string]coreV1.Pod, map[string]string) {
// Map of AZ name to Pod from Daemonset running on nodes
azToPod := make(map[string]coreV1.Pod)
Expand All @@ -150,6 +150,11 @@ func GetAZMappings(nodes coreV1.NodeList) (map[string]coreV1.Pod, map[string]str

describeAZOutput, err := f.CloudServices.EC2().DescribeAvailabilityZones()

// iterate describe AZ output and populate AZ name to AZ ID mapping
for _, az := range describeAZOutput.AvailabilityZones {
azToazID[*az.ZoneName] = *az.ZoneId
}

if err != nil {
// Don't fail the test if we can't describe AZs. The failure will be caught by the test
// We use describe AZs to get the AZ ID for metrics.
Expand All @@ -170,7 +175,6 @@ func GetAZMappings(nodes coreV1.NodeList) (map[string]coreV1.Pod, map[string]str
azToPod[azName] = interfaceToPodList.PodsOnPrimaryENI[0]
}

azToazID[azName] = *describeAZOutput.AvailabilityZones[i].ZoneId
}
return azToPod, azToazID
}
Expand Down
Loading