Skip to content

Commit

Permalink
Fix acceptance tests and add new tests
Browse files Browse the repository at this point in the history
Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
  • Loading branch information
imnitishng committed Apr 29, 2022
1 parent f6825aa commit e4e8e58
Show file tree
Hide file tree
Showing 14 changed files with 195 additions and 110 deletions.
18 changes: 9 additions & 9 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,21 +955,21 @@ func testAcceptance(
helloCommand string
helloArgs []string
helloArgsPrefix string
helloWorkdir string
imageWorkdir string
)
if imageManager.HostOS() == "windows" {
webCommand = ".\\run"
helloCommand = "cmd"
helloArgs = []string{"/c", "echo hello world"}
helloArgsPrefix = " "
helloWorkdir = "/hello_workdir"
imageWorkdir = "c:\\workspace"

} else {
webCommand = "./run"
helloCommand = "echo"
helloArgs = []string{"hello", "world"}
helloArgsPrefix = ""
helloWorkdir = "/hello_workdir"
imageWorkdir = "/workspace"
}

formats := []compareFormat{
Expand Down Expand Up @@ -998,7 +998,7 @@ func testAcceptance(
t.Logf("inspecting image %s format", format.outputArg)

output = pack.RunSuccessfully(inspectCmd, repoName, "--output", format.outputArg)

fmt.Print(output)
expectedOutput := pack.FixtureManager().TemplateFixture(
fmt.Sprintf("inspect_image_local_output.%s", format.extension),
map[string]interface{}{
Expand All @@ -1011,7 +1011,7 @@ func testAcceptance(
"hello_command": helloCommand,
"hello_args": helloArgs,
"hello_args_prefix": helloArgsPrefix,
"hello_workdir": helloWorkdir,
"image_workdir": imageWorkdir,
},
)

Expand Down Expand Up @@ -1608,20 +1608,20 @@ func testAcceptance(
helloCommand string
helloArgs []string
helloArgsPrefix string
helloWorkdir string
imageWorkdir string
)
if imageManager.HostOS() == "windows" {
webCommand = ".\\run"
helloCommand = "cmd"
helloArgs = []string{"/c", "echo hello world"}
helloArgsPrefix = " "
helloWorkdir = "/hello_workdir"
imageWorkdir = "c:\\workspace"
} else {
webCommand = "./run"
helloCommand = "echo"
helloArgs = []string{"hello", "world"}
helloArgsPrefix = ""
helloWorkdir = "/hello_workdir"
imageWorkdir = "/workspace"
}
formats := []compareFormat{
{
Expand Down Expand Up @@ -1662,7 +1662,7 @@ func testAcceptance(
"hello_command": helloCommand,
"hello_args": helloArgs,
"hello_args_prefix": helloArgsPrefix,
"hello_workdir": helloWorkdir,
"image_workdir": imageWorkdir,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ cat <<EOF > "$launch_dir/launch.toml"
command = "echo"
args = ["hello", "world"]
direct = true
working-dir = "/hello_workdir"
EOF

echo "---> Done"
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ echo type = "hello"
echo command = "cmd"
echo args = ["/c", "echo hello world"]
echo direct = true
echo working-dir = "/hello_workdir"
) > %launch_dir%\launch.toml

echo --- Done
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ cat <<EOF > "$launch_dir/launch.toml"
command = "echo"
args = ["hello", "world"]
direct = true
working-dir = "/hello_workdir"
EOF

echo "---> Done"
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ echo type = "hello"
echo command = "cmd"
echo args = ["/c", "echo hello world"]
echo direct = true
echo working-dir = "/hello_workdir"
) > %launch_dir%\launch.toml

echo --- Done
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"args": [
"8080"
],
"working-dir": "/workspace"
"working-dir": "{{.image_workdir}}"
},
{
"type": "hello",
Expand All @@ -44,7 +44,7 @@
"args": [
{{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }}
],
"working-dir": "{{.hello_workdir}}"
"working-dir": "{{.image_workdir}}"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ stack = "pack.test.stack"
command = "{{ ( StringsEscapeBackslash .web_command ) }}"
default = true
args = [ "8080" ]
working-dir = "/workspace"
working-dir = "{{.image_workdir}}"

[[local_info.processes]]
type = "hello"
shell = ""
command = "{{.hello_command}}"
default = false
args = [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) ",") }} ]
working-dir = "{{.hello_workdir}}"
working-dir = "{{.image_workdir}}"
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Buildpacks:

Processes:
TYPE SHELL COMMAND ARGS WORK DIR
web (default) bash {{.web_command}} 8080 /workspace
hello {{.hello_command}} {{ .hello_args_prefix }}{{ StringsJoin .hello_args " "}} {{.hello_workdir}}
web (default) bash {{.web_command}} 8080 {{.image_workdir}}
hello {{.hello_command}} {{ .hello_args_prefix }}{{ StringsJoin .hello_args " "}} {{.image_workdir}}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ local_info:
default: true
args:
- '8080'
working-dir: /workspace
working-dir: {{.image_workdir}}
- type: hello
shell: ''
command: "{{.hello_command}}"
default: false
args: [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) ",") }} ]
working-dir: "{{.hello_workdir}}"
working-dir: "{{.image_workdir}}"
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"args": [
"8080"
],
"working-dir": "/workspace"
"working-dir": "{{.image_workdir}}"
},
{
"type": "hello",
Expand All @@ -40,7 +40,7 @@
"args": [
{{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }}
],
"working-dir": "{{.hello_workdir}}"
"working-dir": "{{.image_workdir}}"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ stack = "pack.test.stack"
command = "{{( StringsEscapeBackslash .web_command )}}"
default = true
args = [ "8080" ]
working-dir = "/workspace"
working-dir = "{{.image_workdir}}"

[[remote_info.processes]]
type = "hello"
shell = ""
command = "{{.hello_command}}"
default = false
args = [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }} ]
working-dir = "{{.hello_workdir}}"
working-dir = "{{.image_workdir}}"

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Buildpacks:

Processes:
TYPE SHELL COMMAND ARGS WORK DIR
web (default) bash {{.web_command}} 8080 /workspace
hello {{.hello_command}} {{ .hello_args_prefix }}{{ StringsJoin .hello_args " "}} {{.hello_workdir}}
web (default) bash {{.web_command}} 8080 {{.image_workdir}}
hello {{.hello_command}} {{ .hello_args_prefix }}{{ StringsJoin .hello_args " "}} {{.image_workdir}}

LOCAL:
(not present)
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ remote_info:
default: true
args:
- '8080'
working-dir: /workspace
working-dir: {{.image_workdir}}
- type: hello
shell: ''
command: "{{.hello_command}}"
default: false
args: [ {{ ( StringsJoin (StringsDoubleQuote .hello_args) "," ) }} ]
working-dir: "{{.hello_workdir}}"
working-dir: "{{.image_workdir}}"
Loading

0 comments on commit e4e8e58

Please sign in to comment.