-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from rodjek/pdk-1086
(PDK-1086) pdk build --force to warn if necessary and continue
- Loading branch information
Showing
4 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'pdk build', module_command: true do | ||
context 'when run inside of a module' do | ||
include_context 'in a new module', 'build' | ||
|
||
metadata = { | ||
'name' => 'testuser-build', | ||
'version' => '0.1.0', | ||
'author' => 'testuser', | ||
'summary' => 'a test module', | ||
'source' => 'https://github.com/testuser/puppet-build', | ||
'project_page' => 'https://testuser.github.io/puppet-build', | ||
'issues_url' => 'https://github.com/testuser/puppet-build/issues', | ||
'dependencies' => [], | ||
'operatingsystem_support' => [{ 'operatingsystem' => 'windows', 'operatingsystemrelease' => ['10'] }], | ||
'requirements' => [{ 'name' => 'puppet', 'version_requirement' => '> 4.10.0 < 7.0.0' }], | ||
'pdk-version' => '1.2.3', | ||
'template-url' => 'https://github.com/puppetlabs/pdk-templates', | ||
'template-ref' => 'heads/master-0-g1234abc', | ||
} | ||
|
||
context 'when the module has complete metadata' do | ||
before(:all) do | ||
File.open('metadata.json', 'w') do |f| | ||
f.puts metadata.to_json | ||
end | ||
end | ||
|
||
after(:all) do | ||
FileUtils.remove_entry_secure('pkg') | ||
end | ||
|
||
describe command('pdk build --force') do | ||
its(:exit_status) { is_expected.to eq(0) } | ||
its(:stdout) { is_expected.to have_no_output } | ||
its(:stderr) { is_expected.not_to match(%r{WARN|ERR}) } | ||
its(:stderr) { is_expected.to match(%r{Build of #{metadata['name']} has completed successfully}) } | ||
|
||
describe file(File.join('pkg', "#{metadata['name']}-#{metadata['version']}.tar.gz")) do | ||
it { is_expected.to be_file } | ||
end | ||
end | ||
end | ||
|
||
context 'when the module has incomplete metadata' do | ||
before(:all) do | ||
File.open('metadata.json', 'w') do |f| | ||
f.puts metadata.reject { |k, _| k == 'source' }.to_json | ||
end | ||
end | ||
|
||
after(:all) do | ||
FileUtils.remove_entry_secure('pkg') | ||
end | ||
|
||
describe command('pdk build --force') do | ||
its(:exit_status) { is_expected.to eq(0) } | ||
its(:stdout) { is_expected.to have_no_output } | ||
its(:stderr) { is_expected.to match(%r{WARN.+missing the following fields.+source}) } | ||
its(:stderr) { is_expected.to match(%r{Build of #{metadata['name']} has completed successfully}) } | ||
|
||
describe file(File.join('pkg', "#{metadata['name']}-#{metadata['version']}.tar.gz")) do | ||
it { is_expected.to be_file } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters