Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix starting_containers test after release of Procfile CNB v3.0.0 #801

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcnb-test/tests/fixtures/procfile/Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
web: python3 -u -m http.server ${PORT:+"${PORT}"}
worker: echo 'this is the worker process!'
echo-args: echo
25 changes: 19 additions & 6 deletions libcnb-test/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn build_other_buildpack() {
context.pack_stdout,
indoc! {"
[Discovering process types]
Procfile declares types -> web, worker, echo-args
Procfile declares types -> web, worker
"}
);
},
Expand Down Expand Up @@ -79,7 +79,7 @@ fn build_workspace_composite_buildpack() {
Buildpack B

[Discovering process types]
Procfile declares types -> web, worker, echo-args
Procfile declares types -> web, worker
"}
);
},
Expand All @@ -103,7 +103,7 @@ fn build_multiple_buildpacks() {
Buildpack B

[Discovering process types]
Procfile declares types -> web, worker, echo-args
Procfile declares types -> web, worker
Buildpack A
"}
);
Expand Down Expand Up @@ -484,18 +484,31 @@ fn starting_containers() {
},
);

// Overriding the default entrypoint, but using the default command.
// Overriding the entrypoint only.
context.start_container(ContainerConfig::new().entrypoint("worker"), |container| {
let all_log_output = container.logs_wait();
assert_empty!(all_log_output.stderr);
assert_eq!(all_log_output.stdout, "this is the worker process!\n");
});

// Overriding the command only.
context.start_container(
// The whole command has to be quoted since the Procfile CNB uses `bash -c`, which
// expects the next arg passed to it to be the entire bash command/script. See:
// https://github.com/heroku/procfile-cnb/pull/205#discussion_r1505866192
ContainerConfig::new().command(["echo 'this is a custom command!'"]),
|container| {
let all_log_output = container.logs_wait();
assert_empty!(all_log_output.stderr);
assert_eq!(all_log_output.stdout, "this is a custom command!\n");
},
);

// Overriding both the entrypoint and command.
context.start_container(
ContainerConfig::new()
.entrypoint("echo-args")
.command(["$GREETING", "$DESIGNATION"])
.entrypoint("launcher")
.command(["echo", "$GREETING", "$DESIGNATION"])
.envs([("GREETING", "Hello"), ("DESIGNATION", "World")]),
|container| {
let all_log_output = container.logs_wait();
Expand Down