This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warnings for env_file entries not copied
As 'env_file' entries are not taken in account, we warn the user to copy that and fix it's compose file. Signed-off-by: Ulysses Souza <[email protected]>
- Loading branch information
1 parent
daee953
commit 8b13bfc
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,63 @@ func TestRenderFormatters(t *testing.T) { | |
golden.Assert(t, result.Stdout(), "expected-yaml-render.golden") | ||
} | ||
|
||
func TestInitWarningEnvFile(t *testing.T) { | ||
cmd, cleanup := dockerCli.createTestCmd() | ||
defer cleanup() | ||
|
||
composeData := `version: "3.2" | ||
services: | ||
nginx: | ||
image: nginx:latest | ||
command: nginx $NGINX_ARGS ${NGINX_DRY_RUN} | ||
env_file: | ||
- myenv1.env | ||
- myenv2.env` | ||
meta := `# Version of the application | ||
version: 0.1.0 | ||
# Name of the application | ||
name: app-test | ||
# A short description of the application | ||
description: my cool app | ||
# List of application maintainers with name and email for each | ||
maintainers: | ||
- name: dev1 | ||
email: | ||
- name: dev2 | ||
email: [email protected] | ||
` | ||
envData := "# some comment\nNGINX_DRY_RUN=-t" | ||
tmpDir := fs.NewDir(t, "app_input", | ||
fs.WithFile(internal.ComposeFileName, composeData), | ||
fs.WithFile(".env", envData), | ||
fs.WithFile("myenv1.env", ""), | ||
fs.WithFile("myenv2.env", ""), | ||
) | ||
defer tmpDir.Remove() | ||
|
||
testAppName := "app-test" | ||
dirName := internal.DirNameFromAppName(testAppName) | ||
|
||
cmd.Dir = tmpDir.Path() | ||
cmd.Command = dockerCli.Command("app", | ||
"init", testAppName, | ||
"--compose-file", tmpDir.Join(internal.ComposeFileName), | ||
"--description", "my cool app", | ||
"--maintainer", "dev1", | ||
"--maintainer", "dev2:[email protected]") | ||
stdOut := icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined() | ||
golden.Assert(t, stdOut, "init-output-warning-envfile.golden") | ||
|
||
manifest := fs.Expected( | ||
t, | ||
fs.WithMode(0755), | ||
fs.WithFile(internal.MetadataFileName, meta, fs.WithMode(0644)), | ||
fs.WithFile(internal.ComposeFileName, composeData, fs.WithMode(0644)), | ||
fs.WithFile(internal.ParametersFileName, "NGINX_ARGS: FILL ME\nNGINX_DRY_RUN: -t\n", fs.WithMode(0644)), | ||
) | ||
assert.Assert(t, fs.Equal(tmpDir.Join(dirName), manifest)) | ||
} | ||
|
||
func TestInit(t *testing.T) { | ||
cmd, cleanup := dockerCli.createTestCmd() | ||
defer cleanup() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"env_file: myenv1.env" entry of service "nginx" will NOT be copied automatically! Please, copy the file inside the application folder and update your compose file referring to it. | ||
"env_file: myenv2.env" entry of service "nginx" will NOT be copied automatically! Please, copy the file inside the application folder and update your compose file referring to it. | ||
Created "app-test.dockerapp" | ||
You will need to edit parameters.yml to fill in default values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters