kitchen-terraform 0.1.0 → 0.1.1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +201 -0
- data/README.md +284 -0
- data/lib/kitchen/verifier/terraform.rb +1 -1
- data/lib/terraform/version.rb +1 -1
- metadata +5 -20
- metadata.gz.sig +0 -0
- data/spec/lib/kitchen/driver/terraform_spec.rb +0 -126
- data/spec/lib/kitchen/provisioner/terraform_spec.rb +0 -106
- data/spec/lib/kitchen/verifier/terraform_spec.rb +0 -302
- data/spec/lib/terraform/apply_command_spec.rb +0 -32
- data/spec/lib/terraform/client_spec.rb +0 -211
- data/spec/lib/terraform/command_options_spec.rb +0 -34
- data/spec/lib/terraform/get_command_spec.rb +0 -30
- data/spec/lib/terraform/inspec_runner_spec.rb +0 -67
- data/spec/lib/terraform/output_command_spec.rb +0 -58
- data/spec/lib/terraform/plan_command_spec.rb +0 -46
- data/spec/lib/terraform/validate_command_spec.rb +0 -30
- data/spec/lib/terraform/version_command_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -27
- data/spec/support/coverage.rb +0 -21
- data/spec/support/terraform/client_holder_context.rb +0 -26
- data/spec/support/terraform/client_holder_examples.rb +0 -36
- data/spec/support/terraform/command_examples.rb +0 -80
- data/spec/support/terraform/versions_are_set_examples.rb +0 -35
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/validate_command'
|
18
|
-
require 'support/terraform/command_examples'
|
19
|
-
|
20
|
-
RSpec.describe Terraform::ValidateCommand do
|
21
|
-
it_behaves_like Terraform::Command do
|
22
|
-
let(:command_options) { '' }
|
23
|
-
|
24
|
-
let(:described_instance) { described_class.new dir: target }
|
25
|
-
|
26
|
-
let(:name) { 'validate' }
|
27
|
-
|
28
|
-
let(:target) { '<directory>' }
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/version_command'
|
18
|
-
require 'support/terraform/command_examples'
|
19
|
-
|
20
|
-
RSpec.describe Terraform::VersionCommand do
|
21
|
-
it_behaves_like Terraform::Command do
|
22
|
-
let(:command_options) { '' }
|
23
|
-
|
24
|
-
let(:described_instance) { described_class.new }
|
25
|
-
|
26
|
-
let(:name) { 'version' }
|
27
|
-
|
28
|
-
let(:target) { '' }
|
29
|
-
end
|
30
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'support/coverage'
|
18
|
-
|
19
|
-
RSpec.configure do |configuration|
|
20
|
-
configuration.disable_monkey_patching!
|
21
|
-
|
22
|
-
configuration.mock_with :rspec do |mocks|
|
23
|
-
mocks.verify_doubled_constant_names = true
|
24
|
-
|
25
|
-
mocks.verify_partial_doubles = true
|
26
|
-
end
|
27
|
-
end
|
data/spec/support/coverage.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'simplecov'
|
18
|
-
|
19
|
-
SimpleCov.minimum_coverage 100
|
20
|
-
|
21
|
-
SimpleCov.start
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/client'
|
18
|
-
|
19
|
-
RSpec.shared_context '#client' do
|
20
|
-
let(:client) { instance_double Terraform::Client }
|
21
|
-
|
22
|
-
before do
|
23
|
-
allow(described_instance).to receive(:client).with(no_args)
|
24
|
-
.and_return client
|
25
|
-
end
|
26
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/client_holder'
|
18
|
-
|
19
|
-
RSpec.shared_examples Terraform::ClientHolder do
|
20
|
-
describe '#client' do
|
21
|
-
let(:instance) { instance_double Kitchen::Instance }
|
22
|
-
|
23
|
-
before do
|
24
|
-
allow(described_instance).to receive(:instance).with(no_args)
|
25
|
-
.and_return instance
|
26
|
-
|
27
|
-
allow(instance).to receive(:name).with no_args
|
28
|
-
|
29
|
-
allow(instance).to receive(:provisioner).with no_args
|
30
|
-
end
|
31
|
-
|
32
|
-
subject { described_instance.client }
|
33
|
-
|
34
|
-
it('is a Terraform client') { is_expected.to be_kind_of Terraform::Client }
|
35
|
-
end
|
36
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/command'
|
18
|
-
|
19
|
-
RSpec.shared_examples Terraform::Command do
|
20
|
-
describe '#execute' do
|
21
|
-
let(:shell_out) { instance_double Mixlib::ShellOut }
|
22
|
-
|
23
|
-
before do
|
24
|
-
allow(described_instance)
|
25
|
-
.to receive(:shell_out).with(no_args).and_return shell_out
|
26
|
-
|
27
|
-
allow(shell_out).to receive(:run_command).with no_args
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'when the execution is successful' do
|
31
|
-
let(:stdout) { instance_double Object }
|
32
|
-
|
33
|
-
before do
|
34
|
-
allow(shell_out).to receive(:error!).with no_args
|
35
|
-
|
36
|
-
allow(shell_out).to receive(:stdout).with(no_args).and_return stdout
|
37
|
-
end
|
38
|
-
|
39
|
-
subject { ->(block) { described_instance.execute(&block) } }
|
40
|
-
|
41
|
-
it('yields the output') { is_expected.to yield_with_args stdout }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when the execution is not successful due to a standard error' do
|
45
|
-
before { allow(shell_out).to receive(:error!).with(no_args).and_raise }
|
46
|
-
|
47
|
-
subject { proc { described_instance.execute } }
|
48
|
-
|
49
|
-
it('raises an error') { is_expected.to raise_error Terraform::Error }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#name' do
|
54
|
-
let :supported_command_names do
|
55
|
-
%w(apply destroy get output plan validate version)
|
56
|
-
end
|
57
|
-
|
58
|
-
subject { described_instance.name }
|
59
|
-
|
60
|
-
it 'is a supported command' do
|
61
|
-
is_expected.to(
|
62
|
-
satisfy { |command_name| supported_command_names.include? command_name }
|
63
|
-
)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#options' do
|
68
|
-
subject { described_instance.options }
|
69
|
-
|
70
|
-
it('is a hash') { is_expected.to be_kind_of Hash }
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#to_s' do
|
74
|
-
subject { described_instance.to_s }
|
75
|
-
|
76
|
-
it 'is the converted command string' do
|
77
|
-
is_expected.to eq "terraform #{name} #{command_options} #{target}"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/version'
|
18
|
-
|
19
|
-
RSpec.shared_examples 'versions are set' do
|
20
|
-
describe '@api_version' do
|
21
|
-
subject :api_version do
|
22
|
-
described_class.instance_variable_get :@api_version
|
23
|
-
end
|
24
|
-
|
25
|
-
it('equals 2') { is_expected.to eq 2 }
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '@plugin_version' do
|
29
|
-
subject :plugin_version do
|
30
|
-
described_class.instance_variable_get :@plugin_version
|
31
|
-
end
|
32
|
-
|
33
|
-
it('equals the gem version') { is_expected.to be Terraform::VERSION }
|
34
|
-
end
|
35
|
-
end
|