kitchen-goss 0.0.2 → 0.1.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
  SHA1:
3
- metadata.gz: ee7f23ceef71d0c2ef396aa1abe84a6d17f51743
4
- data.tar.gz: 34db15db68c3a9e824b2a3f11e55bc31e3c4c409
3
+ metadata.gz: ce5f8c25a4185a67fa5fe0c3199fc0379f7ca216
4
+ data.tar.gz: b9708046daabc4f8f998a25f8d725ce32758dc43
5
5
  SHA512:
6
- metadata.gz: dbdad7e7d29537f88bd1c1079304dd0bbaf9c58e3c392edad362396314207f27c9da7cbb259a37e7c343627b7fd76f6f890704e7b4b6ff5d66bcfabce44c2be3
7
- data.tar.gz: 8ab394d7a74296e8aa7c117e126c8cf2c3b7e34c50b4398a377a0241a1a275ad8afe26d9cad0b2c49a01f277a758a2309f6be012971880a876ed077073b94e8f
6
+ metadata.gz: 11e19b6cca2daf32e7c8dc9410443005626823f71eb7f887a55f416cae13cca993f9de454b81213331c29d06e2b27997e2df38f6ee65e54f40a800a928b900cd
7
+ data.tar.gz: e7455947e4ef10287cd8cb120e434e3071f31c20b03e8623ac0b0c1d0b5cc5082ab993db59dcc770546412a2d6e905510f9fac44d888ff18b642769d6a473558
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # kitchen-goss
2
- A test-kitchen verifier plugin for GOSS
2
+ [![Gem Version](https://badge.fury.io/rb/kitchen-goss.svg)](https://badge.fury.io/rb/kitchen-goss)
3
+ [![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/kitchen-goss?type=total&color=brightgreen)](https://rubygems.org/gems/kitchen-goss)
4
+
5
+ A test-kitchen verifier plugin for GOSS
3
6
 
4
7
  ## Intro
5
- [GOSS](https://github.com/aelsabbahy/goss.git) is a tool for validating a server's configuration.
6
- This kitchen plugin adds Goss support as a validation to kitchen.
8
+ [GOSS](https://github.com/aelsabbahy/goss.git) is a tool for validating a server's configuration.
9
+ This kitchen plugin adds Goss support as a validation to kitchen. Since GOSS is written in GO lang. This plugin use sftp to push tests to remote machines no ruby is needed to run verify.
10
+
7
11
 
8
- ## How to install
12
+ ## How to install
9
13
 
10
14
  ### Ruby gem
11
15
  ```
@@ -13,7 +17,7 @@ gem install kitchen-goss
13
17
  ```
14
18
 
15
19
  ### To install from code or develop
16
- ```
20
+ ```
17
21
  git clone git@github.com:ahelal/kitchen-goss.git
18
22
  cd kitchen-goss
19
23
  gem build kitchen-goss.gemspec
@@ -31,6 +35,8 @@ Besides the normal config in kitchen.yml goss validation can accept the followin
31
35
 
32
36
  ```ruby
33
37
  default_config :sleep, 0
38
+ default_config :use_sudo, false
39
+ default_config :env_vars, {}
34
40
  default_config :goss_version, "v0.1.5"
35
41
  default_config :validate_output, "documentation"
36
42
  default_config :custom_install_command, nil
@@ -39,8 +45,10 @@ default_config :goss_download_path, "/tmp/goss-${VERSION}-${DISTRO}-${ARCH}"
39
45
  ```
40
46
 
41
47
  ## Test structure
42
- Lets say you have a suite name **simple**
43
- the following structure we be required.
48
+
49
+ Lets say you have a suite name **simple** all yaml files will be uses for testing.
50
+
51
+
44
52
  ```bash
45
53
  .kitchen.yml
46
54
  test/
@@ -52,6 +60,6 @@ test/
52
60
  ```
53
61
 
54
62
 
55
- ##License
63
+ ## License
56
64
 
57
65
  MIT
@@ -12,6 +12,8 @@ module Kitchen
12
12
 
13
13
  #
14
14
  default_config :sleep, 0
15
+ default_config :use_sudo, false
16
+ default_config :env_vars, {}
15
17
  default_config :goss_version, "v0.1.5"
16
18
  default_config :validate_output, "documentation"
17
19
  default_config :custom_install_command, nil
@@ -31,7 +33,7 @@ module Kitchen
31
33
  #{goss_filename_flags}
32
34
  download_url="#{config[:goss_link]}"
33
35
  goss_download_path="#{config[:goss_download_path]}"
34
-
36
+
35
37
  ## Check do we need to download GOSS
36
38
  if [ -f "/${goss_download_path}" ]; then
37
39
  echo "GOSS is installed in ${goss_download_path}"
@@ -144,9 +146,18 @@ module Kitchen
144
146
  File.join(sandbox_path, "suites")
145
147
  end
146
148
 
149
+ def env_vars
150
+ return nil if config[:env_vars].none?
151
+ config[:env_vars].map { |k, v| "#{k}=#{v}" }.join(' ')
152
+ end
153
+
147
154
  # @return [String] the run command to execute tests
148
155
  # @api private
149
156
  def run_test_command
157
+ command = config[:goss_download_path]
158
+ command = "sudo -E #{command}" if !config[:use_sudo] == true
159
+ command = "#{env_vars} #{command}" if !config[:env_vars].none?
160
+
150
161
  <<-CMD
151
162
  if [ ! -x "#{config[:goss_download_path]}" ]; then
152
163
  echo "Something failed cant execute '${command}'"
@@ -156,7 +167,7 @@ module Kitchen
156
167
  test_failed=0
157
168
  for VARIABLE in #{get_test_name}
158
169
  do
159
- #{config[:goss_download_path]} -g ${VARIABLE} ${command_validate_opts}
170
+ #{command} -g ${VARIABLE} ${command_validate_opts}
160
171
  if [ "$?" -ne 0 ]; then
161
172
  test_failed=1
162
173
  fi
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kitchen
4
4
  module Verifier
5
- GOSS_VERSION = '0.0.2'
5
+ GOSS_VERSION = '0.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-goss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adham Helal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: "== DESCRIPTION:\n\nGOSS is a tool for validating a server's configuration.
@@ -74,17 +74,17 @@ require_paths:
74
74
  - lib
75
75
  required_ruby_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubyforge_project: '[none]'
87
- rubygems_version: 2.0.14.1
86
+ rubyforge_project: "[none]"
87
+ rubygems_version: 2.5.2
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: A test-kitchen verifier plugin for GOSS