Skip to content

Commit

Permalink
Skip tests failures due to use of containerd 1.3 API
Browse files Browse the repository at this point in the history
Per moby#1314 (comment)
BuildKit should still function with containerd 1.2 daemons that do not
have this API, but less efficiently.

However, a couple of hundred tests fail on CI when they hit this, so
just skip them for now.

Signed-off-by: Paul "TBBle" Hampson <[email protected]>
  • Loading branch information
TBBle committed Mar 1, 2020
1 parent e303b92 commit f08be7f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
11 changes: 10 additions & 1 deletion util/testutil/integration/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os/exec"
"path/filepath"
"reflect"
"regexp"
"runtime"
"sort"
"strings"
Expand Down Expand Up @@ -37,6 +38,7 @@ type Sandbox interface {

Cmd(...string) *exec.Cmd
PrintLogs(*testing.T)
MatchLogs(*regexp.Regexp) bool
NewRegistry() (string, error)
Value(string) interface{} // chosen matrix value
}
Expand Down Expand Up @@ -137,6 +139,9 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
list = []Worker{list[rand.Intn(len(list))]}
}

containerd1_2ExpectedFailureRegexp := regexp.MustCompile(` unknown method AddResource for service containerd\.services\.leases\.v1\.Leases: not implemented$`)
containerd1_2ExpectedFailureMessage := "containerd 1.2 does not support service containerd.services.leases.v1.Leases method AddResource"

for _, br := range list {
for _, tc := range testCases {
for _, mv := range matrix {
Expand All @@ -158,7 +163,11 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
defer func() {
assert.NoError(t, closer())
if t.Failed() {
sb.PrintLogs(t)
if sb.MatchLogs(containerd1_2ExpectedFailureRegexp) {
t.Skip(containerd1_2ExpectedFailureMessage)
} else {
sb.PrintLogs(t)
}
}
}()
tc(t, sb)
Expand Down
17 changes: 17 additions & 0 deletions util/testutil/integration/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"syscall"
Expand Down Expand Up @@ -46,6 +47,10 @@ func (sb *sandbox) PrintLogs(t *testing.T) {
printLogs(sb.logs, t.Log)
}

func (sb *sandbox) MatchLogs(matchRegexp *regexp.Regexp) bool {
return matchLogs(sb.logs, matchRegexp)
}

func (sb *sandbox) NewRegistry() (string, error) {
url, cl, err := NewRegistry("")
if err != nil {
Expand Down Expand Up @@ -212,3 +217,15 @@ func printLogs(logs map[string]*bytes.Buffer, f func(args ...interface{})) {
}
}
}

func matchLogs(logs map[string]*bytes.Buffer, matchRegexp *regexp.Regexp) bool {
for _, l := range logs {
s := bufio.NewScanner(l)
for s.Scan() {
if matchRegexp.MatchString(s.Text()) {
return true
}
}
}
return false
}

0 comments on commit f08be7f

Please sign in to comment.