Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: chmod busybox so test passes #531

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ jobs:
- name: Run CRI-O integration tests
run: |
CRIO_DIR=$(sudo go env GOPATH)/src/github.com/cri-o/cri-o
sudo -D "$CRIO_DIR" make all test-binaries
sudo make -C "$CRIO_DIR" all test-binaries
# skip seccomp tests because they have permission denied issues in a container and accept signed image as they don't use conmon
sudo -D "$CRIO_DIR" -E $(CRIO_DIR)/test/test_runner.sh $(ls $(CRIO_DIR)/test/ | grep bats | grep -E -v seccomp\|image\|policy)
sudo rm -f "$CRIO_DIR"/test/seccomp*.bats "$CRIO_DIR"/test/image.bats "$CRIO_DIR"/test/policy.bats
sudo sh -c "cd $CRIO_DIR; ./test/test_runner.sh"
env:
JOBS: '2'
14 changes: 13 additions & 1 deletion hack/github-actions-setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -euo pipefail

declare -A VERSIONS=(
["cni-plugins"]=v1.3.0
["runc"]=v1.1.7
["runc"]=v1.1.14
["crun"]=1.17
["bats"]=v1.9.0
)

Expand All @@ -16,6 +17,7 @@ main() {
install_bats
install_critools
install_runc
install_crun
install_cni_plugins
install_testdeps
setup_etc_subid
Expand Down Expand Up @@ -118,6 +120,16 @@ install_runc() {
runc --version
}

install_crun() {
URL=https://github.com/containers/crun/releases/download/"${VERSIONS["crun"]}"/crun-"${VERSIONS["crun"]}"-linux-amd64

BINARY=/usr/bin/crun
sudo wget -O "$BINARY" "$URL"
sudo chmod +x "$BINARY"

crun --version
}
Comment on lines +123 to +131
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: tabs vs spaces 😄


install_testdeps() {
CLONE_PATH=$(go env GOPATH)/src/github.com/cri-o
mkdir -p "$CLONE_PATH"
Expand Down
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
Loading