Skip to content

Commit

Permalink
test: Remove ginkgo linux dependency
Browse files Browse the repository at this point in the history
[ upstream commit 015ffbd ]

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 <jarno@covalent.io>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
jrajahalme authored and borkmann committed Jun 16, 2020
1 parent e6e8191 commit 153cb98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
16 changes: 8 additions & 8 deletions pkg/datapath/iptables/iptables.go
Expand Up @@ -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:"
)
Expand Down Expand Up @@ -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
}

Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -339,7 +339,7 @@ var ciliumChains = []customChain{
}

var transientChain = customChain{
name: CiliumTransientForwardChain,
name: ciliumTransientForwardChain,
table: "filter",
hook: "FORWARD",
feederArgs: []string{""},
Expand Down Expand Up @@ -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)"
}

Expand Down Expand Up @@ -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)
}
}
Expand Down
30 changes: 14 additions & 16 deletions test/helpers/cons.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 153cb98

Please sign in to comment.