From 153cb98e092054102ba165925ef0670d29bf5e02 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Sat, 13 Jun 2020 09:23:56 -0700 Subject: [PATCH] test: Remove ginkgo linux dependency [ upstream commit 015ffbde0a66fe20fbf6028d05231e356804b7c1 ] Remove ginkgo test source dependency on pkg/iptables, as that only compiles on Linux. This allows running ginkgo from OSX against GKE, for example. Signed-off-by: Jarno Rajahalme Signed-off-by: Daniel Borkmann --- pkg/datapath/iptables/iptables.go | 16 ++++++++-------- test/helpers/cons.go | 30 ++++++++++++++---------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/pkg/datapath/iptables/iptables.go b/pkg/datapath/iptables/iptables.go index 9caefd699884..eb899e4137e3 100644 --- a/pkg/datapath/iptables/iptables.go +++ b/pkg/datapath/iptables/iptables.go @@ -50,7 +50,7 @@ const ( ciliumPreMangleChain = "CILIUM_PRE_mangle" ciliumPreRawChain = "CILIUM_PRE_raw" ciliumForwardChain = "CILIUM_FORWARD" - CiliumTransientForwardChain = "CILIUM_TRANSIENT_FORWARD" + ciliumTransientForwardChain = "CILIUM_TRANSIENT_FORWARD" feederDescription = "cilium-feeder:" xfrmDescription = "cilium-xfrm-notrack:" ) @@ -165,7 +165,7 @@ func (m *IptablesManager) removeCiliumRules(table, prog, match string) { for scanner.Scan() { rule := scanner.Text() log.WithField(logfields.Object, logfields.Repr(rule)).Debugf("Considering removing %s rule", prog) - if match != CiliumTransientForwardChain && strings.Contains(rule, CiliumTransientForwardChain) { + if match != ciliumTransientForwardChain && strings.Contains(rule, ciliumTransientForwardChain) { continue } @@ -179,8 +179,8 @@ func (m *IptablesManager) removeCiliumRules(table, prog, match string) { // disabled chains skipFeeder := false for _, disabledChain := range option.Config.DisableIptablesFeederRules { - // we skip if the match is CiliumTransientForwardChain since we don't want to touch it - if match != CiliumTransientForwardChain && strings.Contains(rule, " "+strings.ToUpper(disabledChain)+" ") { + // we skip if the match is ciliumTransientForwardChain since we don't want to touch it + if match != ciliumTransientForwardChain && strings.Contains(rule, " "+strings.ToUpper(disabledChain)+" ") { log.WithField("chain", disabledChain).Info("Skipping the removal of feeder chain") skipFeeder = true break @@ -217,7 +217,7 @@ func (c *customChain) remove(waitArgs []string, quiet bool) { // present, log the error. // This is to help debug #11276. msgChainNotFound := ": No chain/target/match by that name.\n" - debugTransientRules := c.name == CiliumTransientForwardChain && + debugTransientRules := c.name == ciliumTransientForwardChain && string(combinedOutput) != prog+msgChainNotFound if !quiet || debugTransientRules { log.Warnf(string(combinedOutput)) @@ -339,7 +339,7 @@ var ciliumChains = []customChain{ } var transientChain = customChain{ - name: CiliumTransientForwardChain, + name: ciliumTransientForwardChain, table: "filter", hook: "FORWARD", feederArgs: []string{""}, @@ -717,7 +717,7 @@ func getDeliveryInterface(ifName string) string { func (m *IptablesManager) installForwardChainRules(ifName, localDeliveryInterface, forwardChain string) error { transient := "" - if forwardChain == CiliumTransientForwardChain { + if forwardChain == ciliumTransientForwardChain { transient = " (transient)" } @@ -829,7 +829,7 @@ func (m *IptablesManager) TransientRulesStart(ifName string) error { // TransientRulesEnd removes Cilium related rules installed from TransientRulesStart. func (m *IptablesManager) TransientRulesEnd(quiet bool) { if option.Config.EnableIPv4 { - m.removeCiliumRules("filter", "iptables", CiliumTransientForwardChain) + m.removeCiliumRules("filter", "iptables", ciliumTransientForwardChain) transientChain.remove(m.waitArgs, quiet) } } diff --git a/test/helpers/cons.go b/test/helpers/cons.go index b1e7aab84651..cfc091f37d78 100644 --- a/test/helpers/cons.go +++ b/test/helpers/cons.go @@ -20,7 +20,6 @@ import ( "os" "time" - "github.com/cilium/cilium/pkg/datapath/iptables" k8sConst "github.com/cilium/cilium/pkg/k8s/apis/cilium.io" "github.com/cilium/cilium/pkg/versioncheck" "github.com/cilium/cilium/test/ginkgo-ext" @@ -224,21 +223,20 @@ const ( // Logs messages that should not be in the cilium logs. panicMessage = "panic:" - deadLockHeader = "POTENTIAL DEADLOCK:" // from github.com/sasha-s/go-deadlock/deadlock.go:header - segmentationFault = "segmentation fault" // from https://github.com/cilium/cilium/issues/3233 - NACKreceived = "NACK received for version" // from https://github.com/cilium/cilium/issues/4003 - RunInitFailed = "JoinEP: " // from https://github.com/cilium/cilium/pull/5052 - sizeMismatch = "size mismatch for BPF map" // from https://github.com/cilium/cilium/issues/7851 - emptyBPFInitArg = "empty argument passed to bpf/init.sh" // from https://github.com/cilium/cilium/issues/10228 - RemovingMapMsg = "Removing map to allow for property upgrade" // from https://github.com/cilium/cilium/pull/10626 - logBufferMessage = "Log buffer too small to dump verifier log" // from https://github.com/cilium/cilium/issues/10517 - ClangErrorsMsg = " errors generated." // from https://github.com/cilium/cilium/issues/10857 - ClangErrorMsg = "1 error generated." // from https://github.com/cilium/cilium/issues/10857 - symbolSubstitution = "Skipping symbol substitution" // - uninitializedRegen = "Uninitialized regeneration level" // from https://github.com/cilium/cilium/pull/10949 - unstableStat = "BUG: stat() has unstable behavior" // from https://github.com/cilium/cilium/pull/11028 - removeTransientRule = "Unable to process chain " + - iptables.CiliumTransientForwardChain + " with ip" // from https://github.com/cilium/cilium/issues/11276 + deadLockHeader = "POTENTIAL DEADLOCK:" // from github.com/sasha-s/go-deadlock/deadlock.go:header + segmentationFault = "segmentation fault" // from https://github.com/cilium/cilium/issues/3233 + NACKreceived = "NACK received for version" // from https://github.com/cilium/cilium/issues/4003 + RunInitFailed = "JoinEP: " // from https://github.com/cilium/cilium/pull/5052 + sizeMismatch = "size mismatch for BPF map" // from https://github.com/cilium/cilium/issues/7851 + emptyBPFInitArg = "empty argument passed to bpf/init.sh" // from https://github.com/cilium/cilium/issues/10228 + RemovingMapMsg = "Removing map to allow for property upgrade" // from https://github.com/cilium/cilium/pull/10626 + logBufferMessage = "Log buffer too small to dump verifier log" // from https://github.com/cilium/cilium/issues/10517 + ClangErrorsMsg = " errors generated." // from https://github.com/cilium/cilium/issues/10857 + ClangErrorMsg = "1 error generated." // from https://github.com/cilium/cilium/issues/10857 + symbolSubstitution = "Skipping symbol substitution" // + uninitializedRegen = "Uninitialized regeneration level" // from https://github.com/cilium/cilium/pull/10949 + unstableStat = "BUG: stat() has unstable behavior" // from https://github.com/cilium/cilium/pull/11028 + removeTransientRule = "Unable to process chain CILIUM_TRANSIENT_FORWARD with ip" // from https://github.com/cilium/cilium/issues/11276 // HelmTemplate is the location of the Helm templates to install Cilium HelmTemplate = "../install/kubernetes/cilium"