mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Fix the issue which TestServiceRegistryIPUpdate will randomly run failed.
This commit is contained in:
parent
2bfa9a1f98
commit
70ce862955
@ -569,6 +569,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
|
|||||||
for _, ip := range testIPs {
|
for _, ip := range testIPs {
|
||||||
if !rest.serviceIPs.(*ipallocator.Range).Has(net.ParseIP(ip)) {
|
if !rest.serviceIPs.(*ipallocator.Range).Has(net.ParseIP(ip)) {
|
||||||
testIP = ip
|
testIP = ip
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,9 +688,18 @@ func TestServiceRegistryIPUpdate(t *testing.T) {
|
|||||||
t.Errorf("Expected port 6503, but got %v", updated_service.Spec.Ports[0].Port)
|
t.Errorf("Expected port 6503, but got %v", updated_service.Spec.Ports[0].Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testIPs := []string{"1.2.3.93", "1.2.3.94", "1.2.3.95", "1.2.3.96"}
|
||||||
|
testIP := ""
|
||||||
|
for _, ip := range testIPs {
|
||||||
|
if !rest.serviceIPs.(*ipallocator.Range).Has(net.ParseIP(ip)) {
|
||||||
|
testIP = ip
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update = deepCloneService(created_service)
|
update = deepCloneService(created_service)
|
||||||
update.Spec.Ports[0].Port = 6503
|
update.Spec.Ports[0].Port = 6503
|
||||||
update.Spec.ClusterIP = "1.2.3.76" // error
|
update.Spec.ClusterIP = testIP // Error: Cluster IP is immutable
|
||||||
|
|
||||||
_, _, err := rest.Update(ctx, update)
|
_, _, err := rest.Update(ctx, update)
|
||||||
if err == nil || !errors.IsInvalid(err) {
|
if err == nil || !errors.IsInvalid(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user