puppetlabs-onceover 5.0.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop_todo.yml +35 -15
- data/CHANGELOG.md +398 -3
- data/Gemfile +21 -1
- data/lib/puppetlabs-onceover/cli/plugins.rb +3 -3
- data/lib/puppetlabs-onceover/controlrepo.rb +8 -7
- data/lib/puppetlabs-onceover/rake_tasks.rb +2 -2
- data/lib/puppetlabs-onceover/vendored_modules.rb +29 -32
- data/lib/puppetlabs-onceover/version.rb +1 -1
- data/spec/fixtures/controlrepos/deploy_test/Puppetfile +3 -0
- data/spec/fixtures/controlrepos/deploy_test/a_dir/nested_file.txt +1 -0
- data/spec/fixtures/controlrepos/deploy_test/a_symlink +1 -0
- data/spec/fixtures/controlrepos/deploy_test/environment.conf +1 -0
- data/spec/fixtures/controlrepos/deploy_test/regular_file.txt +1 -0
- data/spec/puppetlabs-onceover/beaker_spec.rb +293 -0
- data/spec/puppetlabs-onceover/class_spec.rb +89 -0
- data/spec/puppetlabs-onceover/cli/run_spec.rb +80 -0
- data/spec/puppetlabs-onceover/cli/show_spec.rb +67 -0
- data/spec/puppetlabs-onceover/cli_spec.rb +79 -0
- data/spec/puppetlabs-onceover/controlrepo_spec.rb +787 -5
- data/spec/puppetlabs-onceover/deploy_spec.rb +246 -0
- data/spec/puppetlabs-onceover/group_spec.rb +121 -0
- data/spec/puppetlabs-onceover/logger_spec.rb +30 -0
- data/spec/puppetlabs-onceover/node_spec.rb +124 -0
- data/spec/puppetlabs-onceover/rake_tasks_spec.rb +179 -0
- data/spec/puppetlabs-onceover/rspec/formatters_spec.rb +361 -0
- data/spec/puppetlabs-onceover/runner_spec.rb +307 -0
- data/spec/puppetlabs-onceover/test_spec.rb +177 -0
- data/spec/puppetlabs-onceover/testconfig_spec.rb +451 -0
- data/spec/puppetlabs-onceover/vendored_modules_spec.rb +293 -0
- data/spec/puppetlabs-onceover/version_spec.rb +10 -0
- data/spec/spec_helper.rb +8 -0
- metadata +23 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'puppetlabs-onceover/cli/show'
|
|
3
|
+
|
|
4
|
+
describe PuppetlabsOnceover::CLI::Show do
|
|
5
|
+
describe '.command' do
|
|
6
|
+
it 'builds a memoized Cri::Command named show' do
|
|
7
|
+
cmd = described_class.command
|
|
8
|
+
expect(cmd).to be_a(Cri::Command)
|
|
9
|
+
expect(cmd.name).to eq('show')
|
|
10
|
+
expect(described_class.command).to equal(cmd)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'prints help and exits 0 when run directly' do
|
|
14
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
15
|
+
expect { described_class.command.run([]) }.to output(/Shows the current state of things/).to_stdout
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'registers the repo and puppetfile subcommands' do
|
|
19
|
+
names = described_class.command.subcommands.map(&:name)
|
|
20
|
+
expect(names).to include('repo', 'puppetfile')
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe PuppetlabsOnceover::CLI::Show::Repo do
|
|
25
|
+
describe '.command' do
|
|
26
|
+
it 'builds a memoized Cri::Command named repo' do
|
|
27
|
+
cmd = described_class.command
|
|
28
|
+
expect(cmd).to be_a(Cri::Command)
|
|
29
|
+
expect(cmd.name).to eq('repo')
|
|
30
|
+
expect(described_class.command).to equal(cmd)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'prints repo and test config information and exits 0' do
|
|
34
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
35
|
+
repo = double('repo', to_s: 'REPO INFO', onceover_yaml: '/some/repo/.onceover.yaml')
|
|
36
|
+
config = double('config', to_s: 'CONFIG INFO')
|
|
37
|
+
allow(PuppetlabsOnceover::Controlrepo).to receive(:new).and_return(repo)
|
|
38
|
+
allow(PuppetlabsOnceover::TestConfig).to receive(:new).and_return(config)
|
|
39
|
+
|
|
40
|
+
expect { described_class.command.run([]) }.to output(/REPO INFO/).to_stdout
|
|
41
|
+
expect { described_class.command.run([]) }.to output(/CONFIG INFO/).to_stdout
|
|
42
|
+
expect(PuppetlabsOnceover::TestConfig).to have_received(:new).with(repo.onceover_yaml, anything).at_least(:once)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe PuppetlabsOnceover::CLI::Show::Puppetfile do
|
|
48
|
+
describe '.command' do
|
|
49
|
+
it 'builds a memoized Cri::Command named puppetfile' do
|
|
50
|
+
cmd = described_class.command
|
|
51
|
+
expect(cmd).to be_a(Cri::Command)
|
|
52
|
+
expect(cmd.name).to eq('puppetfile')
|
|
53
|
+
expect(described_class.command).to equal(cmd)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'prints the puppetfile table and exits 0' do
|
|
57
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
58
|
+
repo = double('repo', print_puppetfile_table: nil)
|
|
59
|
+
allow(PuppetlabsOnceover::Controlrepo).to receive(:new).and_return(repo)
|
|
60
|
+
|
|
61
|
+
described_class.command.run([])
|
|
62
|
+
|
|
63
|
+
expect(repo).to have_received(:print_puppetfile_table)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'puppetlabs-onceover/cli'
|
|
3
|
+
require 'puppetlabs-onceover/cli/init'
|
|
4
|
+
require 'puppetlabs-onceover/cli/update'
|
|
5
|
+
require 'puppetlabs-onceover/cli/plugins'
|
|
6
|
+
|
|
7
|
+
describe PuppetlabsOnceover::CLI do
|
|
8
|
+
describe '.command' do
|
|
9
|
+
it 'builds a memoized Cri::Command named onceover' do
|
|
10
|
+
cmd = described_class.command
|
|
11
|
+
expect(cmd).to be_a(Cri::Command)
|
|
12
|
+
expect(cmd.name).to eq('onceover')
|
|
13
|
+
expect(described_class.command).to equal(cmd)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'prints help and exits 0 when run with no subcommand' do
|
|
17
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
18
|
+
expect { described_class.command.run([]) }.to output(/Tool for testing Puppet controlrepos/).to_stdout
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'prints help and exits 0 when given -h' do
|
|
22
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
23
|
+
expect { described_class.command.run(['-h']) }.to output(/onceover/).to_stdout
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'registers the show, run, init, and update subcommands' do
|
|
27
|
+
names = described_class.command.subcommands.map(&:name)
|
|
28
|
+
expect(names).to include('show', 'run', 'init', 'update')
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe PuppetlabsOnceover::CLI::Init do
|
|
34
|
+
describe '.command' do
|
|
35
|
+
it 'builds a memoized Cri::Command named init' do
|
|
36
|
+
cmd = described_class.command
|
|
37
|
+
expect(cmd).to be_a(Cri::Command)
|
|
38
|
+
expect(cmd.name).to eq('init')
|
|
39
|
+
expect(described_class.command).to equal(cmd)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'calls Controlrepo.init with a freshly built Controlrepo' do
|
|
43
|
+
repo = double('repo')
|
|
44
|
+
allow(PuppetlabsOnceover::Controlrepo).to receive(:new).and_return(repo)
|
|
45
|
+
allow(PuppetlabsOnceover::Controlrepo).to receive(:init)
|
|
46
|
+
|
|
47
|
+
described_class.command.run([])
|
|
48
|
+
|
|
49
|
+
expect(PuppetlabsOnceover::Controlrepo).to have_received(:init).with(repo)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe PuppetlabsOnceover::CLI::Update do
|
|
55
|
+
describe '.command' do
|
|
56
|
+
it 'prints help and exits 0 when run directly' do
|
|
57
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
58
|
+
expect { described_class.command.run([]) }.to output(/Updates stuff/).to_stdout
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe PuppetlabsOnceover::CLI::Update::Puppetfile do
|
|
63
|
+
it 'calls update_puppetfile on a freshly built Controlrepo and exits 0' do
|
|
64
|
+
allow_any_instance_of(Object).to receive(:exit)
|
|
65
|
+
repo = double('repo', update_puppetfile: nil)
|
|
66
|
+
allow(PuppetlabsOnceover::Controlrepo).to receive(:new).and_return(repo)
|
|
67
|
+
|
|
68
|
+
described_class.command.run([])
|
|
69
|
+
|
|
70
|
+
expect(repo).to have_received(:update_puppetfile)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe 'cli/plugins.rb' do
|
|
76
|
+
it 'requires the plugins file without error, discovering zero or more onceover-* gems' do
|
|
77
|
+
expect { load File.expand_path('../../lib/puppetlabs-onceover/cli/plugins.rb', __dir__) }.not_to raise_error
|
|
78
|
+
end
|
|
79
|
+
end
|