Skip to content

Commit

Permalink
Add test coverage of compound bash commands (#234)
Browse files Browse the repository at this point in the history
The `Procfile` format supports specifying compound bash
commands like:

```
web: foo && bar
```

This buildpack currently supports these, however, there is no
integration test coverage of them.

Having coverage is important, since some of the approaches
for implementing the `bash -c` wrapping don't support usage
of compound commands, as seen in:
#150 (comment)

As such I've added a new integration test for this, which also tests
quoting (in case a future buildpack implementation starts trying to
parse/escape the commands) and variable interpolation.

This test case was extracted from #150 (which itself was superseded).
  • Loading branch information
edmorley authored Jul 2, 2024
1 parent 7c18cd7 commit 0d99e3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/fixtures/complex_command_procfile/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Tests use of compound bash commands, both quote styles, nested quoting and variable interpolation.
web: echo 'this is the "web" process!' && echo "\"PORT\" is set to: '${PORT}'"
21 changes: 21 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ fn test_multiple_non_web_procfile() {
);
}

#[test]
#[ignore = "integration test"]
// Tests use of compound bash commands, both quote styles, nested quoting and variable interpolation.
fn test_complex_command_procfile() {
TestRunner::default().build(
BuildConfig::new(
"heroku/builder:22",
"tests/fixtures/complex_command_procfile",
),
|context| {
context.start_container(ContainerConfig::new().env("PORT", "12345"), |container| {
let log_output = container.logs_wait();
assert_eq!(
log_output.stdout,
"this is the \"web\" process!\n\"PORT\" is set to: '12345'\n"
);
});
},
);
}

#[test]
#[ignore = "integration test"]
// Tests a Procfile that happens to not be valid YAML, but is still valid according
Expand Down

0 comments on commit 0d99e3b

Please sign in to comment.