Skip to content

Commit 9acc0ad

Browse files
committed
Avoid a name conflict when tests are not running in containers
When tests are not running in containers, the tap names would conflict in a BuildKite host, where we run multiple tests in parallel. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent 85f626f commit 9acc0ad

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.buildkite/al2_test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ sudo -E PATH=$PATH \
1818
containerd_pid=$!
1919

2020
sudo $bin_path/firecracker-ctr --address $dir/containerd.sock content fetch docker.io/library/alpine:3.10.1
21-
sudo -E PATH=$bin_path:$PATH /usr/local/bin/go test -count=1 -run TestMultipleVMs_Isolated ./... -v
21+
22+
TAP_PREFIX=build$BUILDKITE_BUILD_NUMBER \
23+
sudo -E PATH=$bin_path:$PATH /usr/local/bin/go test -count=1 -run TestMultipleVMs_Isolated ./... -v
2224

2325
sudo kill $containerd_pid

runtime/service_integ_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ const (
7171
numberOfVmsEnvName = "NUMBER_OF_VMS"
7272
defaultNumberOfVms = 5
7373

74+
tapPrefixEnvName = "TAP_PREFIX"
75+
7476
defaultBalloonMemory = int64(66)
7577
defaultStatsPollingIntervals = int64(1)
7678

@@ -260,6 +262,8 @@ func TestMultipleVMs_Isolated(t *testing.T) {
260262
}
261263
t.Logf("TestMultipleVMs_Isolated: will run %d vm's", numberOfVms)
262264

265+
tapPrefix := os.Getenv(tapPrefixEnvName)
266+
263267
cases := []struct {
264268
MaxContainers int32
265269
JailerConfig *proto.JailerConfig
@@ -316,7 +320,7 @@ func TestMultipleVMs_Isolated(t *testing.T) {
316320
containerCount := c.MaxContainers
317321
jailerConfig := c.JailerConfig
318322

319-
tapName := fmt.Sprintf("tap%d", vmID)
323+
tapName := fmt.Sprintf("%stap%d", tapPrefix, vmID)
320324
err := createTapDevice(ctx, tapName)
321325
if err != nil {
322326
return err

0 commit comments

Comments
 (0)