mirror of
https://github.com/moby/buildkit.git
synced 2026-11-06 05:16:45 +00:00
Merge pull request #4105 from jedevc/add-has-feature-compat
This commit is contained in:
2 files changed
+14
-1
No files matched your search
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/google/shlex"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const buildkitdConfigFile = "buildkitd.toml"
|
||||
@@ -156,6 +157,13 @@ func FormatLogs(m map[string]*bytes.Buffer) string {
|
||||
}
|
||||
|
||||
func CheckFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string) {
|
||||
t.Helper()
|
||||
if err := HasFeatureCompat(t, sb, features, reason...); err != nil {
|
||||
t.Skipf(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func HasFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string) error {
|
||||
t.Helper()
|
||||
if len(reason) == 0 {
|
||||
t.Fatal("no reason provided")
|
||||
@@ -172,6 +180,7 @@ func CheckFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{},
|
||||
}
|
||||
}
|
||||
if len(ereasons) > 0 {
|
||||
t.Skipf("%s worker can not currently run this test due to missing features (%s)", sb.Name(), strings.Join(ereasons, ", "))
|
||||
return errors.Errorf("%s worker can not currently run this test due to missing features (%s)", sb.Name(), strings.Join(ereasons, ", "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -61,3 +61,7 @@ var features = map[string]struct{}{
|
||||
func CheckFeatureCompat(t *testing.T, sb integration.Sandbox, reason ...string) {
|
||||
integration.CheckFeatureCompat(t, sb, features, reason...)
|
||||
}
|
||||
|
||||
func HasFeatureCompat(t *testing.T, sb integration.Sandbox, reason ...string) error {
|
||||
return integration.HasFeatureCompat(t, sb, features, reason...)
|
||||
}
|
||||
Reference in new issue
Block a user