Skip to content

Commit 0b622be

Browse files
authored
Merge pull request #545 from openSUSE/e2e-test-fix-2
Fix e2e tests by pinning CRI-O and conmon
2 parents 939d3c2 + c8301f2 commit 0b622be

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ jobs:
7373
name: crictl e2e
7474
os: linux
7575
script:
76-
# TODO: Re-enable the test when it is fixed.
77-
- exit 0
7876
- |
7977
sudo apt-get update &&\
8078
sudo apt-get install -y libseccomp-dev

test/framework/framework.go

+26-5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import (
3232
"github.com/sirupsen/logrus"
3333
)
3434

35+
const timeout = 10 * time.Minute
36+
3537
// TestFramework is used to support commonly used test features
3638
type TestFramework struct {
3739
crioDir string
@@ -128,20 +130,39 @@ func (t *TestFramework) CrictlExpectFailureWithEndpoint(
128130

129131
func SetupCrio() string {
130132
const (
131-
crioURL = "https://github.com/cri-o/cri-o"
132-
timeout = 10 * time.Minute
133+
// TODO: update to 1.16.0 once released
134+
crioURL = "https://github.com/cri-o/cri-o"
135+
crioVersion = "aabfe2eb73c92dc2378b36f0fc782033d9460fda"
136+
conmonURL = "https://github.com/containers/conmon"
137+
conmonVersion = "v2.0.1"
133138
)
134139
tmpDir := filepath.Join(os.TempDir(), "crio-tmp")
135140

136141
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
137142
logrus.Info("cloning and building CRI-O")
138-
lcmd("git clone --depth=1 %s %s", crioURL, tmpDir).Wait(timeout)
139-
cmd(tmpDir, "make").Wait(timeout)
143+
144+
Expect(checkoutAndBuild(tmpDir, crioURL, crioVersion)).To(BeNil())
145+
146+
conmonTmp := filepath.Join(tmpDir, "conmon")
147+
checkoutAndBuild(conmonTmp, conmonURL, conmonVersion)
140148
}
141149

142150
return tmpDir
143151
}
144152

153+
func checkoutAndBuild(dir, url, rev string) error {
154+
// A much faster approach than just cloning the whole repository
155+
if err := os.MkdirAll(dir, 0755); err != nil {
156+
return err
157+
}
158+
cmd(dir, "git init").Wait(timeout)
159+
cmd(dir, "git remote add origin %s", url).Wait(timeout)
160+
cmd(dir, "git fetch --depth=1 origin %s", rev).Wait(timeout)
161+
cmd(dir, "git checkout -f FETCH_HEAD").Wait(timeout)
162+
cmd(dir, "make").Wait(timeout)
163+
return nil
164+
}
165+
145166
// Start the container runtime process
146167
func (t *TestFramework) StartCrio() (string, string, *Session) {
147168
// Create a new sandbox directory
@@ -179,7 +200,7 @@ func (t *TestFramework) StartCrio() (string, string, *Session) {
179200
" --storage-driver=vfs",
180201
filepath.Join(tmpDir, "bin", "crio"),
181202
endpoint,
182-
filepath.Join(tmpDir, "bin", "conmon"),
203+
filepath.Join(t.crioDir, "conmon", "bin", "conmon"),
183204
filepath.Join(tmpDir, "exits"),
184205
filepath.Join(tmpDir, "attach"),
185206
filepath.Join(tmpDir, "log"),

0 commit comments

Comments
 (0)