Skip to content

Commit

Permalink
fix: run command fails when runner workload has ENV but original work…
Browse files Browse the repository at this point in the history
…load does not
  • Loading branch information
rafaelgomesxyz committed Aug 22, 2024
1 parent cd78696 commit 09d66b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/command/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def update_runner_workload # rubocop:disable Metrics/CyclomaticComplexity, Metri
original_env_str = original_container_spec["env"]&.sort_by { |env| env["name"] }.to_s
env_str = container_spec["env"]&.sort_by { |env| env["name"] }.to_s
if original_env_str != env_str
container_spec["env"] = original_container_spec["env"]
container_spec["env"] = original_container_spec["env"] || []
should_update = true
end

Expand Down
22 changes: 22 additions & 0 deletions spec/command/run_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,27 @@
expect(result[:stderr]).to include("Gemfile")
end
end

context "when runner workload has ENV but original workload does not" do
let!(:app) { dummy_test_app }

before do
run_cpflow_command!("apply-template", "app", "rails", "rails-runner-with-different-env", "-a", app)
run_cpflow_command!("build-image", "-a", app)
run_cpflow_command!("deploy-image", "-a", app)
end

after do
run_cpflow_command!("delete", "-a", app, "--yes")
end

it "updates runner workload", :slow do
result = run_cpflow_command("run", "-a", app, "--entrypoint", "none", "--", "ls")

expect(result[:status]).to eq(0)
expect(result[:stderr]).to include("Updating runner workload")
expect(result[:stderr]).to include("Gemfile")
end
end
end
end

0 comments on commit 09d66b8

Please sign in to comment.