Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Go build for ipamd test package. #2023

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/integration/ipamd/eni_ip_leak_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package ipamd
import (
"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"
Expand All @@ -15,6 +17,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() {
Expand Down
9 changes: 0 additions & 9 deletions test/integration/ipamd/ipamd_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
21 changes: 0 additions & 21 deletions test/integration/ipamd/warm_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
28 changes: 28 additions & 0 deletions test/integration/ipamd/warm_target_test_PD_enabled.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ import (
"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"

. "github.com/onsi/ginkgo/v2"
. "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
Expand Down Expand Up @@ -322,3 +329,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
}