Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add in some serial setup tests; a little make cleanup #100

Merged
merged 1 commit into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ jobs:

- run: |
bash -x script/install-cni
make clean V=1
make bin/integration.test V=1
sudo make clean V=1
make test V=1
sudo make integration V=1
working-directory: src/github.com/containerd/go-cni
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ help: ## this help
test: ## run tests, except integration tests and tests that require root
$(Q)go test -v -race $(EXTRA_TESTFLAGS) -count=1 ./...

integration: ## run integration test
integration: bin/integration.test ## run integration test
$(Q)bin/integration.test -test.v -test.count=1 -test.root $(EXTRA_TESTFLAGS) -test.parallel $(TESTFLAGS_PARALLEL)

FORCE:

bin/integration.test: FORCE ## build integration test binary into bin
bin/integration.test: ## build integration test binary into bin
$(Q)cd ./integration && go test -race -c . -o ../bin/integration.test

clean: ## clean up binaries
Expand Down
32 changes: 28 additions & 4 deletions integration/cni_setup_teardown_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,26 @@ func TestBasicSetupAndRemove(t *testing.T) {

// Setup network
result, err := l.Setup(ctx, id, nsPath)
assert.NoError(t, err, "[%v] setup network for namespace %v", idx, nsPath)
assert.NoError(t, err, "[%v] setup network interfaces for namespace in parallel %v", idx, nsPath)

ip := result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
t.Logf("[%v] ip is %v", idx, ip)

assert.NoError(t,
l.Remove(ctx, id, nsPath),
"[%v] teardown network for namespace %v", idx, nsPath,
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
)

// Setup network serially
result, err = l.SetupSerially(ctx, id, nsPath)
assert.NoError(t, err, "[%v] setup network interfaces for namespace serially%v", idx, nsPath)

ip = result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
t.Logf("[%v] ip is %v", idx, ip)

assert.NoError(t,
l.Remove(ctx, id, nsPath),
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
)
}
}
Expand Down Expand Up @@ -271,14 +283,26 @@ func TestBasicSetupAndRemovePluginWithoutVersion(t *testing.T) {

// Setup network
result, err := l.Setup(ctx, id, nsPath)
assert.NoError(t, err, "[%v] setup network for namespace %v", idx, nsPath)
assert.NoError(t, err, "[%v] setup network interfaces for namespace in parallel %v", idx, nsPath)

ip := result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
t.Logf("[%v] ip is %v", idx, ip)

assert.NoError(t,
l.Remove(ctx, id, nsPath),
"[%v] teardown network for namespace %v", idx, nsPath,
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
)

// Setup network serially
result, err = l.SetupSerially(ctx, id, nsPath)
assert.NoError(t, err, "[%v] setup network interfaces for namespace serially%v", idx, nsPath)

ip = result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
t.Logf("[%v] ip is %v", idx, ip)

assert.NoError(t,
l.Remove(ctx, id, nsPath),
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
)
}
}
Expand Down