Skip to content

Commit a171aa1

Browse files
committed
updated NewNaiveChrootStrategy invocation in jailer tests
Signed-off-by: Philipp Mieden <[email protected]>
1 parent addd36c commit a171aa1

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

example_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"os"
7-
"path/filepath"
87
"time"
98

109
log "github.com/sirupsen/logrus"
@@ -224,7 +223,6 @@ func ExampleJailerConfig_enablingJailer() {
224223

225224
const id = "my-jailer-test"
226225
const path = "/path/to/jailer-workspace"
227-
pathToWorkspace := filepath.Join(path, "firecracker", id)
228226
const kernelImagePath = "/path/to/kernel-image"
229227

230228
uid := 123
@@ -247,7 +245,7 @@ func ExampleJailerConfig_enablingJailer() {
247245
ID: id,
248246
NumaNode: firecracker.Int(0),
249247
ChrootBaseDir: path,
250-
ChrootStrategy: firecracker.NewNaiveChrootStrategy(pathToWorkspace, kernelImagePath),
248+
ChrootStrategy: firecracker.NewNaiveChrootStrategy(kernelImagePath),
251249
ExecFile: "/path/to/firecracker-binary",
252250
},
253251
}

jailer_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestJailerBuilder(t *testing.T) {
2222
UID: Int(123),
2323
GID: Int(100),
2424
NumaNode: Int(0),
25-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
25+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
2626
ExecFile: "/path/to/firecracker",
2727
},
2828
expectedArgs: []string{
@@ -53,7 +53,7 @@ func TestJailerBuilder(t *testing.T) {
5353
UID: Int(123),
5454
GID: Int(100),
5555
NumaNode: Int(0),
56-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
56+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
5757
ExecFile: "/path/to/firecracker",
5858
JailerBinary: "imprisoner",
5959
},
@@ -86,7 +86,7 @@ func TestJailerBuilder(t *testing.T) {
8686
UID: Int(123),
8787
GID: Int(100),
8888
NumaNode: Int(1),
89-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
89+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
9090
ExecFile: "/path/to/firecracker",
9191
ChrootBaseDir: "/tmp",
9292
JailerBinary: "/path/to/the/jailer",
@@ -166,7 +166,7 @@ func TestJail(t *testing.T) {
166166
UID: Int(123),
167167
GID: Int(100),
168168
NumaNode: Int(0),
169-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
169+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
170170
ExecFile: "/path/to/firecracker",
171171
},
172172
expectedArgs: []string{
@@ -202,7 +202,7 @@ func TestJail(t *testing.T) {
202202
UID: Int(123),
203203
GID: Int(100),
204204
NumaNode: Int(0),
205-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
205+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
206206
ExecFile: "/path/to/firecracker",
207207
JailerBinary: "imprisoner",
208208
},
@@ -240,7 +240,7 @@ func TestJail(t *testing.T) {
240240
UID: Int(123),
241241
GID: Int(100),
242242
NumaNode: Int(1),
243-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
243+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
244244
ExecFile: "/path/to/firecracker",
245245
ChrootBaseDir: "/tmp",
246246
JailerBinary: "/path/to/the/jailer",
@@ -283,7 +283,7 @@ func TestJail(t *testing.T) {
283283
UID: Int(123),
284284
GID: Int(100),
285285
NumaNode: Int(0),
286-
ChrootStrategy: NewNaiveChrootStrategy("path", "kernel-image-path"),
286+
ChrootStrategy: NewNaiveChrootStrategy("kernel-image-path"),
287287
ExecFile: "/path/to/firecracker",
288288
},
289289
expectedArgs: []string{

machine_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func TestJailerMicroVMExecution(t *testing.T) {
153153
// short names and directory to prevent SUN_LEN error
154154
id := "b"
155155
jailerTestPath := tmpDir
156-
jailerFullRootPath := filepath.Join(jailerTestPath, filepath.Base(getFirecrackerBinaryPath()), id)
157156
os.MkdirAll(jailerTestPath, 0777)
158157

159158
socketPath := "TestJailerMicroVMExecution.socket"
@@ -207,7 +206,7 @@ func TestJailerMicroVMExecution(t *testing.T) {
207206
ID: id,
208207
ChrootBaseDir: jailerTestPath,
209208
ExecFile: getFirecrackerBinaryPath(),
210-
ChrootStrategy: NewNaiveChrootStrategy(jailerFullRootPath, vmlinuxPath),
209+
ChrootStrategy: NewNaiveChrootStrategy(vmlinuxPath),
211210
Stdout: logFd,
212211
Stderr: logFd,
213212
},

0 commit comments

Comments
 (0)