Skip to content

Commit

Permalink
runner: fix runtime test
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
haircommander committed Oct 1, 2024
1 parent 900afa1 commit 31b0bb6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions runner/conmon_test/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"time"

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

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

Expect(os.Link(busyboxDest, filepath.Join(tmpRootfs, "busybox"))).To(BeNil())
busyboxPath := filepath.Join(tmpRootfs, "busybox")
Expect(os.Link(busyboxDest, busyboxPath)).To(BeNil())
Expect(os.Chmod(busyboxPath, 0777)).To(BeNil())

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

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

Expect(getFileContents(tmpLogPath)).To(ContainSubstring("busybox"))
Expect(getFileContents(tmpPidFile)).To(Not(BeEmpty()))
Expand All @@ -89,7 +94,7 @@ func generateRuntimeConfig(bundlePath, rootfs string) (string, error) {
return "", err
}
g.SetProcessCwd("/")
g.SetProcessArgs([]string{"/busybox", "ls"})
g.SetProcessArgs([]string{"/busybox", "echo", "busybox"})
g.SetRootPath(rootfs)

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

0 comments on commit 31b0bb6

Please sign in to comment.