Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit bf17797

Browse files
committed
Adapt tests to use absolute paths
- This also includes IDE linter formating Signed-off-by: Ulysses Souza <[email protected]>
1 parent a3e81be commit bf17797

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

local/e2e/compose/compose_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ func TestLocalComposeUp(t *testing.T) {
6666
})
6767

6868
t.Run("check compose labels", func(t *testing.T) {
69+
wd, _ := os.Getwd()
6970
res := c.RunDockerCmd("inspect", projectName+"_web_1")
7071
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.container-number": "1"`})
7172
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.project": "compose-e2e-demo"`})
7273
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.oneoff": "False",`})
7374
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.config-hash":`})
74-
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.project.config_files": "./fixtures/sentences/compose.yaml"`})
75+
res.Assert(t, icmd.Expected{Out: fmt.Sprintf(`"com.docker.compose.project.config_files": "%s/fixtures/sentences/compose.yaml"`, wd)})
7576
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.project.working_dir":`})
7677
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.service": "web"`})
7778
res.Assert(t, icmd.Expected{Out: `"com.docker.compose.version":`})
@@ -122,7 +123,7 @@ func TestLocalComposeRun(t *testing.T) {
122123
containerID := fields[len(fields)-1]
123124
assert.Assert(t, !strings.HasPrefix(containerID, "run-test_front"))
124125
if strings.HasPrefix(containerID, "run-test_back") {
125-
//only the one-off container for back service
126+
// only the one-off container for back service
126127
assert.Assert(t, strings.HasPrefix(containerID, "run-test_back_run_"), containerID)
127128
truncatedSlug = strings.Replace(containerID, "run-test_back_run_", "", 1)
128129
runContainerID = containerID
@@ -200,7 +201,7 @@ func TestLocalComposeBuild(t *testing.T) {
200201
c := NewParallelE2eCLI(t, binDir)
201202

202203
t.Run("build named and unnamed images", func(t *testing.T) {
203-
//ensure local test run does not reuse previously build image
204+
// ensure local test run does not reuse previously build image
204205
c.RunDockerOrExitError("rmi", "build-test_nginx")
205206
c.RunDockerOrExitError("rmi", "custom-nginx")
206207

@@ -248,7 +249,7 @@ func TestLocalComposeVolume(t *testing.T) {
248249
const projectName = "compose-e2e-volume"
249250

250251
t.Run("up with build and no image name, volume", func(t *testing.T) {
251-
//ensure local test run does not reuse previously build image
252+
// ensure local test run does not reuse previously build image
252253
c.RunDockerOrExitError("rmi", "compose-e2e-volume_nginx")
253254
c.RunDockerOrExitError("volume", "rm", projectName+"_staticVol")
254255
c.RunDockerOrExitError("volume", "rm", "myvolume")
@@ -263,14 +264,14 @@ func TestLocalComposeVolume(t *testing.T) {
263264
t.Run("check container volume specs", func(t *testing.T) {
264265
res := c.RunDockerCmd("inspect", "compose-e2e-volume_nginx2_1", "--format", "{{ json .Mounts }}")
265266
output := res.Stdout()
266-
//nolint
267+
// nolint
267268
assert.Assert(t, strings.Contains(output, `"Destination":"/usr/src/app/node_modules","Driver":"local","Mode":"","RW":true,"Propagation":""`), output)
268269
})
269270

270271
t.Run("check container bind-mounts specs", func(t *testing.T) {
271272
res := c.RunDockerCmd("inspect", "compose-e2e-volume_nginx_1", "--format", "{{ json .HostConfig.Mounts }}")
272273
output := res.Stdout()
273-
//nolint
274+
// nolint
274275
assert.Assert(t, strings.Contains(output, `"Type":"bind"`))
275276
assert.Assert(t, strings.Contains(output, `"Target":"/usr/share/nginx/html"`))
276277
})

0 commit comments

Comments
 (0)