Skip to content

Commit 7e9026a

Browse files
authored
Merge pull request firecracker-microvm#513 from kzys/test-fixes
Test fixes
2 parents 361b8ff + 0fe32bf commit 7e9026a

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

runtime/service_integ_test.go

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,9 +1849,11 @@ func TestOOM_Isolated(t *testing.T) {
18491849
containerd.WithSnapshotter(defaultSnapshotterName),
18501850
containerd.WithNewSnapshot("snapshot-"+vmID, image),
18511851
containerd.WithNewSpec(
1852-
oci.WithProcessArgs("/bin/dd", "if=/dev/zero", "ibs=10M"),
1853-
firecrackeroci.WithVMID(vmID),
1852+
// The container is having 2MB of memory.
18541853
oci.WithMemoryLimit(2*1024*1024),
1854+
// But the dd command allocates 10MB of data on memory, which will be OOM killed.
1855+
oci.WithProcessArgs("/bin/dd", "if=/dev/zero", "ibs=10M", "of=/dev/null"),
1856+
firecrackeroci.WithVMID(vmID),
18551857
),
18561858
)
18571859
require.NoError(t, err)
@@ -2057,29 +2059,25 @@ func TestPauseResume_Isolated(t *testing.T) {
20572059
fcClient := fccontrol.NewFirecrackerClient(pluginClient.Client())
20582060

20592061
subtests := []struct {
2060-
name string
2061-
request *proto.CreateVMRequest
2062-
state func(ctx context.Context, resp *proto.CreateVMResponse)
2062+
name string
2063+
state func(ctx context.Context, resp *proto.CreateVMResponse)
20632064
}{
20642065
{
2065-
name: "PauseVM",
2066-
request: &proto.CreateVMRequest{},
2066+
name: "PauseVM",
20672067
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
20682068
_, err := fcClient.PauseVM(ctx, &proto.PauseVMRequest{VMID: resp.VMID})
20692069
require.NoError(t, err)
20702070
},
20712071
},
20722072
{
2073-
name: "ResumeVM",
2074-
request: &proto.CreateVMRequest{},
2073+
name: "ResumeVM",
20752074
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
20762075
_, err := fcClient.ResumeVM(ctx, &proto.ResumeVMRequest{VMID: resp.VMID})
20772076
require.NoError(t, err)
20782077
},
20792078
},
20802079
{
2081-
name: "Consecutive PauseVM",
2082-
request: &proto.CreateVMRequest{},
2080+
name: "Consecutive PauseVM",
20832081
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
20842082
_, err := fcClient.PauseVM(ctx, &proto.PauseVMRequest{VMID: resp.VMID})
20852083
require.NoError(t, err)
@@ -2089,8 +2087,7 @@ func TestPauseResume_Isolated(t *testing.T) {
20892087
},
20902088
},
20912089
{
2092-
name: "Consecutive ResumeVM",
2093-
request: &proto.CreateVMRequest{},
2090+
name: "Consecutive ResumeVM",
20942091
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
20952092
_, err := fcClient.ResumeVM(ctx, &proto.ResumeVMRequest{VMID: resp.VMID})
20962093
require.NoError(t, err)
@@ -2100,8 +2097,7 @@ func TestPauseResume_Isolated(t *testing.T) {
21002097
},
21012098
},
21022099
{
2103-
name: "PauseResume",
2104-
request: &proto.CreateVMRequest{},
2100+
name: "PauseResume",
21052101
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
21062102
_, err := fcClient.PauseVM(ctx, &proto.PauseVMRequest{VMID: resp.VMID})
21072103
require.NoError(t, err)
@@ -2111,8 +2107,7 @@ func TestPauseResume_Isolated(t *testing.T) {
21112107
},
21122108
},
21132109
{
2114-
name: "ResumePause",
2115-
request: &proto.CreateVMRequest{},
2110+
name: "ResumePause",
21162111
state: func(ctx context.Context, resp *proto.CreateVMResponse) {
21172112
_, err := fcClient.ResumeVM(ctx, &proto.ResumeVMRequest{VMID: resp.VMID})
21182113
require.NoError(t, err)
@@ -2164,18 +2159,14 @@ func TestPauseResume_Isolated(t *testing.T) {
21642159

21652160
for _, subtest := range subtests {
21662161
state := subtest.state
2167-
request := subtest.request
21682162
t.Run(subtest.name, func(t *testing.T) {
2169-
runTest(t, request, state)
2163+
t.Parallel()
2164+
runTest(t, &proto.CreateVMRequest{}, state)
21702165
})
21712166

2172-
requestWithJailer := subtest.request
2173-
requestWithJailer.JailerConfig = &proto.JailerConfig{
2174-
UID: 30000,
2175-
GID: 30000,
2176-
}
21772167
t.Run(subtest.name+"/Jailer", func(t *testing.T) {
2178-
runTest(t, requestWithJailer, state)
2168+
t.Parallel()
2169+
runTest(t, &proto.CreateVMRequest{JailerConfig: &proto.JailerConfig{UID: 30000, GID: 30000}}, state)
21792170
})
21802171
}
21812172
}

tools/thinpool.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ else
8383

8484
pool_create() {
8585
echo sudo lvcreate --type thin-pool \
86-
--poolmetadatasize 16GiB \
87-
--size 1G \
86+
--poolmetadatasize 16MiB \
87+
--size 1GiB \
8888
-n "$name" "$FICD_DM_VOLUME_GROUP"
8989
sudo lvcreate --type thin-pool \
90-
--poolmetadatasize 16GiB \
91-
--size 1G \
90+
--poolmetadatasize 16MiB \
91+
--size 1GiB \
9292
-n "$name" "$FICD_DM_VOLUME_GROUP"
9393
}
9494

0 commit comments

Comments
 (0)