Skip to content

Commit 0dabb22

Browse files
authored
Merge pull request #386 from kzys/loopback-thinpool
Make integration tests work with loopback devices
2 parents 0dd32fc + 290eaf2 commit 0dabb22

File tree

13 files changed

+103
-82
lines changed

13 files changed

+103
-82
lines changed

.buildkite/al2_pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ steps:
2121
env:
2222
DOCKER_IMAGE_TAG: "$BUILDKITE_BUILD_NUMBER"
2323
EXTRAGOARGS: "-race"
24+
FICD_DM_VOLUME_GROUP: "fcci-vg"
2425
command:
2526
- ./.buildkite/setup_al2.sh
2627
- docker run --rm -v $PWD:/mnt debian:stretch-slim rm -rf /mnt/tools/image-builder/rootfs

.buildkite/al2_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ source ./.buildkite/al2env.sh
66
export PATH=$bin_path:$PATH
77
export FIRECRACKER_CONTAINERD_RUNTIME_CONFIG_PATH=$runtime_config_path
88
export ENABLE_ISOLATED_TESTS=true
9-
export CONTAINERD_SOCKET=$dir/containerd.sock
9+
export CONTAINERD_SOCKET=$dir/containerd.sock
10+
1011
export SHIM_BASE_DIR=$dir
1112

1213
sudo -E PATH=$PATH $bin_path/firecracker-containerd --config $dir/config.toml &

.buildkite/pipeline.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,25 @@ steps:
9898
DOCKER_IMAGE_TAG: "$BUILDKITE_BUILD_NUMBER"
9999
NUMBER_OF_VMS: 100
100100
EXTRAGOARGS: "-v -count=1 -race"
101+
FICD_DM_VOLUME_GROUP: fcci-vg
101102
artifact_paths:
102103
- "runtime/logs/*"
103104
command:
104-
- make -C runtime integ-test FICD_SNAPSHOTTER=devmapper FICD_DM_POOL=build_${BUILDKITE_BUILD_NUMBER}_runtime
105+
- make -C runtime integ-test FICD_DM_POOL=build_${BUILDKITE_BUILD_NUMBER}_runtime
105106
timeout_in_minutes: 15
106107

107-
- label: ":rotating_light: :exclamation: example tests (devmapper)"
108+
- label: ":rotating_light: :exclamation: example tests"
108109
agents:
109110
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}"
110111
distro: "${BUILDKITE_AGENT_META_DATA_DISTRO}"
111112
hostname: "${BUILDKITE_AGENT_META_DATA_HOSTNAME}"
112113
env:
113114
DOCKER_IMAGE_TAG: "$BUILDKITE_BUILD_NUMBER"
114115
EXTRAGOARGS: "-v -count=1"
116+
FICD_DM_VOLUME_GROUP: fcci-vg
115117
artifact_paths:
116118
- "examples/logs/*"
117119
command:
118-
- make -C examples integ-test TEST_SS=devmapper TEST_POOL=build_${BUILDKITE_BUILD_NUMBER}_example
120+
- make -C examples integ-test TEST_POOL=build_${BUILDKITE_BUILD_NUMBER}_example
119121
timeout_in_minutes: 10
120122

examples/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ integ-test:
4141
--volume $(CURDIR)/etc/containerd/firecracker-runtime.json:/etc/containerd/firecracker-runtime.json \
4242
--volume $(CURDIR)/logs:/var/log/firecracker-containerd-test \
4343
--volume $(CURDIR)/..:/src \
44-
--env FICD_SNAPSHOTTER=$(TEST_SS) \
44+
--env FICD_DM_VOLUME_GROUP=$(FICD_DM_VOLUME_GROUP) \
4545
--env FICD_DM_POOL=$(TEST_POOL) \
4646
--env EXTRAGOARGS="${EXTRAGOARGS}" \
4747
--workdir="/src/examples" \
4848
$(FIRECRACKER_CONTAINERD_TEST_IMAGE):${DOCKER_IMAGE_TAG} \
49-
"make examples && make testtap && sleep 3 && ./taskworkflow -ip $(TEST_IP)$(TEST_SUBNET) -gw $(TEST_GATEWAY) -ss $(TEST_SS)"
49+
"make examples && make testtap && sleep 3 && ./taskworkflow -ip $(TEST_IP)$(TEST_SUBNET) -gw $(TEST_GATEWAY) -ss devmapper"
5050

