rspec-terraform 0.1.0.pre.40 → 0.1.0.pre.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/rspec/terraform/helpers/apply.rb +25 -3
- data/lib/rspec/terraform/helpers/destroy.rb +29 -8
- data/lib/rspec/terraform/helpers/output.rb +25 -3
- data/lib/rspec/terraform/helpers/plan.rb +24 -4
- data/lib/rspec/terraform/helpers.rb +4 -0
- data/lib/rspec/terraform/logging.rb +24 -3
- data/lib/rspec/terraform/version.rb +1 -1
- data/rspec-terraform.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d338f5e02d75bdf58441300199c8902f712adf6582abff8b9e5021230c2d344
|
4
|
+
data.tar.gz: 16844e10dec62df8e57c1b84216c0f95742586be4fcca7792195d680e526200e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b0bc41cde756000e9e74218ab4b2c9ab451e19b8dbdf6f84a3d1d0329c7d6a1bb94ea801bfd15caaa374c512173b62dd137b610c942efafb5401180bc970ea
|
7
|
+
data.tar.gz: 0631d0581d8f6c6f9a13d8e6edcd9a714b44b6487803c95c0d4a3a5ec5650b129a80fe70054162121b0330e7430cdcf35171727eb406a7da6f964a247f676b43
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-terraform (0.1.0.pre.
|
4
|
+
rspec-terraform (0.1.0.pre.43)
|
5
5
|
confidante (>= 0.27)
|
6
6
|
rspec (>= 3.0)
|
7
|
-
ruby-terraform (= 1.7.0.pre.
|
7
|
+
ruby-terraform (= 1.7.0.pre.17)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
@@ -148,7 +148,7 @@ GEM
|
|
148
148
|
rubocop-rspec (2.12.1)
|
149
149
|
rubocop (~> 1.31)
|
150
150
|
ruby-progressbar (1.11.0)
|
151
|
-
ruby-terraform (1.7.0.pre.
|
151
|
+
ruby-terraform (1.7.0.pre.17)
|
152
152
|
immutable-struct (~> 2.4)
|
153
153
|
lino (~> 3.0)
|
154
154
|
ruby2_keywords (0.0.5)
|
@@ -7,15 +7,26 @@ require_relative '../configuration/var_captor'
|
|
7
7
|
module RSpec
|
8
8
|
module Terraform
|
9
9
|
module Helpers
|
10
|
+
# rubocop:disable Metrics/ClassLength
|
10
11
|
class Apply
|
11
12
|
attr_reader(
|
12
|
-
:configuration_provider,
|
13
|
+
:configuration_provider,
|
14
|
+
:binary,
|
15
|
+
:logger,
|
16
|
+
:stdin,
|
17
|
+
:stdout,
|
18
|
+
:stderr,
|
19
|
+
:execution_mode
|
13
20
|
)
|
14
21
|
|
15
22
|
def initialize(opts = {})
|
16
23
|
@configuration_provider =
|
17
24
|
opts[:configuration_provider] || Configuration.identity_provider
|
18
25
|
@binary = opts[:binary] || 'terraform'
|
26
|
+
@logger = opts[:logger]
|
27
|
+
@stdin = opts[:stdin]
|
28
|
+
@stdout = opts[:stdout]
|
29
|
+
@stderr = opts[:stderr]
|
19
30
|
@execution_mode = opts[:execution_mode] || :in_place
|
20
31
|
end
|
21
32
|
|
@@ -97,11 +108,11 @@ module RSpec
|
|
97
108
|
end
|
98
109
|
|
99
110
|
def init_command
|
100
|
-
RubyTerraform::Commands::Init.new(
|
111
|
+
RubyTerraform::Commands::Init.new(command_options)
|
101
112
|
end
|
102
113
|
|
103
114
|
def apply_command
|
104
|
-
RubyTerraform::Commands::Apply.new(
|
115
|
+
RubyTerraform::Commands::Apply.new(command_options)
|
105
116
|
end
|
106
117
|
|
107
118
|
def init_parameters(parameters)
|
@@ -134,7 +145,18 @@ module RSpec
|
|
134
145
|
apply_parameters
|
135
146
|
end
|
136
147
|
# rubocop:enable Metrics/MethodLength
|
148
|
+
|
149
|
+
def command_options
|
150
|
+
{
|
151
|
+
binary: binary,
|
152
|
+
logger: logger,
|
153
|
+
stdin: stdin,
|
154
|
+
stdout: stdout,
|
155
|
+
stderr: stderr
|
156
|
+
}
|
157
|
+
end
|
137
158
|
end
|
159
|
+
# rubocop:enable Metrics/ClassLength
|
138
160
|
end
|
139
161
|
end
|
140
162
|
end
|
@@ -7,15 +7,26 @@ require_relative '../configuration/var_captor'
|
|
7
7
|
module RSpec
|
8
8
|
module Terraform
|
9
9
|
module Helpers
|
10
|
+
# rubocop:disable Metrics/ClassLength
|
10
11
|
class Destroy
|
11
12
|
attr_reader(
|
12
|
-
:configuration_provider,
|
13
|
+
:configuration_provider,
|
14
|
+
:binary,
|
15
|
+
:logger,
|
16
|
+
:stdin,
|
17
|
+
:stdout,
|
18
|
+
:stderr,
|
19
|
+
:execution_mode
|
13
20
|
)
|
14
21
|
|
15
22
|
def initialize(opts = {})
|
16
23
|
@configuration_provider =
|
17
24
|
opts[:configuration_provider] || Configuration.identity_provider
|
18
25
|
@binary = opts[:binary] || 'terraform'
|
26
|
+
@logger = opts[:logger]
|
27
|
+
@stdin = opts[:stdin]
|
28
|
+
@stdout = opts[:stdout]
|
29
|
+
@stderr = opts[:stderr]
|
19
30
|
@execution_mode = opts[:execution_mode] || :in_place
|
20
31
|
end
|
21
32
|
|
@@ -89,19 +100,18 @@ module RSpec
|
|
89
100
|
end
|
90
101
|
|
91
102
|
def init_command
|
92
|
-
RubyTerraform::Commands::Init.new(
|
103
|
+
RubyTerraform::Commands::Init.new(command_options)
|
93
104
|
end
|
94
105
|
|
95
106
|
def destroy_command
|
96
|
-
RubyTerraform::Commands::Destroy.new(
|
107
|
+
RubyTerraform::Commands::Destroy.new(command_options)
|
97
108
|
end
|
98
109
|
|
99
110
|
def init_parameters(parameters)
|
100
|
-
init_parameters =
|
101
|
-
parameters
|
102
|
-
|
103
|
-
|
104
|
-
)
|
111
|
+
init_parameters = parameters.merge(
|
112
|
+
chdir: parameters[:configuration_directory],
|
113
|
+
input: false
|
114
|
+
)
|
105
115
|
if execution_mode == :isolated
|
106
116
|
init_parameters =
|
107
117
|
init_parameters.merge(from_module: parameters[:source_directory])
|
@@ -127,7 +137,18 @@ module RSpec
|
|
127
137
|
destroy_parameters
|
128
138
|
end
|
129
139
|
# rubocop:enable Metrics/MethodLength
|
140
|
+
|
141
|
+
def command_options
|
142
|
+
{
|
143
|
+
binary: binary,
|
144
|
+
logger: logger,
|
145
|
+
stdin: stdin,
|
146
|
+
stdout: stdout,
|
147
|
+
stderr: stderr
|
148
|
+
}
|
149
|
+
end
|
130
150
|
end
|
151
|
+
# rubocop:enable Metrics/ClassLength
|
131
152
|
end
|
132
153
|
end
|
133
154
|
end
|
@@ -5,15 +5,26 @@ require 'ruby_terraform'
|
|
5
5
|
module RSpec
|
6
6
|
module Terraform
|
7
7
|
module Helpers
|
8
|
+
# rubocop:disable Metrics/ClassLength
|
8
9
|
class Output
|
9
10
|
attr_reader(
|
10
|
-
:configuration_provider,
|
11
|
+
:configuration_provider,
|
12
|
+
:binary,
|
13
|
+
:logger,
|
14
|
+
:stdin,
|
15
|
+
:stdout,
|
16
|
+
:stderr,
|
17
|
+
:execution_mode
|
11
18
|
)
|
12
19
|
|
13
20
|
def initialize(opts = {})
|
14
21
|
@configuration_provider =
|
15
22
|
opts[:configuration_provider] || Configuration.identity_provider
|
16
23
|
@binary = opts[:binary] || 'terraform'
|
24
|
+
@logger = opts[:logger]
|
25
|
+
@stdin = opts[:stdin]
|
26
|
+
@stdout = opts[:stdout]
|
27
|
+
@stderr = opts[:stderr]
|
17
28
|
@execution_mode = opts[:execution_mode] || :in_place
|
18
29
|
end
|
19
30
|
|
@@ -90,11 +101,11 @@ module RSpec
|
|
90
101
|
end
|
91
102
|
|
92
103
|
def init_command
|
93
|
-
RubyTerraform::Commands::Init.new(
|
104
|
+
RubyTerraform::Commands::Init.new(command_options)
|
94
105
|
end
|
95
106
|
|
96
107
|
def output_command(opts = {})
|
97
|
-
RubyTerraform::Commands::Output.new(
|
108
|
+
RubyTerraform::Commands::Output.new(command_options.merge(opts))
|
98
109
|
end
|
99
110
|
|
100
111
|
def init_parameters(parameters)
|
@@ -123,7 +134,18 @@ module RSpec
|
|
123
134
|
|
124
135
|
output_parameters
|
125
136
|
end
|
137
|
+
|
138
|
+
def command_options
|
139
|
+
{
|
140
|
+
binary: binary,
|
141
|
+
logger: logger,
|
142
|
+
stdin: stdin,
|
143
|
+
stdout: stdout,
|
144
|
+
stderr: stderr
|
145
|
+
}
|
146
|
+
end
|
126
147
|
end
|
127
148
|
end
|
149
|
+
# rubocop:enable Metrics/ClassLength
|
128
150
|
end
|
129
151
|
end
|
@@ -12,13 +12,23 @@ module RSpec
|
|
12
12
|
# rubocop:disable Metrics/ClassLength
|
13
13
|
class Plan
|
14
14
|
attr_reader(
|
15
|
-
:configuration_provider,
|
15
|
+
:configuration_provider,
|
16
|
+
:binary,
|
17
|
+
:logger,
|
18
|
+
:stdin,
|
19
|
+
:stdout,
|
20
|
+
:stderr,
|
21
|
+
:execution_mode
|
16
22
|
)
|
17
23
|
|
18
24
|
def initialize(opts = {})
|
19
25
|
@configuration_provider =
|
20
26
|
opts[:configuration_provider] || Configuration.identity_provider
|
21
27
|
@binary = opts[:binary] || 'terraform'
|
28
|
+
@logger = opts[:logger]
|
29
|
+
@stdin = opts[:stdin]
|
30
|
+
@stdout = opts[:stdout]
|
31
|
+
@stderr = opts[:stderr]
|
22
32
|
@execution_mode = opts[:execution_mode] || :in_place
|
23
33
|
end
|
24
34
|
|
@@ -116,15 +126,15 @@ module RSpec
|
|
116
126
|
end
|
117
127
|
|
118
128
|
def init_command
|
119
|
-
RubyTerraform::Commands::Init.new(
|
129
|
+
RubyTerraform::Commands::Init.new(command_options)
|
120
130
|
end
|
121
131
|
|
122
132
|
def plan_command
|
123
|
-
RubyTerraform::Commands::Plan.new(
|
133
|
+
RubyTerraform::Commands::Plan.new(command_options)
|
124
134
|
end
|
125
135
|
|
126
136
|
def show_command(opts = {})
|
127
|
-
RubyTerraform::Commands::Show.new(
|
137
|
+
RubyTerraform::Commands::Show.new(command_options.merge(opts))
|
128
138
|
end
|
129
139
|
|
130
140
|
def init_parameters(parameters)
|
@@ -167,6 +177,16 @@ module RSpec
|
|
167
177
|
json: true
|
168
178
|
)
|
169
179
|
end
|
180
|
+
|
181
|
+
def command_options
|
182
|
+
{
|
183
|
+
binary: binary,
|
184
|
+
logger: logger,
|
185
|
+
stdin: stdin,
|
186
|
+
stdout: stdout,
|
187
|
+
stderr: stderr
|
188
|
+
}
|
189
|
+
end
|
170
190
|
end
|
171
191
|
# rubocop:enable Metrics/ClassLength
|
172
192
|
end
|
@@ -46,6 +46,10 @@ module RSpec
|
|
46
46
|
|
47
47
|
{
|
48
48
|
binary: config.terraform_binary,
|
49
|
+
logger: config.terraform_logger,
|
50
|
+
stdin: config.terraform_stdin,
|
51
|
+
stdout: config.terraform_stdout,
|
52
|
+
stderr: config.terraform_stderr,
|
49
53
|
execution_mode: config.terraform_execution_mode,
|
50
54
|
configuration_provider: config.terraform_configuration_provider
|
51
55
|
}
|
@@ -66,13 +66,34 @@ module RSpec
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def devices(opts)
|
69
|
+
streams = opts[:streams]
|
70
|
+
file_path = opts[:file_path]
|
71
|
+
stdout = opts[:stdout]
|
72
|
+
|
69
73
|
{
|
70
|
-
file: log_device(
|
71
|
-
stdout: log_device(
|
72
|
-
stderr: log_device(
|
74
|
+
file: log_device(resolve_file_path(file_path, streams)),
|
75
|
+
stdout: log_device(resolved_stdout(stdout)),
|
76
|
+
stderr: log_device(resolved_stderr)
|
73
77
|
}
|
74
78
|
end
|
75
79
|
|
80
|
+
def resolve_file_path(file_path, streams)
|
81
|
+
resolved_file_path = File::NULL
|
82
|
+
if streams.include?(:file) && file_path
|
83
|
+
FileUtils.mkdir_p(File.dirname(file_path))
|
84
|
+
resolved_file_path = file_path
|
85
|
+
end
|
86
|
+
resolved_file_path
|
87
|
+
end
|
88
|
+
|
89
|
+
def resolved_stdout(stdout)
|
90
|
+
stdout || $stdout
|
91
|
+
end
|
92
|
+
|
93
|
+
def resolved_stderr
|
94
|
+
$stderr
|
95
|
+
end
|
96
|
+
|
76
97
|
def log_device(io)
|
77
98
|
Logger::LogDevice.new(io)
|
78
99
|
end
|
data/rspec-terraform.gemspec
CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
|
40
40
|
spec.add_dependency 'confidante', '>= 0.27'
|
41
41
|
spec.add_dependency 'rspec', '>= 3.0'
|
42
|
-
spec.add_dependency 'ruby-terraform', '1.7.0.pre.
|
42
|
+
spec.add_dependency 'ruby-terraform', '1.7.0.pre.17'
|
43
43
|
|
44
44
|
spec.add_development_dependency 'bundler'
|
45
45
|
spec.add_development_dependency 'faker'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.7.0.pre.
|
47
|
+
version: 1.7.0.pre.17
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.7.0.pre.
|
54
|
+
version: 1.7.0.pre.17
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|