Skip to content

Commit

Permalink
Fix EKSCluster test for Create call behavior change.
Browse files Browse the repository at this point in the history
It still doesn't pass because validations in new CRD format that
controller-tools 0.2.0 generates are ignored, hence validation
tests fail. See kubernetes-sigs/controller-tools#302 (comment)

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
  • Loading branch information
muvaf authored and hasheddan committed Aug 9, 2019
1 parent a56c047 commit e823908
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions aws/apis/compute/v1alpha1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestEKSCluster(t *testing.T) {
autoscaleSize := 1
volSize := 20
key := types.NamespacedName{Name: name, Namespace: namespace}
created := &EKSCluster{
base := &EKSCluster{
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: namespace},
Spec: EKSClusterSpec{
Region: "us-west-2",
Expand Down Expand Up @@ -84,6 +84,7 @@ func TestEKSCluster(t *testing.T) {

// Test Create
fetched := &EKSCluster{}
created := base.DeepCopy()
g.Expect(c.Create(ctx, created)).NotTo(HaveOccurred())

g.Expect(c.Get(ctx, key, fetched)).NotTo(HaveOccurred())
Expand All @@ -102,12 +103,12 @@ func TestEKSCluster(t *testing.T) {
g.Expect(c.Get(ctx, key, fetched)).To(HaveOccurred())

// Test create w/invalid region
badRegion := created.DeepCopy()
badRegion := base.DeepCopy()
badRegion.Spec.Region = "bad-region"
g.Expect(c.Create(ctx, badRegion)).To(MatchError(ContainSubstring("spec.region in body should be one of [us-west-2 us-east-1 eu-west-1]")))

// Test create w/invalid instance type
badInstanceType := created.DeepCopy()
badInstanceType := base.DeepCopy()
badInstanceType.Spec.WorkerNodes.NodeInstanceType = "xs-bad-type"
g.Expect(c.Create(ctx, badInstanceType)).To(MatchError(ContainSubstring("spec.workerNodes.nodeInstanceType in body should be one of [t2.small")))
}
Expand Down

0 comments on commit e823908

Please sign in to comment.