From 41f302f5a3fb1562a7cf033bc11042e0f1ce09b3 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Wed, 6 Jul 2022 08:41:17 -0700 Subject: [PATCH 1/2] Fix Go build for ipamd test package. --- test/integration/ipamd/eni_ip_leak_test.go | 4 +++ test/integration/ipamd/ipamd_suite_test.go | 9 ------- test/integration/ipamd/warm_target_test.go | 21 --------------- .../ipamd/warm_target_test_PD_enabled.go | 27 +++++++++++++++++++ 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/test/integration/ipamd/eni_ip_leak_test.go b/test/integration/ipamd/eni_ip_leak_test.go index d71efe5c84..5bee96255b 100644 --- a/test/integration/ipamd/eni_ip_leak_test.go +++ b/test/integration/ipamd/eni_ip_leak_test.go @@ -1,6 +1,7 @@ package ipamd import ( + "k8s.io/api/core/v1" "time" "github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/k8s/manifest" @@ -15,6 +16,9 @@ const ( HOST_POD_LABEL_VAL = "host" ) +var primaryNode v1.Node +var numOfNodes int + var _ = Describe("[CANARY] ENI/IP Leak Test", func() { Context("ENI/IP Released on Pod Deletion", func() { BeforeEach(func() { diff --git a/test/integration/ipamd/ipamd_suite_test.go b/test/integration/ipamd/ipamd_suite_test.go index 15735d056c..441302f4d6 100644 --- a/test/integration/ipamd/ipamd_suite_test.go +++ b/test/integration/ipamd/ipamd_suite_test.go @@ -18,19 +18,10 @@ import ( "github.com/aws/amazon-vpc-cni-k8s/test/framework" k8sUtils "github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/k8s/utils" - "github.com/aws/aws-sdk-go/service/ec2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" ) -var err error -var f *framework.Framework -var primaryNode v1.Node -var primaryInstance *ec2.Instance -var numOfNodes int -var addonDeleteError error - func TestIPAMD(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "VPC IPAMD Test Suite") diff --git a/test/integration/ipamd/warm_target_test.go b/test/integration/ipamd/warm_target_test.go index 13339b160e..ef7f7555eb 100644 --- a/test/integration/ipamd/warm_target_test.go +++ b/test/integration/ipamd/warm_target_test.go @@ -171,24 +171,3 @@ var _ = Describe("test warm target variables", func() { }) }) }) - -func Max(x, y int) int { - if x < y { - return y - } - return x -} - -// MinIgnoreZero returns smaller of two number, if any number is zero returns the other number -func MinIgnoreZero(x, y int) int { - if x == 0 { - return y - } - if y == 0 { - return x - } - if x < y { - return x - } - return y -} diff --git a/test/integration/ipamd/warm_target_test_PD_enabled.go b/test/integration/ipamd/warm_target_test_PD_enabled.go index 72838bd8aa..5cd07c9c5a 100644 --- a/test/integration/ipamd/warm_target_test_PD_enabled.go +++ b/test/integration/ipamd/warm_target_test_PD_enabled.go @@ -15,6 +15,8 @@ package ipamd import ( "fmt" + "github.com/aws/amazon-vpc-cni-k8s/test/framework" + "github.com/aws/aws-sdk-go/service/ec2" "strconv" "time" @@ -25,6 +27,10 @@ import ( . "github.com/onsi/gomega" ) +var primaryInstance *ec2.Instance +var f *framework.Framework +var err error + // IMPORTANT: THE NODEGROUP TO RUN THE TEST MUST NOT HAVE ANY POD // Ideally we should drain the node, but drain from go client is non trivial // IMPORTANT: Only support nodes that can have 16+ Secondary IPV4s across at least 3 ENI @@ -322,3 +328,24 @@ var _ = Describe("test warm target variables", func() { func ceil(x, y int) int { return (x + y - 1) / y } + +func Max(x, y int) int { + if x < y { + return y + } + return x +} + +// MinIgnoreZero returns smaller of two number, if any number is zero returns the other number +func MinIgnoreZero(x, y int) int { + if x == 0 { + return y + } + if y == 0 { + return x + } + if x < y { + return x + } + return y +} From deeb8f0870946cbb8980ed9f793a3b4003d1784c Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Wed, 6 Jul 2022 09:59:58 -0700 Subject: [PATCH 2/2] Fix format with make format --- test/integration/ipamd/eni_ip_leak_test.go | 3 ++- test/integration/ipamd/warm_target_test_PD_enabled.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/integration/ipamd/eni_ip_leak_test.go b/test/integration/ipamd/eni_ip_leak_test.go index 5bee96255b..4446e0fc48 100644 --- a/test/integration/ipamd/eni_ip_leak_test.go +++ b/test/integration/ipamd/eni_ip_leak_test.go @@ -1,9 +1,10 @@ package ipamd import ( - "k8s.io/api/core/v1" "time" + v1 "k8s.io/api/core/v1" + "github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/k8s/manifest" k8sUtils "github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/k8s/utils" "github.com/aws/amazon-vpc-cni-k8s/test/framework/utils" diff --git a/test/integration/ipamd/warm_target_test_PD_enabled.go b/test/integration/ipamd/warm_target_test_PD_enabled.go index 5cd07c9c5a..e115c588a7 100644 --- a/test/integration/ipamd/warm_target_test_PD_enabled.go +++ b/test/integration/ipamd/warm_target_test_PD_enabled.go @@ -15,11 +15,12 @@ package ipamd import ( "fmt" - "github.com/aws/amazon-vpc-cni-k8s/test/framework" - "github.com/aws/aws-sdk-go/service/ec2" "strconv" "time" + "github.com/aws/amazon-vpc-cni-k8s/test/framework" + "github.com/aws/aws-sdk-go/service/ec2" + k8sUtils "github.com/aws/amazon-vpc-cni-k8s/test/framework/resources/k8s/utils" "github.com/aws/amazon-vpc-cni-k8s/test/framework/utils"