5151
TEST_GATEWAY?=172.16.0.1
5252
TEST_IP?=172.16.0.2
5353
TEST_SUBNET?=/24
54-
TEST_SS?=devmapper
54+
FICD_DM_VOLUME_GROUP?=
5555
TEST_POOL?=
5656
testtap:
5757
ip link add br0 type bridge

runtime/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ integ-test-%: logs
6262
--volume $(CURDIR)/..:/src \
6363
--volume $(GO_CACHE_VOLUME_NAME):/go \
6464
--env ENABLE_ISOLATED_TESTS=1 \
65-
--env FICD_SNAPSHOTTER=$(FICD_SNAPSHOTTER) \
65+
--env FICD_DM_VOLUME_GROUP=$(FICD_DM_VOLUME_GROUP) \
6666
--env FICD_DM_POOL=$(FICD_DM_POOL) \
6767
--env GOPROXY=direct \
6868
--env GOSUMDB=off \
@@ -81,7 +81,7 @@ PERF_RUNTIME_SECONDS?=600
8181
PERF_VM_MEMSIZE_MB?=1024
8282
PERF_TARGET_BANDWIDTH?=1G
8383

84-
FICD_SNAPSHOTTER?=devmapper
84+
FICD_DM_VOLUME_GROUP?=
8585
FICD_DM_POOL?=
8686

8787
tc-redirect-tap-perf:
@@ -109,7 +109,7 @@ perf-test:
109109
--env PERF_RUNTIME_SECONDS=$(PERF_RUNTIME_SECONDS) \
110110
--env PERF_VM_MEMSIZE_MB=$(PERF_VM_MEMSIZE_MB) \
111111
--env PERF_TARGET_BANDWIDTH=$(PERF_TARGET_BANDWIDTH) \
112-
--env FICD_SNAPSHOTTER=$(FICD_SNAPSHOTTER) \
112+
--env FICD_DM_VOLUME_GROUP=$(FICD_DM_VOLUME_GROUP) \
113113
--env FICD_DM_POOL=$(FICD_DM_POOL) \
114114
--env GOPROXY=direct \
115115
--env GOSUMDB=off \

