mirror of https://github.com/docker/compose.git
E2E tests using compose CLI plugin
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
parent
1dc97e8c4b
commit
c7dc12d310
|
@ -34,6 +34,9 @@ GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
|
|||
BINARY?=bin/docker
|
||||
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
|
||||
|
||||
COMPOSE_BINARY?=bin/docker-compose
|
||||
COMPOSE_BINARY_WITH_EXTENSION=$(COMPOSE_BINARY)$(EXTENSION)
|
||||
|
||||
WORK_DIR:=$(shell mktemp -d)
|
||||
|
||||
TAGS:=
|
||||
|
@ -54,12 +57,12 @@ protos:
|
|||
protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
|
||||
|
||||
.PHONY: cli
|
||||
cli:
|
||||
cli: compose-plugin
|
||||
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(BINARY_WITH_EXTENSION) ./cli
|
||||
|
||||
.PHONY: compose-plugin
|
||||
compose-plugin:
|
||||
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o ./bin/docker-compose .
|
||||
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY_WITH_EXTENSION) ./compose_plugin
|
||||
|
||||
.PHONY: cross
|
||||
cross:
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -131,6 +132,15 @@ func TestLocalComposeUp(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestComposeUsingCliPlugin(t *testing.T) {
|
||||
c := NewParallelE2eCLI(t, binDir)
|
||||
|
||||
err := os.Remove(filepath.Join(c.ConfigDir, "cli-plugins", "docker-compose"))
|
||||
assert.NilError(t, err)
|
||||
res := c.RunDockerOrExitError("compose", "ls")
|
||||
res.Assert(t, icmd.Expected{Err: "'compose' is not a docker command", ExitCode: 1})
|
||||
}
|
||||
|
||||
func TestComposePull(t *testing.T) {
|
||||
c := NewParallelE2eCLI(t, binDir)
|
||||
|
||||
|
|
|
@ -86,8 +86,12 @@ func newE2eCLI(t *testing.T, binDir string) *E2eCLI {
|
|||
})
|
||||
|
||||
_ = os.MkdirAll(filepath.Join(d, "cli-plugins"), 0755)
|
||||
composePlugin, _ := findExecutable("docker-compose", []string{"../../bin", "../../../bin"})
|
||||
err = CopyFile(composePlugin, filepath.Join(d, "cli-plugins", "docker-compose"))
|
||||
composePluginFile := "docker-compose"
|
||||
if runtime.GOOS == "windows" {
|
||||
composePluginFile += ".exe"
|
||||
}
|
||||
composePlugin, _ := findExecutable(composePluginFile, []string{"../../bin", "../../../bin"})
|
||||
err = CopyFile(composePlugin, filepath.Join(d, "cli-plugins", composePluginFile))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue