Skip to content

Commit 42cfe0f

Browse files
committed
add in some serial setup tests; a little make cleanup
Signed-off-by: Mike Brown <[email protected]>
1 parent 8cb24f1 commit 42cfe0f

3 files changed

Lines changed: 31 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ jobs:
8989
9090
- run: |
9191
bash -x script/install-cni
92-
make clean V=1
93-
make bin/integration.test V=1
92+
sudo make clean V=1
9493
make test V=1
9594
sudo make integration V=1
9695
working-directory: src/github.com/containerd/go-cni

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ help: ## this help
3131
test: ## run tests, except integration tests and tests that require root
3232
$(Q)go test -v -race $(EXTRA_TESTFLAGS) -count=1 ./...
3333

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

37-
FORCE:
38-
39-
bin/integration.test: FORCE ## build integration test binary into bin
37+
bin/integration.test: ## build integration test binary into bin
4038
$(Q)cd ./integration && go test -race -c . -o ../bin/integration.test
4139

4240
clean: ## clean up binaries

integration/cni_setup_teardown_linux_test.go

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,26 @@ func TestBasicSetupAndRemove(t *testing.T) {
198198

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

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

206206
assert.NoError(t,
207207
l.Remove(ctx, id, nsPath),
208-
"[%v] teardown network for namespace %v", idx, nsPath,
208+
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
209+
)
210+
211+
// Setup network serially
212+
result, err = l.SetupSerially(ctx, id, nsPath)
213+
assert.NoError(t, err, "[%v] setup network interfaces for namespace serially%v", idx, nsPath)
214+
215+
ip = result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
216+
t.Logf("[%v] ip is %v", idx, ip)
217+
218+
assert.NoError(t,
219+
l.Remove(ctx, id, nsPath),
220+
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
209221
)
210222
}
211223
}
@@ -271,14 +283,26 @@ func TestBasicSetupAndRemovePluginWithoutVersion(t *testing.T) {
271283

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

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

279291
assert.NoError(t,
280292
l.Remove(ctx, id, nsPath),
281-
"[%v] teardown network for namespace %v", idx, nsPath,
293+
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
294+
)
295+
296+
// Setup network serially
297+
result, err = l.SetupSerially(ctx, id, nsPath)
298+
assert.NoError(t, err, "[%v] setup network interfaces for namespace serially%v", idx, nsPath)
299+
300+
ip = result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
301+
t.Logf("[%v] ip is %v", idx, ip)
302+
303+
assert.NoError(t,
304+
l.Remove(ctx, id, nsPath),
305+
"[%v] teardown network interfaces for namespace %v", idx, nsPath,
282306
)
283307
}
284308
}

0 commit comments

Comments
 (0)