rspec-terraform 0.1.0.pre.29 → 0.1.0.pre.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -1
- data/lib/rspec/terraform/configuration/providers/base.rb +15 -0
- data/lib/rspec/terraform/configuration/providers/confidante.rb +46 -0
- data/lib/rspec/terraform/configuration/providers/identity.rb +3 -1
- data/lib/rspec/terraform/configuration/providers/in_memory.rb +4 -1
- data/lib/rspec/terraform/configuration/providers/seed.rb +39 -0
- data/lib/rspec/terraform/configuration/providers.rb +2 -0
- data/lib/rspec/terraform/configuration.rb +6 -2
- data/lib/rspec/terraform/version.rb +1 -1
- data/rspec-terraform.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b023d70b2108c48cd8043ce090e91a5232d32df7cef1b14c0045bd29a5742196
|
4
|
+
data.tar.gz: c335a6a00992aa894ede64d821be06033727ae056182f475244d77e720b23b35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 922d9f5a1ca42a48a49cca3880d3bd3e36530bd0311d90e431a113c4eec359af133a7a5f1c24be311dd85d026584aeebf05f103ac88e6adf2ae021b2639a8648
|
7
|
+
data.tar.gz: e344912487fe48386df455ae61ef00d9e22075211f6317f7b45ccbb4905938811187394daac4ec04800f9b9934dc3bbb06c8755f523a9a44e4c620e825a1d28d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-terraform (0.1.0.pre.
|
4
|
+
rspec-terraform (0.1.0.pre.30)
|
5
|
+
confidante (>= 0.27)
|
5
6
|
rspec (>= 3.0)
|
6
7
|
ruby-terraform (= 1.7.0.pre.15)
|
7
8
|
|
@@ -19,8 +20,15 @@ GEM
|
|
19
20
|
coderay (1.1.3)
|
20
21
|
colored2 (3.1.2)
|
21
22
|
concurrent-ruby (1.1.10)
|
23
|
+
confidante (0.27.0)
|
24
|
+
activesupport (>= 4)
|
25
|
+
hiera (~> 3.3, >= 3.3.1)
|
26
|
+
shikashi (~> 0.6)
|
22
27
|
diff-lcs (1.5.0)
|
23
28
|
docile (1.4.0)
|
29
|
+
evalhook (0.6.0)
|
30
|
+
partialruby (~> 0.3)
|
31
|
+
sexp_processor (~> 4.0)
|
24
32
|
excon (0.92.4)
|
25
33
|
faker (2.22.0)
|
26
34
|
i18n (>= 1.8.11, < 2)
|
@@ -31,6 +39,7 @@ GEM
|
|
31
39
|
ffi (1.15.5)
|
32
40
|
formatador (1.1.0)
|
33
41
|
gem-release (2.2.2)
|
42
|
+
getsource (0.2.2)
|
34
43
|
guard (2.18.0)
|
35
44
|
formatador (>= 0.2.4)
|
36
45
|
listen (>= 2.7, < 4.0)
|
@@ -50,6 +59,7 @@ GEM
|
|
50
59
|
rubocop (< 2.0)
|
51
60
|
hamster (3.0.0)
|
52
61
|
concurrent-ruby (~> 1.0)
|
62
|
+
hiera (3.10.0)
|
53
63
|
i18n (1.12.0)
|
54
64
|
concurrent-ruby (~> 1.0)
|
55
65
|
immutable-struct (2.4.1)
|
@@ -74,6 +84,9 @@ GEM
|
|
74
84
|
parallel (1.22.1)
|
75
85
|
parser (3.1.2.1)
|
76
86
|
ast (~> 2.4.1)
|
87
|
+
partialruby (0.3.0)
|
88
|
+
ruby2ruby (~> 2)
|
89
|
+
ruby_parser (~> 3)
|
77
90
|
pry (0.14.1)
|
78
91
|
coderay (~> 1.1)
|
79
92
|
method_source (~> 1.0)
|
@@ -139,12 +152,21 @@ GEM
|
|
139
152
|
immutable-struct (~> 2.4)
|
140
153
|
lino (~> 3.0)
|
141
154
|
ruby2_keywords (0.0.5)
|
155
|
+
ruby2ruby (2.4.4)
|
156
|
+
ruby_parser (~> 3.1)
|
157
|
+
sexp_processor (~> 4.6)
|
142
158
|
ruby_gpg2 (0.8.0)
|
143
159
|
lino (>= 1.5)
|
160
|
+
ruby_parser (3.19.1)
|
161
|
+
sexp_processor (~> 4.16)
|
144
162
|
sawyer (0.9.2)
|
145
163
|
addressable (>= 2.3.5)
|
146
164
|
faraday (>= 0.17.3, < 3)
|
165
|
+
sexp_processor (4.16.1)
|
147
166
|
shellany (0.0.1)
|
167
|
+
shikashi (0.6.0)
|
168
|
+
evalhook (>= 0.6.0)
|
169
|
+
getsource (>= 0.1.0)
|
148
170
|
simplecov (0.21.2)
|
149
171
|
docile (~> 1.1)
|
150
172
|
simplecov-html (~> 0.11)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'confidante'
|
4
|
+
require 'ruby_terraform'
|
5
|
+
|
6
|
+
require_relative './base'
|
7
|
+
require_relative '../merger'
|
8
|
+
|
9
|
+
module RSpec
|
10
|
+
module Terraform
|
11
|
+
module Configuration
|
12
|
+
module Providers
|
13
|
+
class Confidante < Base
|
14
|
+
attr_reader(
|
15
|
+
:parameters,
|
16
|
+
:scope_selector,
|
17
|
+
:overrides_selector,
|
18
|
+
:configuration,
|
19
|
+
:merger
|
20
|
+
)
|
21
|
+
|
22
|
+
def initialize(opts = {})
|
23
|
+
super()
|
24
|
+
@parameters = opts[:parameters] || []
|
25
|
+
@scope_selector = opts[:scope_selector] || ->(o) { o }
|
26
|
+
@overrides_selector = opts[:overrides_selector] || ->(o) { o }
|
27
|
+
@configuration = ::Confidante.configuration
|
28
|
+
@merger = opts[:merger] || Merger.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def resolve(overrides = {})
|
32
|
+
resolved_configuration =
|
33
|
+
configuration
|
34
|
+
.for_scope(scope_selector.call(overrides))
|
35
|
+
.for_overrides(overrides_selector.call(overrides))
|
36
|
+
result = parameters.inject({}) do |acc, parameter|
|
37
|
+
value = resolved_configuration.send(parameter)
|
38
|
+
value.nil? ? acc : acc.merge(parameter => value)
|
39
|
+
end
|
40
|
+
merger.merge(result, overrides)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ruby_terraform'
|
4
|
+
|
5
|
+
require_relative './base'
|
4
6
|
require_relative '../merger'
|
5
7
|
|
6
8
|
module RSpec
|
7
9
|
module Terraform
|
8
10
|
module Configuration
|
9
11
|
module Providers
|
10
|
-
class InMemory
|
12
|
+
class InMemory < Base
|
11
13
|
attr_reader(:configuration)
|
12
14
|
|
13
15
|
def initialize(configuration = {})
|
16
|
+
super()
|
14
17
|
@configuration = configuration
|
15
18
|
@merger = Merger.new
|
16
19
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ruby_terraform'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
require_relative './base'
|
7
|
+
|
8
|
+
module RSpec
|
9
|
+
module Terraform
|
10
|
+
module Configuration
|
11
|
+
module Providers
|
12
|
+
class Seed < Base
|
13
|
+
attr_reader(:generator, :merger)
|
14
|
+
|
15
|
+
def initialize(opts = {})
|
16
|
+
super()
|
17
|
+
@generator =
|
18
|
+
opts[:generator] || -> { SecureRandom.alphanumeric(10) }
|
19
|
+
@merger = opts[:merger] || Merger.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def resolve(overrides = {})
|
23
|
+
merger.merge({ seed: seed }, overrides)
|
24
|
+
end
|
25
|
+
|
26
|
+
def reset
|
27
|
+
@seed = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def seed
|
33
|
+
@seed ||= generator.call
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -12,8 +12,12 @@ module RSpec
|
|
12
12
|
Providers::Identity.new
|
13
13
|
end
|
14
14
|
|
15
|
-
def in_memory_provider(
|
16
|
-
Providers::InMemory.new(
|
15
|
+
def in_memory_provider(opts)
|
16
|
+
Providers::InMemory.new(opts)
|
17
|
+
end
|
18
|
+
|
19
|
+
def confidante_provider(opts)
|
20
|
+
Providers::Confidante.new(opts)
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
data/rspec-terraform.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: confidante
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.27'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.27'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,8 +296,11 @@ files:
|
|
282
296
|
- lib/rspec/terraform/configuration.rb
|
283
297
|
- lib/rspec/terraform/configuration/merger.rb
|
284
298
|
- lib/rspec/terraform/configuration/providers.rb
|
299
|
+
- lib/rspec/terraform/configuration/providers/base.rb
|
300
|
+
- lib/rspec/terraform/configuration/providers/confidante.rb
|
285
301
|
- lib/rspec/terraform/configuration/providers/identity.rb
|
286
302
|
- lib/rspec/terraform/configuration/providers/in_memory.rb
|
303
|
+
- lib/rspec/terraform/configuration/providers/seed.rb
|
287
304
|
- lib/rspec/terraform/configuration/var_captor.rb
|
288
305
|
- lib/rspec/terraform/helpers.rb
|
289
306
|
- lib/rspec/terraform/helpers/apply.rb
|