Skip to content

Commit

Permalink
Add test case for scaling w/ no min or max configured
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Jun 5, 2023
1 parent 2fc5343 commit d83f0fd
Showing 1 changed file with 43 additions and 4 deletions.
47 changes: 43 additions & 4 deletions control-plane/api-gateway/gatekeeper/gatekeeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestUpsert(t *testing.T) {
},
},
},
"create a new gateway where the GatewayClassConfig has a default number of instances greater than the maximum on the GatewayClassConfig": {
"create a new gateway where the GatewayClassConfig has a default number of instances greater than the max on the GatewayClassConfig": {
gateway: gwv1beta1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestUpsert(t *testing.T) {
serviceAccounts: []*corev1.ServiceAccount{},
},
},
"create a new gateway where the GatewayClassConfig has a default number of instances lesser than the minimum on the GatewayClassConfig": {
"create a new gateway where the GatewayClassConfig has a default number of instances lesser than the min on the GatewayClassConfig": {
gateway: gwv1beta1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down Expand Up @@ -479,7 +479,46 @@ func TestUpsert(t *testing.T) {
serviceAccounts: []*corev1.ServiceAccount{},
},
},
"update a gateway deployment by scaling it lower than the minimum number of instances on the GatewayClassConfig": {
"update a gateway deployment by scaling it when no min or max number of instances is defined on the GatewayClassConfig": {
gateway: gwv1beta1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: gwv1beta1.GatewaySpec{
Listeners: listeners,
},
},
gatewayClassConfig: v1alpha1.GatewayClassConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "consul-gatewayclassconfig",
},
Spec: v1alpha1.GatewayClassConfigSpec{
DeploymentSpec: v1alpha1.DeploymentSpec{
DefaultInstances: common.PointerTo(int32(3)),
MaxInstances: nil,
MinInstances: nil,
},
CopyAnnotations: v1alpha1.CopyAnnotationsSpec{},
ServiceType: (*corev1.ServiceType)(common.PointerTo("NodePort")),
},
},
helmConfig: common.HelmConfig{},
initialResources: resources{
deployments: []*appsv1.Deployment{
configureDeployment(name, namespace, labels, 8, nil, nil, "", "1"),
},
},
finalResources: resources{
deployments: []*appsv1.Deployment{
configureDeployment(name, namespace, labels, 8, nil, nil, "", "1"),
},
roles: []*rbac.Role{},
services: []*corev1.Service{},
serviceAccounts: []*corev1.ServiceAccount{},
},
},
"update a gateway deployment by scaling it lower than the min number of instances on the GatewayClassConfig": {
gateway: gwv1beta1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down Expand Up @@ -518,7 +557,7 @@ func TestUpsert(t *testing.T) {
serviceAccounts: []*corev1.ServiceAccount{},
},
},
"update a gateway deployment by scaling it higher than the maximum number of instances on the GatewayClassConfig": {
"update a gateway deployment by scaling it higher than the max number of instances on the GatewayClassConfig": {
gateway: gwv1beta1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down

0 comments on commit d83f0fd

Please sign in to comment.