mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Updating EndpointSliceMirroring e2e test to accept multiple slices
Due to informer caching, this caused some flaky test failures.
This commit is contained in:
parent
5937e7eef7
commit
2c7d186669
@ -79,28 +79,34 @@ var _ = SIGDescribe("EndpointSliceMirroring", func() {
|
|||||||
framework.Logf("Error listing EndpointSlices: %v", err)
|
framework.Logf("Error listing EndpointSlices: %v", err)
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if len(esList.Items) != 1 {
|
if len(esList.Items) == 0 {
|
||||||
framework.Logf("Waiting for 1 EndpointSlice to exist, got %d", len(esList.Items))
|
framework.Logf("Waiting for at least 1 EndpointSlice to exist, got %d", len(esList.Items))
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
epSlice := esList.Items[0]
|
|
||||||
if len(epSlice.Ports) != 1 {
|
// Due to informer caching, it's possible for the controller
|
||||||
return false, fmt.Errorf("Expected EndpointSlice to have 1 Port, got %d", len(epSlice.Ports))
|
// to create a second EndpointSlice if it does not see the
|
||||||
}
|
// first EndpointSlice that was created during a sync. All
|
||||||
port := epSlice.Ports[0]
|
// EndpointSlices created should be valid though.
|
||||||
if *port.Port != int32(80) {
|
for _, epSlice := range esList.Items {
|
||||||
return false, fmt.Errorf("Expected port to be 80, got %d", *port.Port)
|
if len(epSlice.Ports) != 1 {
|
||||||
}
|
return false, fmt.Errorf("Expected EndpointSlice to have 1 Port, got %d", len(epSlice.Ports))
|
||||||
if len(epSlice.Endpoints) != 1 {
|
}
|
||||||
return false, fmt.Errorf("Expected EndpointSlice to have 1 endpoints, got %d", len(epSlice.Endpoints))
|
port := epSlice.Ports[0]
|
||||||
}
|
if *port.Port != int32(80) {
|
||||||
endpoint := epSlice.Endpoints[0]
|
return false, fmt.Errorf("Expected port to be 80, got %d", *port.Port)
|
||||||
if len(endpoint.Addresses) != 1 {
|
}
|
||||||
return false, fmt.Errorf("Expected EndpointSlice endpoint to have 1 address, got %d", len(endpoint.Addresses))
|
if len(epSlice.Endpoints) != 1 {
|
||||||
}
|
return false, fmt.Errorf("Expected EndpointSlice to have 1 endpoints, got %d", len(epSlice.Endpoints))
|
||||||
address := endpoint.Addresses[0]
|
}
|
||||||
if address != "10.1.2.3" {
|
endpoint := epSlice.Endpoints[0]
|
||||||
return false, fmt.Errorf("Expected EndpointSlice to have 10.1.2.3 as address, got %s", address)
|
if len(endpoint.Addresses) != 1 {
|
||||||
|
return false, fmt.Errorf("Expected EndpointSlice endpoint to have 1 address, got %d", len(endpoint.Addresses))
|
||||||
|
}
|
||||||
|
address := endpoint.Addresses[0]
|
||||||
|
if address != "10.1.2.3" {
|
||||||
|
return false, fmt.Errorf("Expected EndpointSlice to have 10.1.2.3 as address, got %s", address)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user