Skip to content

Commit

Permalink
infraconfig: additional test cases for VIP mutation
Browse files Browse the repository at this point in the history
Contributes-to: OCPBUGS-31424
  • Loading branch information
mkowalski committed Mar 27, 2024
1 parent e9ab6a9 commit 9e78c83
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions pkg/controller/infrastructureconfig/sync_specstatus_test.go
Expand Up @@ -178,6 +178,100 @@ func Test_SpecStatusSynchronizer(t *testing.T) {
},
wantedErr: "first VIP cannot be modified",
},
{
name: "succeed: modifying second pair of vips",
givenInfra: configv1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.InfrastructureSpec{
PlatformSpec: configv1.PlatformSpec{
BareMetal: &configv1.BareMetalPlatformSpec{
APIServerInternalIPs: []configv1.IP{"224.0.0.1", "2001:0DB8::10"},
IngressIPs: []configv1.IP{"224.0.0.2", "2001:0DB8::20"},
},
},
},
Status: configv1.InfrastructureStatus{
Platform: configv1.BareMetalPlatformType,
PlatformStatus: &configv1.PlatformStatus{
Type: "BareMetal",
BareMetal: &configv1.BareMetalPlatformStatus{
APIServerInternalIPs: []string{"224.0.0.1", "2001:0DB8::1"},
IngressIPs: []string{"224.0.0.2", "2001:0DB8::2"},
},
},
},
},
wantedInfra: configv1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.InfrastructureSpec{
PlatformSpec: configv1.PlatformSpec{
BareMetal: &configv1.BareMetalPlatformSpec{
APIServerInternalIPs: []configv1.IP{"224.0.0.1", "2001:0DB8::10"},
IngressIPs: []configv1.IP{"224.0.0.2", "2001:0DB8::20"},
MachineNetworks: []configv1.CIDR{},
},
},
},
Status: configv1.InfrastructureStatus{
Platform: configv1.BareMetalPlatformType,
PlatformStatus: &configv1.PlatformStatus{
Type: "BareMetal",
BareMetal: &configv1.BareMetalPlatformStatus{
APIServerInternalIPs: []string{"224.0.0.1", "2001:0DB8::10"},
IngressIPs: []string{"224.0.0.2", "2001:0DB8::20"},
MachineNetworks: []configv1.CIDR{},
},
},
},
},
},
{
name: "succeed: deleting second pair of vips",
givenInfra: configv1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.InfrastructureSpec{
PlatformSpec: configv1.PlatformSpec{
BareMetal: &configv1.BareMetalPlatformSpec{
APIServerInternalIPs: []configv1.IP{"224.0.0.1"},
IngressIPs: []configv1.IP{"224.0.0.2"},
},
},
},
Status: configv1.InfrastructureStatus{
Platform: configv1.BareMetalPlatformType,
PlatformStatus: &configv1.PlatformStatus{
Type: "BareMetal",
BareMetal: &configv1.BareMetalPlatformStatus{
APIServerInternalIPs: []string{"224.0.0.1", "2001:0DB8::1"},
IngressIPs: []string{"224.0.0.2", "2001:0DB8::2"},
},
},
},
},
wantedInfra: configv1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.InfrastructureSpec{
PlatformSpec: configv1.PlatformSpec{
BareMetal: &configv1.BareMetalPlatformSpec{
APIServerInternalIPs: []configv1.IP{"224.0.0.1"},
IngressIPs: []configv1.IP{"224.0.0.2"},
MachineNetworks: []configv1.CIDR{},
},
},
},
Status: configv1.InfrastructureStatus{
Platform: configv1.BareMetalPlatformType,
PlatformStatus: &configv1.PlatformStatus{
Type: "BareMetal",
BareMetal: &configv1.BareMetalPlatformStatus{
APIServerInternalIPs: []string{"224.0.0.1"},
IngressIPs: []string{"224.0.0.2"},
MachineNetworks: []configv1.CIDR{},
},
},
},
},
},
{
name: "fail: removing machine networks from spec is forbidden",
givenInfra: configv1.Infrastructure{
Expand Down

0 comments on commit 9e78c83

Please sign in to comment.