runtime/cni_integ_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestCNISupport_Isolated(t *testing.T) {
5353
pluginClient, err := ttrpcutil.NewClient(containerdSockPath + ".ttrpc")
5454
require.NoError(t, err, "failed to create ttrpc client")
5555

56-
image, err := alpineImage(ctx, client, defaultSnapshotterName())
56+
image, err := alpineImage(ctx, client, defaultSnapshotterName)
5757
require.NoError(t, err, "failed to get alpine image")
5858

5959
numVMs := 5
@@ -127,7 +127,7 @@ func TestCNISupport_Isolated(t *testing.T) {
127127

128128
newContainer, err := client.NewContainer(ctx,
129129
containerName,
130-
containerd.WithSnapshotter(defaultSnapshotterName()),
130+
containerd.WithSnapshotter(defaultSnapshotterName),
131131
containerd.WithNewSnapshot(snapshotName, image),
132132
containerd.WithNewSpec(
133133
oci.WithProcessArgs("/usr/bin/wget",
@@ -160,7 +160,7 @@ func TestAutomaticCNISupport_Isolated(t *testing.T) {
160160
require.NoError(t, err, "unable to create client to containerd service at %s, is containerd running?", containerdSockPath)
161161
defer client.Close()
162162

163-
image, err := alpineImage(ctx, client, defaultSnapshotterName())
163+
image, err := alpineImage(ctx, client, defaultSnapshotterName)
164164
require.NoError(t, err, "failed to get alpine image")
165165

166166
numVMs := 5
@@ -194,7 +194,7 @@ func TestAutomaticCNISupport_Isolated(t *testing.T) {
194194

195195
newContainer, err := client.NewContainer(ctx,
196196
taskID,
197-
containerd.WithSnapshotter(defaultSnapshotterName()),
197+
containerd.WithSnapshotter(defaultSnapshotterName),
198198
containerd.WithNewSnapshot(snapshotName, image),
199199
containerd.WithNewSpec(
200200
oci.WithProcessArgs("/usr/bin/wget",
@@ -237,7 +237,7 @@ func TestCNIPlugin_Performance(t *testing.T) {
237237

238238
fcClient := fccontrol.NewFirecrackerClient(pluginClient.Client())
239239

240-
image, err := iperf3Image(ctx, client, defaultSnapshotterName())
240+
image, err := iperf3Image(ctx, client, defaultSnapshotterName)
241241
require.NoError(t, err, "failed to get iperf3 image")
242242

243243
cniNetworkName := "fcnet"
@@ -296,7 +296,7 @@ func TestCNIPlugin_Performance(t *testing.T) {
296296

297297
newContainer, err := client.NewContainer(ctx,
298298
containerName,
299-
containerd.WithSnapshotter(defaultSnapshotterName()),
299+
containerd.WithSnapshotter(defaultSnapshotterName),
300300
containerd.WithNewSnapshot(snapshotName, image),
301301
containerd.WithNewSpec(
302302
oci.WithProcessArgs("/usr/bin/iperf3",

runtime/integ_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,8 @@ func shimBaseDir() string {
5555
return defaultShimBaseDir
5656
}
5757

58-
func defaultSnapshotterName() string {
59-
if name := os.Getenv("FICD_SNAPSHOTTER"); name != "" {
60-
return name
61-
}
62-
63-
return "devmapper"
64-
}
58+
// devmapper is the only snapshotter we can use with Firecracker
59+
const defaultSnapshotterName = "devmapper"
6560

6661
func prepareIntegTest(t *testing.T, options ...func(*config.Config)) {
6762
t.Helper()

runtime/jailer_integ_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func testJailer(t *testing.T, jailerConfig *proto.JailerConfig) {
5252

5353
ctx := namespaces.WithNamespace(context.Background(), "default")
5454

55-
image, err := alpineImage(ctx, client, defaultSnapshotterName())
55+
image, err := alpineImage(ctx, client, defaultSnapshotterName)
5656
require.NoError(err, "failed to get alpine image")
5757

5858
pluginClient, err := ttrpcutil.NewClient(containerdSockPath + ".ttrpc")
@@ -69,7 +69,7 @@ func testJailer(t *testing.T, jailerConfig *proto.JailerConfig) {
6969

7070
c, err := client.NewContainer(ctx,
7171
"container",
72-
containerd.WithSnapshotter(defaultSnapshotterName()),
72+
containerd.WithSnapshotter(defaultSnapshotterName),
7373
containerd.WithNewSnapshot("snapshot", image),
7474
containerd.WithNewSpec(oci.WithProcessArgs("/bin/echo", "-n", "hello"), firecrackeroci.WithVMID(vmID)),
7575
)

runtime/limits_integ_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestDiskLimit_Isolated(t *testing.T) {
3535
require.NoError(err, "unable to create client to containerd service at %s, is containerd running?", containerdSockPath)
3636
defer client.Close()
3737

38-
image, err := alpineImage(ctx, client, defaultSnapshotterName())
38+
image, err := alpineImage(ctx, client, defaultSnapshotterName)
3939
require.NoError(err, "failed to get alpine image")
4040

4141
// Right now, both naive snapshotter and devmapper snapshotter are configured to have 1024MB image size.
@@ -47,7 +47,7 @@ func TestDiskLimit_Isolated(t *testing.T) {
4747

4848
container, err := client.NewContainer(ctx,
4949
"container",
50-
containerd.WithSnapshotter(defaultSnapshotterName()),
50+
containerd.WithSnapshotter(defaultSnapshotterName),
5151
containerd.WithNewSnapshot("snapshot", image),
5252
sh,
5353
)

0 commit comments

Comments
 (0)