Skip to content

Fix e2e tests by pinning CRI-O and conmon #545

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

Merged
merged 1 commit into from
Oct 2, 2019
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
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ jobs:
name: crictl e2e
os: linux
script:
# TODO: Re-enable the test when it is fixed.
- exit 0
- |
sudo apt-get update &&\
sudo apt-get install -y libseccomp-dev
Expand Down
31 changes: 26 additions & 5 deletions test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
"github.com/sirupsen/logrus"
)

const timeout = 10 * time.Minute

// TestFramework is used to support commonly used test features
type TestFramework struct {
crioDir string
Expand Down Expand Up @@ -128,20 +130,39 @@ func (t *TestFramework) CrictlExpectFailureWithEndpoint(

func SetupCrio() string {
const (
crioURL = "https://github.com/cri-o/cri-o"
timeout = 10 * time.Minute
// TODO: update to 1.16.0 once released
crioURL = "https://github.com/cri-o/cri-o"
crioVersion = "aabfe2eb73c92dc2378b36f0fc782033d9460fda"
conmonURL = "https://github.com/containers/conmon"
conmonVersion = "v2.0.1"
)
tmpDir := filepath.Join(os.TempDir(), "crio-tmp")

if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
logrus.Info("cloning and building CRI-O")
lcmd("git clone --depth=1 %s %s", crioURL, tmpDir).Wait(timeout)
cmd(tmpDir, "make").Wait(timeout)

Expect(checkoutAndBuild(tmpDir, crioURL, crioVersion)).To(BeNil())

conmonTmp := filepath.Join(tmpDir, "conmon")
checkoutAndBuild(conmonTmp, conmonURL, conmonVersion)
}

return tmpDir
}

func checkoutAndBuild(dir, url, rev string) error {
// A much faster approach than just cloning the whole repository
if err := os.MkdirAll(dir, 0755); err != nil {
return err
}
cmd(dir, "git init").Wait(timeout)
cmd(dir, "git remote add origin %s", url).Wait(timeout)
cmd(dir, "git fetch --depth=1 origin %s", rev).Wait(timeout)
cmd(dir, "git checkout -f FETCH_HEAD").Wait(timeout)
cmd(dir, "make").Wait(timeout)
return nil
}

// Start the container runtime process
func (t *TestFramework) StartCrio() (string, string, *Session) {
// Create a new sandbox directory
Expand Down Expand Up @@ -179,7 +200,7 @@ func (t *TestFramework) StartCrio() (string, string, *Session) {
" --storage-driver=vfs",
filepath.Join(tmpDir, "bin", "crio"),
endpoint,
filepath.Join(tmpDir, "bin", "conmon"),
filepath.Join(t.crioDir, "conmon", "bin", "conmon"),
filepath.Join(tmpDir, "exits"),
filepath.Join(tmpDir, "attach"),
filepath.Join(tmpDir, "log"),
Expand Down