Skip to content

Commit

Permalink
fix cli preserve param default and spec tests
Browse files Browse the repository at this point in the history
27086b7 originally changed the preserve default to :on-failure,
but 2e3ba3b erroneously changed it from on-failure to always,
and the spec tests added in 94b87cc never caught the discrepancy
because the class abruptly exits due to invalid parameters in the tests
  • Loading branch information
h0tw1r3 committed Aug 4, 2024
1 parent 7e96527 commit 25dbac5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This changelog adheres to [Keep a CHANGELOG](https://keepachangelog.com).

## [Unreleased]
- Bump minimum ruby requirement to 2.7
- Fix preserve param default behaving like `always` but should be `on-failure`

## [0.52.0] - 2024-06-03
### Added
Expand Down
2 changes: 1 addition & 1 deletion lib/vanagon/cli/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Build < Vanagon::CLI
-o, --only-build COMPONENT,COMPONENT,...
Only build listed COMPONENTs
-p, --preserve [RULE] Rule for VM preservation: never, on-failure, always
[Default: always]
[Default: on-failure]
-r, --remote-workdir DIRECTORY Working directory on the remote host
-s, --skipcheck Skip the "check" stage when building components
-w, --workdir DIRECTORY Working directory on the local host
Expand Down
2 changes: 1 addition & 1 deletion lib/vanagon/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def retry_count
def initialize(platform, project, options = {}) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
@options = options
@verbose = options[:verbose] || false
@preserve = options[:preserve] || false
@preserve = options[:preserve] || :'on-failure'
@workdir = options[:workdir] || Dir.mktmpdir

@@configdir = options[:configdir] || File.join(Dir.pwd, "configs")
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/vanagon/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
end
it "preserve defaults to :on-failure" do
subject = described_class.new
expect(subject.parse([])).to include(:preserve => :'on-failure')
expect(subject.parse(%W[build hello project platform])).to include(:preserve => :'on-failure')
end
end

Expand Down

0 comments on commit 25dbac5

Please sign in to comment.