From 4e997e98b13d0053ca35ba64904074bdcc4ab658 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Mon, 7 Aug 2023 08:45:06 -0700 Subject: [PATCH] Trim e2e skip regexes for Cilium --- tests/e2e/pkg/kops/state.go | 17 +++++++++++++++ tests/e2e/pkg/tester/skip_regex.go | 35 ++++++++++++++++++++---------- tests/e2e/pkg/tester/tester.go | 4 ++++ 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/tests/e2e/pkg/kops/state.go b/tests/e2e/pkg/kops/state.go index 8ddf41068779f..e5b14fb115ebe 100644 --- a/tests/e2e/pkg/kops/state.go +++ b/tests/e2e/pkg/kops/state.go @@ -83,3 +83,20 @@ func GetInstanceGroups(kopsBinary, clusterName string, env []string) ([]*api.Ins } return igs, nil } + +// GetVersion will retrieve the kOps version. +func GetVersion(kopsBinary string) (string, error) { + args := []string{ + kopsBinary, "version", "--short", + } + c := exec.Command(args[0], args[1:]...) + var stdout bytes.Buffer + c.SetStdout(&stdout) + var stderr bytes.Buffer + c.SetStderr(&stderr) + if err := c.Run(); err != nil { + klog.Warningf("failed to run %s; stderr=%s", strings.Join(args, " "), stderr.String()) + return "", fmt.Errorf("error querying version from %s: %w", strings.Join(args, " "), err) + } + return stdout.String(), nil +} diff --git a/tests/e2e/pkg/tester/skip_regex.go b/tests/e2e/pkg/tester/skip_regex.go index e1ea5e6d05a63..ff40f3a88c15e 100644 --- a/tests/e2e/pkg/tester/skip_regex.go +++ b/tests/e2e/pkg/tester/skip_regex.go @@ -34,6 +34,12 @@ func (t *Tester) setSkipRegexFlag() error { return nil } + kopsVersion, err := t.getKopsVersion() + if err != nil { + return err + } + isPre28 := kopsVersion < "1.28" + cluster, err := t.getKopsCluster() if err != nil { return err @@ -45,12 +51,14 @@ func (t *Tester) setSkipRegexFlag() error { skipRegex := skipRegexBase - // All the loadbalancer tests in the suite fail on IPv6, however, - // they were skipped because they were tagged as [Slow] - // skip these tests temporary since they fail always on IPv6 - // TODO: aojea - // https://github.com/kubernetes/kubernetes/issues/113964 - skipRegex += "|LoadBalancers.should.be.able.to.preserve.UDP.traffic" + if isPre28 { + // All the loadbalancer tests in the suite fail on IPv6, however, + // they were skipped because they were tagged as [Slow] + // skip these tests temporary since they fail always on IPv6 + // TODO: aojea + // https://github.com/kubernetes/kubernetes/issues/113964 + skipRegex += "|LoadBalancers.should.be.able.to.preserve.UDP.traffic" + } networking := cluster.Spec.LegacyNetworking switch { @@ -67,12 +75,15 @@ func (t *Tester) setSkipRegexFlag() error { skipRegex += "|same.hostPort.but.different.hostIP.and.protocol" // https://github.com/cilium/cilium/issues/9207 skipRegex += "|serve.endpoints.on.same.port.and.different.protocols" - // These may be fixed in Cilium 1.13 but skipping for now - skipRegex += "|Service.with.multiple.ports.specified.in.multiple.EndpointSlices" - skipRegex += "|should.create.a.Pod.with.SCTP.HostPort" - // https://github.com/cilium/cilium/issues/18241 - skipRegex += "|Services.should.create.endpoints.for.unready.pods" - skipRegex += "|Services.should.be.able.to.connect.to.terminating.and.unready.endpoints.if.PublishNotReadyAddresses.is.true" + + if isPre28 { + // These may be fixed in Cilium 1.13 but skipping for now + skipRegex += "|Service.with.multiple.ports.specified.in.multiple.EndpointSlices" + skipRegex += "|should.create.a.Pod.with.SCTP.HostPort" + // https://github.com/cilium/cilium/issues/18241 + skipRegex += "|Services.should.create.endpoints.for.unready.pods" + skipRegex += "|Services.should.be.able.to.connect.to.terminating.and.unready.endpoints.if.PublishNotReadyAddresses.is.true" + } } else if networking.KubeRouter != nil { skipRegex += "|load-balancer|hairpin|affinity\\stimeout|service\\.kubernetes\\.io|CLOSE_WAIT" skipRegex += "|EndpointSlice.should.support.a.Service.with.multiple" diff --git a/tests/e2e/pkg/tester/tester.go b/tests/e2e/pkg/tester/tester.go index 59989296cfd03..d8a49da3dec4a 100644 --- a/tests/e2e/pkg/tester/tester.go +++ b/tests/e2e/pkg/tester/tester.go @@ -97,6 +97,10 @@ func hasFlag(args string, flag string) bool { return false } +func (t *Tester) getKopsVersion() (string, error) { + return kops.GetVersion("kops") +} + func (t *Tester) getKopsCluster() (*api.Cluster, error) { if t.kopsCluster != nil { return t.kopsCluster, nil