@@ -4,7 +4,7 @@ module Kitchen
44 module Verifier
55 class Goss < Kitchen ::Verifier ::Base
66 require 'mixlib/shellout'
7- require " kitchen/util"
7+ require ' kitchen/util'
88 require 'pathname'
99
1010 kitchen_verifier_api_version 1
@@ -14,11 +14,11 @@ class Goss < Kitchen::Verifier::Base
1414 default_config :sleep , 0
1515 default_config :use_sudo , false
1616 default_config :env_vars , { }
17- default_config :goss_version , " v0.1.5"
18- default_config :validate_output , " documentation"
17+ default_config :goss_version , ' v0.3.6'
18+ default_config :validate_output , ' documentation'
1919 default_config :custom_install_command , nil
20- default_config :goss_link , " https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-${DISTRO}-${ARCH}"
21- default_config :goss_download_path , " /tmp/goss-${VERSION}-${DISTRO}-${ARCH}"
20+ default_config :goss_link , ' https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-${DISTRO}-${ARCH}'
21+ default_config :goss_download_path , ' /tmp/goss-${VERSION}-${DISTRO}-${ARCH}'
2222 default_config :goss_var_path , nil
2323
2424 def install_command
@@ -55,7 +55,7 @@ def install_command
5555 # (see Base#init_command)
5656 def init_command
5757 return if local_suite_files . empty?
58- debug ( " Remove root_path on remote server." )
58+ debug ( ' Remove root_path on remote server.' )
5959 <<-CMD
6060 suite_dir="#{ config [ :root_path ] } "
6161 if [ "${suite_dir}" = "x" ]; then
@@ -75,19 +75,19 @@ def init_command
7575 # @raise [ActionFailed] if the action could not be completed
7676 def call ( state )
7777 create_sandbox
78- sandbox_dirs = Dir . glob ( File . join ( sandbox_path , "*" ) )
78+ sandbox_dirs = Dir . glob ( File . join ( sandbox_path , '*' ) )
7979
8080 instance . transport . connection ( state ) do |conn |
8181 conn . execute ( install_command )
8282 conn . execute ( init_command )
8383 info ( "Transferring files to #{ instance . to_str } " )
8484 conn . upload ( sandbox_dirs , config [ :root_path ] )
85- debug ( " Transfer complete" )
85+ debug ( ' Transfer complete' )
8686 conn . execute ( prepare_command )
8787 conn . execute ( run_command )
8888 end
8989 rescue Kitchen ::Transport ::TransportFailed => ex
90- if ex . message . include? " <TEST EXECUTION FAILED>"
90+ if ex . message . include? ' <TEST EXECUTION FAILED>'
9191 raise ActionFailed , "Action #verify failed for #{ instance . to_str } ."
9292 else
9393 raise ActionFailed , ex . message
@@ -100,7 +100,7 @@ def call(state)
100100 def run_command
101101 return if local_suite_files . empty?
102102
103- debug ( " Running tests" )
103+ debug ( ' Running tests' )
104104 prefix_command ( wrap_shell_code ( Util . outdent! ( <<-CMD ) ) )
105105 set +e
106106 #{ goss_filename_flags }
@@ -116,9 +116,9 @@ def prepare_suites
116116 base = File . join ( config [ :test_base_path ] , config [ :suite_name ] )
117117
118118 local_suite_files . each do |src |
119- dest = File . join ( sandbox_suites_dir , src . sub ( "#{ base } /" , "" ) )
119+ dest = File . join ( sandbox_suites_dir , src . sub ( "#{ base } /" , '' ) )
120120 FileUtils . mkdir_p ( File . dirname ( dest ) )
121- FileUtils . cp ( src , dest , : preserve => true )
121+ FileUtils . cp ( src , dest , preserve : true )
122122 end
123123 end
124124
@@ -130,8 +130,8 @@ def prepare_suites
130130 # @api private
131131 def local_suite_files
132132 base = File . join ( config [ :test_base_path ] , config [ :suite_name ] )
133- glob = File . join ( base , " goss/**/*" )
134- #testfiles = Dir.glob(glob).reject { |f| File.directory?(f) }
133+ glob = File . join ( base , ' goss/**/*' )
134+ # testfiles = Dir.glob(glob).reject { |f| File.directory?(f) }
135135 Dir . glob ( glob ) . reject { |f | File . directory? ( f ) }
136136 end
137137
@@ -144,7 +144,7 @@ def create_sandbox
144144 # @return [String] path to suites directory under sandbox path
145145 # @api private
146146 def sandbox_suites_dir
147- File . join ( sandbox_path , " suites" )
147+ File . join ( sandbox_path , ' suites' )
148148 end
149149
150150 def env_vars
@@ -154,7 +154,7 @@ def env_vars
154154
155155 def remote_var_file
156156 base_path = File . join ( config [ :test_base_path ] , config [ :suite_name ] )
157- remote_base_path = File . join ( config [ :root_path ] , " suites" )
157+ remote_base_path = File . join ( config [ :root_path ] , ' suites' )
158158 result = ''
159159 local_suite_files . each do |src |
160160 if File . basename ( src ) == config [ :goss_var_path ]
@@ -169,7 +169,7 @@ def remote_var_file
169169 def run_test_command
170170 command = config [ :goss_download_path ]
171171 command = "sudo -E #{ command } " if !config [ :use_sudo ] == true
172- command = "#{ env_vars } #{ command } " if ! config [ :env_vars ] . none ?
172+ command = "#{ env_vars } #{ command } " if config [ :env_vars ] . any ?
173173 command = "#{ command } --vars #{ remote_var_file } " if config [ :goss_var_path ]
174174 puts command
175175
@@ -198,7 +198,7 @@ def run_test_command
198198 end
199199
200200 def goss_filename_flags
201- <<-CMD
201+ <<-CMD
202202 ## Set the flags for GOSS command path
203203 VERSION="#{ config [ :goss_version ] } "
204204 DISTRO="$(uname)"
@@ -235,11 +235,11 @@ def goss_filename_flags
235235
236236 def get_test_name
237237 base_path = File . join ( config [ :test_base_path ] , config [ :suite_name ] )
238- remote_base_path = File . join ( config [ :root_path ] , " suites" )
239- all_tests = ""
238+ remote_base_path = File . join ( config [ :root_path ] , ' suites' )
239+ all_tests = ''
240240 local_suite_files . each do |test_file |
241- if File . basename ( test_file ) != config [ :goss_var_path ] and File . basename ( test_file ) . end_with? ( " .yml" )
242- all_tests += " " + test_file . sub ( base_path , remote_base_path )
241+ if File . basename ( test_file ) != config [ :goss_var_path ] && File . basename ( test_file ) . end_with? ( ' .yml' )
242+ all_tests += ' ' + test_file . sub ( base_path , remote_base_path )
243243 end
244244 end
245245 all_tests
@@ -254,7 +254,6 @@ def sleep_if_set
254254 sleep 1
255255 end
256256 end
257-
258257 end
259258 end
260- end
259+ end
0 commit comments