voxpupuli-acceptance 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c4b7c689abbd0e3e7f9917b6c3d9e8170960d21ea09824943b39cbdfafe6b2c
4
- data.tar.gz: 3fa4edc58eb170887640969a32cd973f8419b6aac449c8c9be2aaca3b4d6728e
3
+ metadata.gz: 0ed2d3f327132608845f5b0553c0759b2852a9b9a9f08058489c2ee1ce193a14
4
+ data.tar.gz: f13c02206e5b728161840a71e48b9ab06227338b27bfa146502808a198421266
5
5
  SHA512:
6
- metadata.gz: 6b4f8d4504bd29c9bc520cbfbebc8447aad495df74832b3404128c9fecfe383c4c9ae4883f8203a62737520ed4019092d9a6465f181dc9a17abed3fbd251db74
7
- data.tar.gz: 2ab89e0a80b700057807e32f3ec4a54d5dc92776fc9c376d2fb2fceccea5f9d516be9ec15997f9a29350137175bf3e7047c3dc46153d71db1958f7393a9bb955
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
@@ -0,0 +1,12 @@
1
+ require 'serverspec'
2
+ require_relative 'serverspec_extensions/curl_command'
3
+
4
+ module Serverspec
5
+ module Helper
6
+ module Type
7
+ def curl_command(*args)
8
+ Voxpupuli::Acceptance::ServerspecExtensions::CurlCommand.new(*args)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative 'examples'
2
+ require_relative 'serverspec_extensions'
2
3
 
3
4
  def configure_beaker(modules: :metadata, &block)
4
5
  collection = ENV['BEAKER_PUPPET_COLLECTION'] || 'puppet'
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.3.0
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: 2024-12-19 00:00:00.000000000 Z
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: