Merge pull request #902 from tonistiigi/itegration-update

integration: generalize pkg
docker-19.03
Tibor Vass 2019-03-26 16:35:12 -07:00 committed by GitHub
commit fe0b8a4ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 10 deletions

View File

@ -16,6 +16,11 @@ import (
"github.com/stretchr/testify/require"
)
func init() {
integration.InitOCIWorker()
integration.InitContainerdWorker()
}
func TestClientGatewayIntegration(t *testing.T) {
integration.Run(t, []integration.Test{
testClientGatewaySolve,

View File

@ -44,6 +44,11 @@ import (
"golang.org/x/sync/errgroup"
)
func init() {
integration.InitOCIWorker()
integration.InitContainerdWorker()
}
type nopWriteCloser struct {
io.Writer
}

View File

@ -7,6 +7,11 @@ import (
"github.com/stretchr/testify/require"
)
func init() {
integration.InitOCIWorker()
integration.InitContainerdWorker()
}
func TestCLIIntegration(t *testing.T) {
integration.Run(t, []integration.Test{
testDiskUsage,

View File

@ -39,6 +39,11 @@ import (
"github.com/stretchr/testify/require"
)
func init() {
integration.InitOCIWorker()
integration.InitContainerdWorker()
}
var allTests = []integration.Test{
testCmdShell,
testGlobalArg,

View File

@ -23,6 +23,11 @@ var (
errFailed = errors.New("test failed")
)
func init() {
integration.InitOCIWorker()
integration.InitContainerdWorker()
}
func TestFrontendIntegration(t *testing.T) {
integration.Run(t, []integration.Test{
testRefReadFile,

View File

@ -13,8 +13,8 @@ import (
"github.com/pkg/errors"
)
func init() {
register(&containerd{
func InitContainerdWorker() {
Register(&containerd{
name: "containerd",
containerd: "containerd",
containerdShim: "containerd-shim",
@ -29,7 +29,7 @@ func init() {
panic(errors.Errorf("unexpected BUILDKIT_INTEGRATION_CONTAINERD_EXTRA: %q", s))
}
name, bin := pair[0], pair[1]
register(&containerd{
Register(&containerd{
name: name,
containerd: filepath.Join(bin, "containerd"),
containerdShim: filepath.Join(bin, "containerd-shim"),

View File

@ -18,8 +18,8 @@ import (
"github.com/sirupsen/logrus"
)
func init() {
register(&oci{})
func InitOCIWorker() {
Register(&oci{})
// the rootless uid is defined in hack/dockerfiles/test.Dockerfile
if s := os.Getenv("BUILDKIT_INTEGRATION_ROOTLESS_IDPAIR"); s != "" {
@ -28,7 +28,7 @@ func init() {
logrus.Fatalf("unexpected BUILDKIT_INTEGRATION_ROOTLESS_IDPAIR: %q", s)
}
if rootlessSupported(uid) {
register(&oci{uid: uid, gid: gid})
Register(&oci{uid: uid, gid: gid})
}
}
@ -117,7 +117,7 @@ func (sb *sandbox) PrintLogs(t *testing.T) {
}
func (sb *sandbox) NewRegistry() (string, error) {
url, cl, err := newRegistry("")
url, cl, err := NewRegistry("")
if err != nil {
return "", err
}

View File

@ -15,7 +15,7 @@ import (
"github.com/pkg/errors"
)
func newRegistry(dir string) (url string, cl func() error, err error) {
func NewRegistry(dir string) (url string, cl func() error, err error) {
if err := lookupBinary("registry"); err != nil {
return "", nil, err
}

View File

@ -44,6 +44,14 @@ type SandboxConf struct {
mv matrixValue
}
func (sc *SandboxConf) Mirror() string {
return sc.mirror
}
func (sc *SandboxConf) Value(k string) interface{} {
return sc.mv.values[k].value
}
type SandboxOpt func(*SandboxConf)
func WithMirror(h string) SandboxOpt {
@ -62,7 +70,7 @@ type Test func(*testing.T, Sandbox)
var defaultWorkers []Worker
func register(w Worker) {
func Register(w Worker) {
defaultWorkers = append(defaultWorkers, w)
}
@ -267,7 +275,7 @@ func runMirror(t *testing.T, mirroredImages map[string]string) (host string, _ f
}
}
mirror, cleanup, err := newRegistry(mirrorDir)
mirror, cleanup, err := NewRegistry(mirrorDir)
if err != nil {
return "", nil, err
}