mirror of
https://github.com/docker/compose.git
synced 2025-07-01 10:54:29 +02:00
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?=bin/docker
|
||||||
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
|
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
|
||||||
|
|
||||||
|
COMPOSE_BINARY?=bin/docker-compose
|
||||||
|
COMPOSE_BINARY_WITH_EXTENSION=$(COMPOSE_BINARY)$(EXTENSION)
|
||||||
|
|
||||||
WORK_DIR:=$(shell mktemp -d)
|
WORK_DIR:=$(shell mktemp -d)
|
||||||
|
|
||||||
TAGS:=
|
TAGS:=
|
||||||
@ -54,12 +57,12 @@ protos:
|
|||||||
protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
|
protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
|
||||||
|
|
||||||
.PHONY: cli
|
.PHONY: cli
|
||||||
cli:
|
cli: compose-plugin
|
||||||
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(BINARY_WITH_EXTENSION) ./cli
|
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(BINARY_WITH_EXTENSION) ./cli
|
||||||
|
|
||||||
.PHONY: compose-plugin
|
.PHONY: compose-plugin
|
||||||
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
|
.PHONY: cross
|
||||||
cross:
|
cross:
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"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) {
|
func TestComposePull(t *testing.T) {
|
||||||
c := NewParallelE2eCLI(t, binDir)
|
c := NewParallelE2eCLI(t, binDir)
|
||||||
|
|
||||||
|
@ -86,8 +86,12 @@ func newE2eCLI(t *testing.T, binDir string) *E2eCLI {
|
|||||||
})
|
})
|
||||||
|
|
||||||
_ = os.MkdirAll(filepath.Join(d, "cli-plugins"), 0755)
|
_ = os.MkdirAll(filepath.Join(d, "cli-plugins"), 0755)
|
||||||
composePlugin, _ := findExecutable("docker-compose", []string{"../../bin", "../../../bin"})
|
composePluginFile := "docker-compose"
|
||||||
err = CopyFile(composePlugin, filepath.Join(d, "cli-plugins", "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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user