voxpupuli-acceptance 3.3.0 → 3.4.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed2d3f327132608845f5b0553c0759b2852a9b9a9f08058489c2ee1ce193a14
|
4
|
+
data.tar.gz: f13c02206e5b728161840a71e48b9ab06227338b27bfa146502808a198421266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29e23b6893631c7a4e08cca6096bf5e810a0998c2be2931cfdbb3ea5e28a3dcc66bdad50af311f73840bb286969906e594ad210d615f714578cc4efe1e55739
|
7
|
+
data.tar.gz: 7bcc52d34f2261362dbdeec11227265ed2a5a1d1935533db9f58ebc26142f7366218368f2596ad359f7f88d28396cc76b159c2a6fc4cee60773c393218db5383
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# written by https://github.com/ekohl
|
2
|
+
# https://github.com/mizzy/serverspec/pull/611 was rejected so adding it here.
|
3
|
+
|
4
|
+
require 'serverspec'
|
5
|
+
|
6
|
+
module Voxpupuli
|
7
|
+
module Acceptance
|
8
|
+
module ServerspecExtensions
|
9
|
+
class CurlCommand < Serverspec::Type::Command
|
10
|
+
def response_code
|
11
|
+
m = %r{Response-Code: (?<code>\d+)}.match(stderr)
|
12
|
+
return 0 unless m
|
13
|
+
|
14
|
+
m[:code].to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def body
|
18
|
+
command_result.stdout
|
19
|
+
end
|
20
|
+
|
21
|
+
def body_as_json
|
22
|
+
MultiJson.load(body)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def curl_command
|
28
|
+
# curl supports %{stderr} to --write-out since 7.63.0
|
29
|
+
# so the following doesn't work on EL8, which has curl 7.61.1
|
30
|
+
command = "curl --silent --write-out '%{stderr}Response-Code: %{response_code}\\n' '#{@name}'"
|
31
|
+
|
32
|
+
@options.each do |option, value|
|
33
|
+
case option
|
34
|
+
when :cacert, :cert, :key
|
35
|
+
command += " --#{option} '#{value}'"
|
36
|
+
when :headers
|
37
|
+
value.each do |header, header_value|
|
38
|
+
command += if header_value
|
39
|
+
" --header '#{header}: #{header_value}'"
|
40
|
+
else
|
41
|
+
" --header '#{header};'"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
else
|
45
|
+
raise "Unknown option #{option} (value: #{value})"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
command
|
50
|
+
end
|
51
|
+
|
52
|
+
def command_result
|
53
|
+
@command_result ||= @runner.run_command(curl_command)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voxpupuli-acceptance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt_pbkdf
|
@@ -255,6 +255,8 @@ files:
|
|
255
255
|
- lib/voxpupuli/acceptance/facts.rb
|
256
256
|
- lib/voxpupuli/acceptance/fixtures.rb
|
257
257
|
- lib/voxpupuli/acceptance/rake.rb
|
258
|
+
- lib/voxpupuli/acceptance/serverspec_extensions.rb
|
259
|
+
- lib/voxpupuli/acceptance/serverspec_extensions/curl_command.rb
|
258
260
|
- lib/voxpupuli/acceptance/spec_helper_acceptance.rb
|
259
261
|
homepage: https://github.com/voxpupuli/voxpupuli-acceptance
|
260
262
|
licenses:
|