Skip to content

Commit

Permalink
update apiserver validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nawazkh committed Jan 17, 2025
1 parent 440b0c1 commit 24d10da
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions api/v1beta1/azurecluster_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,15 +893,15 @@ func TestValidateAPIServerLB(t *testing.T) {
testcases := []struct {
name string
featureGate featuregate.Feature
lb LoadBalancerSpec
old LoadBalancerSpec
lb *LoadBalancerSpec
old *LoadBalancerSpec
cpCIDRS []string
wantErr bool
expectedErr field.Error
}{
{
name: "invalid SKU",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
Name: "my-awesome-lb",
FrontendIPs: []FrontendIP{
{
Expand All @@ -923,7 +923,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "invalid Type",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
LoadBalancerClassSpec: LoadBalancerClassSpec{
Type: "Foo",
},
Expand All @@ -938,7 +938,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "invalid Name",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
Name: "***",
},
wantErr: true,
Expand All @@ -951,7 +951,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "too many IP configs",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
LoadBalancerClassSpec: LoadBalancerClassSpec{
Type: Public,
},
Expand Down Expand Up @@ -982,7 +982,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "too many IP configs with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
LoadBalancerClassSpec: LoadBalancerClassSpec{
Type: Public,
},
Expand Down Expand Up @@ -1012,7 +1012,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "public LB with private IP",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1035,7 +1035,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "public LB with private IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
Name: "my-awesome-lb",
FrontendIPs: []FrontendIP{
{
Expand All @@ -1062,7 +1062,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "internal LB with public IP",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1085,7 +1085,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "internal LB with public IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1107,7 +1107,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "internal LB with invalid private IP",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1131,7 +1131,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "internal LB with invalid private IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1154,7 +1154,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "internal LB with out of range private IP",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1179,7 +1179,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "internal LB with out of range private IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1203,7 +1203,7 @@ func TestValidateAPIServerLB(t *testing.T) {
},
{
name: "internal LB with in range private IP",
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand All @@ -1224,7 +1224,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "public LB with in-range private IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand Down Expand Up @@ -1252,7 +1252,7 @@ func TestValidateAPIServerLB(t *testing.T) {
{
name: "public LB with out of range private IP with feature flag APIServerILB enabled",
featureGate: feature.APIServerILB,
lb: LoadBalancerSpec{
lb: &LoadBalancerSpec{
FrontendIPs: []FrontendIP{
{
Name: "ip-1",
Expand Down Expand Up @@ -1282,7 +1282,7 @@ func TestValidateAPIServerLB(t *testing.T) {
if test.featureGate == feature.APIServerILB {
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.Gates, test.featureGate, true)()
}
err := validateAPIServerLB(&test.lb, &test.old, test.cpCIDRS, field.NewPath("apiServerLB"))
err := validateAPIServerLB(test.lb, test.old, test.cpCIDRS, field.NewPath("apiServerLB"))
if test.wantErr {
g.Expect(err).To(ContainElement(MatchError(test.expectedErr.Error())))
} else {
Expand Down

0 comments on commit 24d10da

Please sign in to comment.