Skip to content

Commit

Permalink
fix e2e ipv6 test issue (#7359)
Browse files Browse the repository at this point in the history
  • Loading branch information
haouc authored Nov 9, 2024
1 parent 6ffb599 commit 7e8269b
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test/suites/ipv6/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1"
coretest "sigs.k8s.io/karpenter/pkg/test"

"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"

v1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1"
Expand Down Expand Up @@ -111,15 +110,11 @@ var _ = Describe("IPv6", func() {
env.ExpectCreated(pod, nodeClass, nodePool)
env.EventuallyExpectHealthy(pod)
env.ExpectCreatedNodeCount("==", 1)
output, err := env.EC2API.DescribeInstances(env.Context, &ec2.DescribeInstancesInput{
InstanceIds: []string{coretest.Pod().Spec.NodeName},
})
Expect(err).ShouldNot(HaveOccurred())
Expect(output.Reservations).To(HaveLen(1))
Expect(output.Reservations[0].Instances).To(HaveLen(1))
Expect(output.Reservations[0].Instances[0].NetworkInterfaces).To(HaveLen(1))
Expect(output.Reservations[0].Instances[0].NetworkInterfaces[0].Ipv6Prefixes).To(HaveLen(1))
_, hasIPv6Primary := lo.Find(output.Reservations[0].Instances[0].NetworkInterfaces[0].Ipv6Addresses, func(ip types.InstanceIpv6Address) bool {
node := env.GetNode(pod.Spec.NodeName)
instance := env.GetInstanceByID(env.ExpectParsedProviderID(node.Spec.ProviderID))
Expect(instance.NetworkInterfaces).To(HaveLen(1))
Expect(instance.NetworkInterfaces[0].Ipv6Prefixes).To(HaveLen(1))
_, hasIPv6Primary := lo.Find(instance.NetworkInterfaces[0].Ipv6Addresses, func(ip types.InstanceIpv6Address) bool {
return lo.FromPtr(ip.IsPrimaryIpv6)
})
Expect(hasIPv6Primary).To(BeTrue())
Expand Down

0 comments on commit 7e8269b

Please sign in to comment.