From 6859413a5d3211859011ef1570203cb034484007 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Tue, 19 Jan 2021 15:34:54 +0100 Subject: [PATCH] Moving last things from /tests, removing dead code Signed-off-by: Guillaume Tardif --- aci/e2e/e2e-aci_test.go | 2 +- ecs/e2e/ecs-local/context_test.go | 2 +- ecs/e2e/ecs/e2e-ecs_test.go | 2 +- local/e2e/cli-only/e2e_test.go | 2 +- .../e2e/cli-only}/mockmetrics.go | 2 +- local/e2e/compose/compose_test.go | 2 +- local/e2e/compose/logs_test.go | 2 +- local/e2e/container/container_test.go | 2 +- local/e2e/container/skip_win_ci_test.go | 2 +- tests/composefiles/nginx.yaml | 5 --- tests/framework/unit.go | 42 ------------------- .../e2e.go => utils/e2e/framework.go | 3 +- 12 files changed, 11 insertions(+), 57 deletions(-) rename {tests/framework => local/e2e/cli-only}/mockmetrics.go (99%) delete mode 100644 tests/composefiles/nginx.yaml delete mode 100644 tests/framework/unit.go rename tests/framework/e2e.go => utils/e2e/framework.go (99%) diff --git a/aci/e2e/e2e-aci_test.go b/aci/e2e/e2e-aci_test.go index 669297d74..5d0485256 100644 --- a/aci/e2e/e2e-aci_test.go +++ b/aci/e2e/e2e-aci_test.go @@ -54,7 +54,7 @@ import ( "github.com/docker/compose-cli/api/context/store" "github.com/docker/compose-cli/api/errdefs" "github.com/docker/compose-cli/cli/cmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) const ( diff --git a/ecs/e2e/ecs-local/context_test.go b/ecs/e2e/ecs-local/context_test.go index 08c68b290..7183ec372 100644 --- a/ecs/e2e/ecs-local/context_test.go +++ b/ecs/e2e/ecs-local/context_test.go @@ -23,7 +23,7 @@ import ( "gotest.tools/v3/icmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) const ( diff --git a/ecs/e2e/ecs/e2e-ecs_test.go b/ecs/e2e/ecs/e2e-ecs_test.go index 4c5d08dd6..d6dd78d03 100644 --- a/ecs/e2e/ecs/e2e-ecs_test.go +++ b/ecs/e2e/ecs/e2e-ecs_test.go @@ -31,7 +31,7 @@ import ( "gotest.tools/v3/icmd" "gotest.tools/v3/poll" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) var binDir string diff --git a/local/e2e/cli-only/e2e_test.go b/local/e2e/cli-only/e2e_test.go index 2372894c4..a8e0455c5 100644 --- a/local/e2e/cli-only/e2e_test.go +++ b/local/e2e/cli-only/e2e_test.go @@ -30,7 +30,7 @@ import ( "gotest.tools/v3/golden" "gotest.tools/v3/icmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) var binDir string diff --git a/tests/framework/mockmetrics.go b/local/e2e/cli-only/mockmetrics.go similarity index 99% rename from tests/framework/mockmetrics.go rename to local/e2e/cli-only/mockmetrics.go index 541868e9d..a12a8853b 100644 --- a/tests/framework/mockmetrics.go +++ b/local/e2e/cli-only/mockmetrics.go @@ -14,7 +14,7 @@ limitations under the License. */ -package framework +package main import ( "io/ioutil" diff --git a/local/e2e/compose/compose_test.go b/local/e2e/compose/compose_test.go index 5c73dbb2b..6046ef84e 100644 --- a/local/e2e/compose/compose_test.go +++ b/local/e2e/compose/compose_test.go @@ -27,7 +27,7 @@ import ( "gotest.tools/v3/assert" "gotest.tools/v3/icmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) var binDir string diff --git a/local/e2e/compose/logs_test.go b/local/e2e/compose/logs_test.go index 95a60f0b6..02d3399ef 100644 --- a/local/e2e/compose/logs_test.go +++ b/local/e2e/compose/logs_test.go @@ -24,7 +24,7 @@ import ( "gotest.tools/v3/icmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) func TestLocalComposeLogs(t *testing.T) { diff --git a/local/e2e/container/container_test.go b/local/e2e/container/container_test.go index cbd520143..8edd20630 100644 --- a/local/e2e/container/container_test.go +++ b/local/e2e/container/container_test.go @@ -29,7 +29,7 @@ import ( "gotest.tools/v3/poll" "github.com/docker/compose-cli/cli/cmd" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) var binDir string diff --git a/local/e2e/container/skip_win_ci_test.go b/local/e2e/container/skip_win_ci_test.go index db53fb1f9..96b8f45c8 100644 --- a/local/e2e/container/skip_win_ci_test.go +++ b/local/e2e/container/skip_win_ci_test.go @@ -30,7 +30,7 @@ import ( "gotest.tools/v3/icmd" "gotest.tools/v3/poll" - . "github.com/docker/compose-cli/tests/framework" + . "github.com/docker/compose-cli/utils/e2e" ) func TestKillChildProcess(t *testing.T) { diff --git a/tests/composefiles/nginx.yaml b/tests/composefiles/nginx.yaml deleted file mode 100644 index a01210dc4..000000000 --- a/tests/composefiles/nginx.yaml +++ /dev/null @@ -1,5 +0,0 @@ -services: - nginx: - image: nginx - ports: - - "80:80" \ No newline at end of file diff --git a/tests/framework/unit.go b/tests/framework/unit.go deleted file mode 100644 index 6f37d63d7..000000000 --- a/tests/framework/unit.go +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright 2020 Docker Compose CLI authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package framework - -import ( - "context" - "io/ioutil" - "os" -) - -// TestCLI is a helper struct for CLI tests. -type TestCLI struct { - ctx context.Context - writer *os.File - reader *os.File -} - -// Context returns a configured context -func (c *TestCLI) Context() context.Context { - return c.ctx -} - -// GetStdOut returns the output of the command -func (c *TestCLI) GetStdOut() string { - _ = c.writer.Close() - out, _ := ioutil.ReadAll(c.reader) - return string(out) -} diff --git a/tests/framework/e2e.go b/utils/e2e/framework.go similarity index 99% rename from tests/framework/e2e.go rename to utils/e2e/framework.go index 61340b527..a525bb9c8 100644 --- a/tests/framework/e2e.go +++ b/utils/e2e/framework.go @@ -14,7 +14,7 @@ limitations under the License. */ -package framework +package e2e import ( "errors" @@ -51,6 +51,7 @@ func init() { } // E2eCLI is used to wrap the CLI for end to end testing +// nolint stutter type E2eCLI struct { BinDir string ConfigDir string