Skip to content

Commit

Permalink
cni:fix order dependent test failures (#28349)
Browse files Browse the repository at this point in the history
The `interceptRuleMgrType` decalred in main.go as "iptables", it would
be changed to "mock" in func resetGlobalTestVariables().

When run single test, it would be "iptables" and make test failed.

Signed-off-by: Xiang Dai <long0dai@foxmail.com>
  • Loading branch information
daixiang0 authored Oct 28, 2020
1 parent 86b87f2 commit e5f350d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cni/cmd/istio-cni/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ type mockInterceptRuleMgr struct {
lastRedirect []*Redirect
}

func init() {
interceptRuleMgrType = "mock"
testAnnotations[sidecarStatusKey] = "true"
}

func (mrdir *mockInterceptRuleMgr) Program(netns string, redirect *Redirect) error {
nsenterFuncCalled = true
mrdir.lastRedirect = append(mrdir.lastRedirect, redirect)
Expand Down

0 comments on commit e5f350d

Please sign in to comment.