Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi <parthvi.vala@suse.com>
  • Loading branch information
valaparthvi committed Jun 11, 2024
1 parent c2c3f14 commit b288774
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controller/eks-cluster-config-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func validateUpdate(config *eksv1.EKSClusterConfig) error {
if _, ok := nodeGroupNames[aws.ToString(ng.NodegroupName)]; !ok {
nodeGroupNames[aws.ToString(ng.NodegroupName)] = struct{}{}
} else {
errs = append(errs, fmt.Sprintf("node group name %s must be unique within the [%s (%s)] cluster to avoid duplication", aws.ToString(ng.NodegroupName), config.Spec.DisplayName, config.Name))
errs = append(errs, fmt.Sprintf("node group name %q must be unique within the [%s (id: %s)] cluster to avoid duplication", aws.ToString(ng.NodegroupName), config.Spec.DisplayName, config.Name))
}

if ng.Version == nil {
Expand Down
5 changes: 3 additions & 2 deletions controller/eks-cluster-config-handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (
eksv1 "github.com/rancher/eks-operator/pkg/apis/eks.cattle.io/v1"
"github.com/rancher/eks-operator/pkg/eks"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/rancher/eks-operator/pkg/eks/services/mock_services"
"github.com/rancher/eks-operator/pkg/test"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ = Describe("importCluster", func() {
Expand Down Expand Up @@ -205,6 +206,6 @@ var _ = Describe("updateCluster", func() {
eksConfig.Status.Phase = "active"
eksConfig.Spec.NodeGroups = append(eksConfig.Spec.NodeGroups, eksConfig.Spec.NodeGroups...)
_, err := handler.OnEksConfigChanged("", eksConfig)
Expect(err).To(MatchError("node group names must be unique within the [test] cluster to avoid duplication"))
Expect(err).To(MatchError("node group name \"ng1\" must be unique within the [test (id: test)] cluster to avoid duplication"))
})
})

0 comments on commit b288774

Please sign in to comment.