From a05744318c6e619ba1a733080cc3336ce5b37ae7 Mon Sep 17 00:00:00 2001 From: Shreya Anil Naik Date: Wed, 2 Feb 2022 13:01:42 -0800 Subject: [PATCH] Add comments and function renaming --- test/framework/resources/aws/services/eks.go | 17 +++++++++-------- test/integration-new/cni/cni_version_test.go | 4 ++-- test/integration-new/ipamd/ipamd_suite_test.go | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/framework/resources/aws/services/eks.go b/test/framework/resources/aws/services/eks.go index 6786272eb9..ff7ada83a4 100644 --- a/test/framework/resources/aws/services/eks.go +++ b/test/framework/resources/aws/services/eks.go @@ -22,7 +22,7 @@ import ( type EKS interface { DescribeCluster(clusterName string) (*eks.DescribeClusterOutput, error) - CreateAddon(createAddOnParams CreateAddOnParams) (*eks.CreateAddonOutput, error) + CreateAddon(createAddOnParams AddOnInput) (*eks.CreateAddonOutput, error) DeleteAddon(addon string, clusterName string) (*eks.DeleteAddonOutput, error) DescribeAddonVersions(addon string, k8sVersion string) (*eks.DescribeAddonVersionsOutput, error) DescribeAddon(addon string, clusterName string) (*eks.DescribeAddonOutput, error) @@ -32,12 +32,13 @@ type defaultEKS struct { eksiface.EKSAPI } -type CreateAddOnParams struct { +// struct added to make params passing extensible +type AddOnInput struct { _ struct{} `type:"structure"` AddonName string `locationName:"addonName" type:"string" required:"true"` ClusterName string `location:"uri" locationName:"name" min:"1" type:"string" required:"true"` - AddonVersion string `locationName:"addonVersion" type:"string"` + AddonVersion string `locationName:"addonVersion" type:"string"` // eg format: v1.9.3-eksbuild.1 } func NewEKS(session *session.Session, endpoint string) EKS { @@ -49,13 +50,13 @@ func NewEKS(session *session.Session, endpoint string) EKS { } } -func (d defaultEKS) CreateAddon(createAddOnParams CreateAddOnParams) (*eks.CreateAddonOutput, error) { +func (d defaultEKS) CreateAddon(addOnInput AddOnInput) (*eks.CreateAddonOutput, error) { createAddonInput := &eks.CreateAddonInput{ - AddonName: aws.String(createAddOnParams.AddonName), - ClusterName: aws.String(createAddOnParams.ClusterName), + AddonName: aws.String(addOnInput.AddonName), + ClusterName: aws.String(addOnInput.ClusterName), } - if createAddOnParams.AddonVersion != "" { - createAddonInput.SetAddonVersion(createAddOnParams.AddonVersion) + if addOnInput.AddonVersion != "" { + createAddonInput.SetAddonVersion(addOnInput.AddonVersion) createAddonInput.SetResolveConflicts("OVERWRITE") } return d.EKSAPI.CreateAddon(createAddonInput) diff --git a/test/integration-new/cni/cni_version_test.go b/test/integration-new/cni/cni_version_test.go index 91f7181ded..854b923779 100644 --- a/test/integration-new/cni/cni_version_test.go +++ b/test/integration-new/cni/cni_version_test.go @@ -79,14 +79,14 @@ func ApplyAddOn(versionName string) { } By("apply addon version") - _, err = f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName}) + _, err = f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName}) Expect(err).ToNot(HaveOccurred()) } } else { fmt.Printf("By applying addon %s\n", versionName) By("apply addon version") - _, err = f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName}) + _, err = f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName}) Expect(err).ToNot(HaveOccurred()) } diff --git a/test/integration-new/ipamd/ipamd_suite_test.go b/test/integration-new/ipamd/ipamd_suite_test.go index 0830b542d8..175a580669 100644 --- a/test/integration-new/ipamd/ipamd_suite_test.go +++ b/test/integration-new/ipamd/ipamd_suite_test.go @@ -63,7 +63,7 @@ var _ = BeforeSuite(func() { var _ = AfterSuite(func() { if addonDeleteError == nil { By("Restore coredns addon") - _, err := f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "coredns", ClusterName: f.Options.ClusterName}) + _, err := f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "coredns", ClusterName: f.Options.ClusterName}) Expect(err).NotTo(HaveOccurred()) } })