Skip to content

Commit 59b266c

Browse files
committedOct 2, 2024
runner: fix runtime test
Signed-off-by: Peter Hunt <pehunt@redhat.com>
1 parent 900afa1 commit 59b266c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎runner/conmon_test/runtime_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io/ioutil"
66
"os"
77
"path/filepath"
8+
"time"
89

910
"github.com/containers/conmon/runner/conmon"
1011
"github.com/containers/storage/pkg/stringid"
@@ -41,7 +42,9 @@ var _ = Describe("runc", func() {
4142

4243
tmpPidFile = filepath.Join(tmpDir, "pidfile")
4344

44-
Expect(os.Link(busyboxDest, filepath.Join(tmpRootfs, "busybox"))).To(BeNil())
45+
busyboxPath := filepath.Join(tmpRootfs, "busybox")
46+
Expect(os.Link(busyboxDest, busyboxPath)).To(BeNil())
47+
Expect(os.Chmod(busyboxPath, 0777)).To(BeNil())
4548

4649
// finally, create config.json
4750
_, err = generateRuntimeConfig(tmpDir, tmpRootfs)
@@ -70,6 +73,8 @@ var _ = Describe("runc", func() {
7073
Expect(stderr).To(BeEmpty())
7174

7275
Expect(runRuntimeCommand("start", ctrID)).To(BeNil())
76+
// Make sure we write the file before checking if it was written
77+
time.Sleep(100 * time.Millisecond)
7378

7479
Expect(getFileContents(tmpLogPath)).To(ContainSubstring("busybox"))
7580
Expect(getFileContents(tmpPidFile)).To(Not(BeEmpty()))
@@ -89,7 +94,7 @@ func generateRuntimeConfig(bundlePath, rootfs string) (string, error) {
8994
return "", err
9095
}
9196
g.SetProcessCwd("/")
92-
g.SetProcessArgs([]string{"/busybox", "ls"})
97+
g.SetProcessArgs([]string{"/busybox", "echo", "busybox"})
9398
g.SetRootPath(rootfs)
9499

95100
if err := g.SaveToFile(configPath, generate.ExportOptions{}); err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.