spectre-core 1.8.0 → 1.8.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
- data/exe/spectre +6 -6
- data/lib/spectre.rb +1 -1
- data/lib/spectre/curl.rb +2 -2
- data/lib/spectre/database/postgres.rb +1 -1
- data/lib/spectre/ftp.rb +5 -5
- data/lib/spectre/http.rb +3 -3
- data/lib/spectre/http/basic_auth.rb +2 -2
- data/lib/spectre/http/keystone.rb +3 -3
- data/lib/spectre/logger/console.rb +1 -1
- data/lib/spectre/logger/file.rb +1 -1
- data/lib/spectre/mixin.rb +2 -2
- data/lib/spectre/mysql.rb +3 -3
- data/lib/spectre/resources.rb +2 -2
- data/lib/spectre/ssh.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc992f089d223d10e25ed3ab390e2fa2b3ea826b24c3943bf60ea04992d14163
|
4
|
+
data.tar.gz: c95f4a37b887bef1d79fe22f221ddd35957e259d03d3e1c2513b973d3c54f564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7e9166af9137aab37688aa5a1a975296765d903c53e4547a7e1e74de8347cd4ce6e0860a0fd23dd494cc90fd8baafced1fff3381ecd99316159189f80a44629
|
7
|
+
data.tar.gz: d762e949fdffe4b5faac4a35192eb2ca130a8799f714667eb10b2e09550ccbff13047581f72e5753e3262b4771f4a4bc65aa46e58615ad6d0e894c9c63f9e0d2
|
data/exe/spectre
CHANGED
@@ -102,7 +102,7 @@ Specific options:}
|
|
102
102
|
cmd_options['specs'] = specs
|
103
103
|
end
|
104
104
|
|
105
|
-
opts.on('-t TAG,TAG', '--tags TAG,TAG', Array, 'Run only specs with
|
105
|
+
opts.on('-t TAG,TAG', '--tags TAG,TAG', Array, 'Run only specs with given tags') do |tags|
|
106
106
|
cmd_options['tags'] = tags
|
107
107
|
end
|
108
108
|
|
@@ -130,8 +130,8 @@ Specific options:}
|
|
130
130
|
cmd_options['out_path'] = path
|
131
131
|
end
|
132
132
|
|
133
|
-
opts.on('-r NAME', '--reporter NAME', "
|
134
|
-
cmd_options['
|
133
|
+
opts.on('-r NAME', '--reporter NAME', Array, "A list of reporters to use") do |reporters|
|
134
|
+
cmd_options['reporters'] = reporters
|
135
135
|
end
|
136
136
|
|
137
137
|
opts.on('-d', '--debug', "Run in debug mode") do
|
@@ -147,7 +147,7 @@ Specific options:}
|
|
147
147
|
|
148
148
|
curr_opt = cmd_options
|
149
149
|
(key.split '.').each do |k|
|
150
|
-
curr_opt[k] = {} if not curr_opt.
|
150
|
+
curr_opt[k] = {} if not curr_opt.key? k
|
151
151
|
end
|
152
152
|
curr_opt = val
|
153
153
|
|
@@ -208,7 +208,7 @@ cfg['env_patterns'].each do |pattern|
|
|
208
208
|
spec_env = YAML.load_file(f)
|
209
209
|
name = spec_env.delete('name') || 'default'
|
210
210
|
|
211
|
-
if envs.
|
211
|
+
if envs.key? name
|
212
212
|
existing_env_file = read_env_files[name]
|
213
213
|
puts "Duplicate environment definition detected with name #{name} in '#{f}'. Previously defined in '#{existing_env_file}'"
|
214
214
|
exit 1
|
@@ -224,7 +224,7 @@ cfg['env_partial_patterns'].each do |pattern|
|
|
224
224
|
Dir.glob(pattern).each do|f|
|
225
225
|
partial_env = YAML.load_file(f)
|
226
226
|
name = partial_env.delete('name') || 'default'
|
227
|
-
next if not envs.
|
227
|
+
next if not envs.key? name
|
228
228
|
|
229
229
|
envs[name].deep_merge! partial_env
|
230
230
|
end
|
data/lib/spectre.rb
CHANGED
data/lib/spectre/curl.rb
CHANGED
@@ -159,7 +159,7 @@ module Spectre::Curl
|
|
159
159
|
'use_ssl' => secure,
|
160
160
|
}
|
161
161
|
|
162
|
-
if @@http_cfg.
|
162
|
+
if @@http_cfg.key? name
|
163
163
|
req.merge! @@http_cfg[name]
|
164
164
|
raise "No `base_url' set for HTTP client '#{name}'. Check your HTTP config in your environment." if !req['base_url']
|
165
165
|
else
|
@@ -355,7 +355,7 @@ module Spectre::Curl
|
|
355
355
|
|
356
356
|
@@curl_path = config['curl_path'] || 'curl'
|
357
357
|
|
358
|
-
if config.
|
358
|
+
if config.key? 'http'
|
359
359
|
@@http_cfg = {}
|
360
360
|
|
361
361
|
config['http'].each do |name, cfg|
|
@@ -31,7 +31,7 @@ module Spectre
|
|
31
31
|
|
32
32
|
class << self
|
33
33
|
def postgres name, &block
|
34
|
-
raise "postgres '#{name}' not configured" unless @@db_cfg.
|
34
|
+
raise "postgres '#{name}' not configured" unless @@db_cfg.key? name
|
35
35
|
|
36
36
|
statement = SQLStatement.new
|
37
37
|
statement.instance_eval &block
|
data/lib/spectre/ftp.rb
CHANGED
@@ -128,7 +128,7 @@ module Spectre
|
|
128
128
|
|
129
129
|
class << self
|
130
130
|
def ftp name, config={}, &block
|
131
|
-
raise "FTP connection '#{name}' not configured" unless @@cfg.
|
131
|
+
raise "FTP connection '#{name}' not configured" unless @@cfg.key?(name) or config.count > 0
|
132
132
|
cfg = @@cfg[name] || {}
|
133
133
|
|
134
134
|
host = config[:host] || cfg['host'] || name
|
@@ -151,7 +151,7 @@ module Spectre
|
|
151
151
|
end
|
152
152
|
|
153
153
|
def sftp name, config={}, &block
|
154
|
-
raise "FTP connection '#{name}' not configured" unless @@cfg.
|
154
|
+
raise "FTP connection '#{name}' not configured" unless @@cfg.key?(name) or config.count > 0
|
155
155
|
|
156
156
|
cfg = @@cfg[name] || {}
|
157
157
|
|
@@ -162,8 +162,8 @@ module Spectre
|
|
162
162
|
opts = {}
|
163
163
|
opts[:password] = password
|
164
164
|
opts[:port] = config[:port] || cfg['port'] || 22
|
165
|
-
opts[:keys] = [cfg['key']] if cfg.
|
166
|
-
opts[:passphrase] = cfg['passphrase'] if cfg.
|
165
|
+
opts[:keys] = [cfg['key']] if cfg.key? 'key'
|
166
|
+
opts[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
|
167
167
|
|
168
168
|
opts[:auth_methods] = []
|
169
169
|
opts[:auth_methods].push 'publickey' if opts[:keys]
|
@@ -182,7 +182,7 @@ module Spectre
|
|
182
182
|
Spectre.register do |config|
|
183
183
|
@@logger = ::Logger.new config['log_file'], progname: 'spectre/ftp'
|
184
184
|
|
185
|
-
if config.
|
185
|
+
if config.key? 'ftp'
|
186
186
|
|
187
187
|
config['ftp'].each do |name, cfg|
|
188
188
|
@@cfg[name] = cfg
|
data/lib/spectre/http.rb
CHANGED
@@ -174,7 +174,7 @@ module Spectre
|
|
174
174
|
def http name, secure: nil, &block
|
175
175
|
req = {}
|
176
176
|
|
177
|
-
if @@http_cfg.
|
177
|
+
if @@http_cfg.key? name
|
178
178
|
req.merge! @@http_cfg[name]
|
179
179
|
raise "No `base_url' set for HTTP client '#{name}'. Check your HTTP config in your environment." if !req['base_url']
|
180
180
|
else
|
@@ -254,7 +254,7 @@ module Spectre
|
|
254
254
|
if uri.scheme == 'https'
|
255
255
|
net_http.use_ssl = true
|
256
256
|
|
257
|
-
if req.
|
257
|
+
if req.key? 'cert'
|
258
258
|
raise "Certificate '#{req['cert']}' does not exist" unless File.exists? req['cert']
|
259
259
|
net_http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
260
260
|
net_http.ca_file = req['cert']
|
@@ -329,7 +329,7 @@ module Spectre
|
|
329
329
|
Spectre.register do |config|
|
330
330
|
@@logger = ::Logger.new config['log_file'], progname: 'spectre/http'
|
331
331
|
|
332
|
-
if config.
|
332
|
+
if config.key? 'http'
|
333
333
|
@@http_cfg = {}
|
334
334
|
|
335
335
|
config['http'].each do |name, cfg|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spectre::Http
|
2
2
|
class SpectreHttpRequest
|
3
3
|
def basic_auth username, password
|
4
|
-
@__req['basic_auth'] = {} if not @__req.
|
4
|
+
@__req['basic_auth'] = {} if not @__req.key? 'basic_auth'
|
5
5
|
|
6
6
|
@__req['basic_auth']['username'] = username
|
7
7
|
@__req['basic_auth']['password'] = password
|
@@ -12,7 +12,7 @@ module Spectre::Http
|
|
12
12
|
|
13
13
|
module BasicAuth
|
14
14
|
def self.on_req http, net_req, req
|
15
|
-
return unless req.
|
15
|
+
return unless req.key? 'basic_auth' and req['auth'] == 'basic_auth'
|
16
16
|
basic_auth_cfg = req['basic_auth']
|
17
17
|
net_req.basic_auth(basic_auth_cfg['username'], basic_auth_cfg['password'])
|
18
18
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class HttpRequest
|
2
2
|
def keystone url, username, password, project, domain, cert
|
3
|
-
@__req['keystone'] = {} if not @__req.
|
3
|
+
@__req['keystone'] = {} if not @__req.key? 'keystone'
|
4
4
|
|
5
5
|
@__req['keystone']['url'] = url
|
6
6
|
@__req['keystone']['username'] = username
|
@@ -18,11 +18,11 @@ module Spectre::Http::Keystone
|
|
18
18
|
@@cache = {}
|
19
19
|
|
20
20
|
def self.on_req http, net_req, req
|
21
|
-
return unless req.
|
21
|
+
return unless req.key? 'keystone' and req['auth'] == 'keystone'
|
22
22
|
|
23
23
|
keystone_cfg = req['keystone']
|
24
24
|
|
25
|
-
if @@cache.
|
25
|
+
if @@cache.key? keystone_cfg
|
26
26
|
token = @@cache[keystone_cfg]
|
27
27
|
else
|
28
28
|
token, _ = authenticate(
|
@@ -4,7 +4,7 @@ module Spectre
|
|
4
4
|
module Logger
|
5
5
|
class Console
|
6
6
|
def initialize config
|
7
|
-
raise 'No log format section in config for console logger' unless config.
|
7
|
+
raise 'No log format section in config for console logger' unless config.key? 'log_format' and config['log_format'].key? 'console'
|
8
8
|
|
9
9
|
@config = config['log_format']['console']
|
10
10
|
@indent = @config['indent'] || 2
|
data/lib/spectre/logger/file.rb
CHANGED
@@ -2,7 +2,7 @@ module Spectre
|
|
2
2
|
module Logger
|
3
3
|
class File
|
4
4
|
def initialize config
|
5
|
-
raise 'No log format section in config for console logger' unless config.
|
5
|
+
raise 'No log format section in config for console logger' unless config.key? 'log_format' and config['log_format'].key? 'file'
|
6
6
|
|
7
7
|
@config = config['log_format']['file']
|
8
8
|
@fmt_start_group = @config['start_group']
|
data/lib/spectre/mixin.rb
CHANGED
@@ -10,7 +10,7 @@ module Spectre
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def run desc, with: []
|
13
|
-
raise "no mixin with desc '#{desc}' defined" unless @@mixins.
|
13
|
+
raise "no mixin with desc '#{desc}' defined" unless @@mixins.key? desc
|
14
14
|
Logger.log_debug "running mixin '#{desc}'"
|
15
15
|
|
16
16
|
if with.is_a? Array
|
@@ -25,7 +25,7 @@ module Spectre
|
|
25
25
|
end
|
26
26
|
|
27
27
|
Spectre.register do |config|
|
28
|
-
if not config.
|
28
|
+
if not config.key? 'mixin_patterns'
|
29
29
|
return
|
30
30
|
end
|
31
31
|
|
data/lib/spectre/mysql.rb
CHANGED
@@ -25,7 +25,7 @@ module Spectre
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def query statement
|
28
|
-
@__query['query'] = [] if not @__query.
|
28
|
+
@__query['query'] = [] if not @__query.key? 'query'
|
29
29
|
@__query['query'].append(statement)
|
30
30
|
end
|
31
31
|
end
|
@@ -38,7 +38,7 @@ module Spectre
|
|
38
38
|
def mysql name = nil, &block
|
39
39
|
query = {}
|
40
40
|
|
41
|
-
if name != nil and @@mysql_cfg.
|
41
|
+
if name != nil and @@mysql_cfg.key? name
|
42
42
|
query.merge! @@mysql_cfg[name]
|
43
43
|
raise "No `host' set for MySQL client '#{name}'. Check your MySQL config in your environment." if !query['host']
|
44
44
|
elsif name != nil
|
@@ -83,7 +83,7 @@ module Spectre
|
|
83
83
|
Spectre.register do |config|
|
84
84
|
@@logger = ::Logger.new config['log_file'], progname: 'spectre/mysql'
|
85
85
|
|
86
|
-
if config.
|
86
|
+
if config.key? 'mysql'
|
87
87
|
@@mysql_cfg = {}
|
88
88
|
|
89
89
|
config['mysql'].each do |name, cfg|
|
data/lib/spectre/resources.rb
CHANGED
@@ -12,7 +12,7 @@ module Spectre
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def [] name
|
15
|
-
raise "Resource with name '#{name}' does not exist" if not @items.
|
15
|
+
raise "Resource with name '#{name}' does not exist" if not @items.key? name
|
16
16
|
@items[name]
|
17
17
|
end
|
18
18
|
end
|
@@ -26,7 +26,7 @@ module Spectre
|
|
26
26
|
end
|
27
27
|
|
28
28
|
Spectre.register do |config|
|
29
|
-
return if !config.
|
29
|
+
return if !config.key? 'resource_paths'
|
30
30
|
|
31
31
|
config['resource_paths'].each do |resource_path|
|
32
32
|
resource_files = Dir.glob File.join(resource_path, '**/*')
|
data/lib/spectre/ssh.rb
CHANGED
@@ -106,7 +106,7 @@ module Spectre
|
|
106
106
|
|
107
107
|
class << self
|
108
108
|
def ssh name, config = {}, &block
|
109
|
-
raise "SSH connection '#{name}' not configured" unless @@cfg.
|
109
|
+
raise "SSH connection '#{name}' not configured" unless @@cfg.key?(name) or config.count > 0
|
110
110
|
|
111
111
|
cfg = @@cfg[name] || {}
|
112
112
|
|
@@ -117,8 +117,8 @@ module Spectre
|
|
117
117
|
opts = {}
|
118
118
|
opts[:password] = password
|
119
119
|
opts[:port] = config[:port] || cfg['port'] || 22
|
120
|
-
opts[:keys] = [cfg['key']] if cfg.
|
121
|
-
opts[:passphrase] = cfg['passphrase'] if cfg.
|
120
|
+
opts[:keys] = [cfg['key']] if cfg.key? 'key'
|
121
|
+
opts[:passphrase] = cfg['passphrase'] if cfg.key? 'passphrase'
|
122
122
|
|
123
123
|
opts[:auth_methods] = []
|
124
124
|
opts[:auth_methods].push 'publickey' if opts[:keys]
|
@@ -137,7 +137,7 @@ module Spectre
|
|
137
137
|
Spectre.register do |config|
|
138
138
|
@@logger = ::Logger.new config['log_file'], progname: 'spectre/ssh'
|
139
139
|
|
140
|
-
if config.
|
140
|
+
if config.key? 'ssh'
|
141
141
|
config['ssh'].each do |name, cfg|
|
142
142
|
@@cfg[name] = cfg
|
143
143
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectre-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Neubauer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ectoplasm
|