Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelal committed May 9, 2019
1 parent b20381c commit 6bed75d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
47 changes: 23 additions & 24 deletions lib/kitchen/verifier/goss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Kitchen
module Verifier
class Goss < Kitchen::Verifier::Base
require 'mixlib/shellout'
require "kitchen/util"
require 'kitchen/util'
require 'pathname'

kitchen_verifier_api_version 1
Expand All @@ -14,11 +14,11 @@ class Goss < Kitchen::Verifier::Base
default_config :sleep, 0
default_config :use_sudo, false
default_config :env_vars, {}
default_config :goss_version, "v0.1.5"
default_config :validate_output, "documentation"
default_config :goss_version, 'v0.3.6'
default_config :validate_output, 'documentation'
default_config :custom_install_command, nil
default_config :goss_link, "https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-${DISTRO}-${ARCH}"
default_config :goss_download_path, "/tmp/goss-${VERSION}-${DISTRO}-${ARCH}"
default_config :goss_link, 'https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-${DISTRO}-${ARCH}'
default_config :goss_download_path, '/tmp/goss-${VERSION}-${DISTRO}-${ARCH}'
default_config :goss_var_path, nil

def install_command
Expand Down Expand Up @@ -55,7 +55,7 @@ def install_command
# (see Base#init_command)
def init_command
return if local_suite_files.empty?
debug("Remove root_path on remote server.")
debug('Remove root_path on remote server.')
<<-CMD
suite_dir="#{config[:root_path]}"
if [ "${suite_dir}" = "x" ]; then
Expand All @@ -75,19 +75,19 @@ def init_command
# @raise [ActionFailed] if the action could not be completed
def call(state)
create_sandbox
sandbox_dirs = Dir.glob(File.join(sandbox_path, "*"))
sandbox_dirs = Dir.glob(File.join(sandbox_path, '*'))

instance.transport.connection(state) do |conn|
conn.execute(install_command)
conn.execute(init_command)
info("Transferring files to #{instance.to_str}")
conn.upload(sandbox_dirs, config[:root_path])
debug("Transfer complete")
debug('Transfer complete')
conn.execute(prepare_command)
conn.execute(run_command)
end
rescue Kitchen::Transport::TransportFailed => ex
if ex.message .include? "<TEST EXECUTION FAILED>"
if ex.message .include? '<TEST EXECUTION FAILED>'
raise ActionFailed, "Action #verify failed for #{instance.to_str}."
else
raise ActionFailed, ex.message
Expand All @@ -100,7 +100,7 @@ def call(state)
def run_command
return if local_suite_files.empty?

debug("Running tests")
debug('Running tests')
prefix_command(wrap_shell_code(Util.outdent!(<<-CMD)))
set +e
#{goss_filename_flags}
Expand All @@ -116,9 +116,9 @@ def prepare_suites
base = File.join(config[:test_base_path], config[:suite_name])

local_suite_files.each do |src|
dest = File.join(sandbox_suites_dir, src.sub("#{base}/", ""))
dest = File.join(sandbox_suites_dir, src.sub("#{base}/", ''))
FileUtils.mkdir_p(File.dirname(dest))
FileUtils.cp(src, dest, :preserve => true)
FileUtils.cp(src, dest, preserve: true)
end
end

Expand All @@ -130,8 +130,8 @@ def prepare_suites
# @api private
def local_suite_files
base = File.join(config[:test_base_path], config[:suite_name])
glob = File.join(base, "goss/**/*")
#testfiles = Dir.glob(glob).reject { |f| File.directory?(f) }
glob = File.join(base, 'goss/**/*')
# testfiles = Dir.glob(glob).reject { |f| File.directory?(f) }
Dir.glob(glob).reject { |f| File.directory?(f) }
end

Expand All @@ -144,7 +144,7 @@ def create_sandbox
# @return [String] path to suites directory under sandbox path
# @api private
def sandbox_suites_dir
File.join(sandbox_path, "suites")
File.join(sandbox_path, 'suites')
end

def env_vars
Expand All @@ -154,7 +154,7 @@ def env_vars

def remote_var_file
base_path = File.join(config[:test_base_path], config[:suite_name])
remote_base_path = File.join(config[:root_path], "suites")
remote_base_path = File.join(config[:root_path], 'suites')
result = ''
local_suite_files.each do |src|
if File.basename(src) == config[:goss_var_path]
Expand All @@ -169,7 +169,7 @@ def remote_var_file
def run_test_command
command = config[:goss_download_path]
command = "sudo -E #{command}" if !config[:use_sudo] == true
command = "#{env_vars} #{command}" if !config[:env_vars].none?
command = "#{env_vars} #{command}" if config[:env_vars].any?
command = "#{command} --vars #{remote_var_file}" if config[:goss_var_path]
puts command

Expand Down Expand Up @@ -198,7 +198,7 @@ def run_test_command
end

def goss_filename_flags
<<-CMD
<<-CMD
## Set the flags for GOSS command path
VERSION="#{config[:goss_version]}"
DISTRO="$(uname)"
Expand Down Expand Up @@ -235,11 +235,11 @@ def goss_filename_flags

def get_test_name
base_path = File.join(config[:test_base_path], config[:suite_name])
remote_base_path = File.join(config[:root_path], "suites")
all_tests = ""
remote_base_path = File.join(config[:root_path], 'suites')
all_tests = ''
local_suite_files.each do |test_file|
if File.basename(test_file) != config[:goss_var_path] and File.basename(test_file).end_with?(".yml")
all_tests += " " + test_file.sub(base_path, remote_base_path)
if File.basename(test_file) != config[:goss_var_path] && File.basename(test_file).end_with?('.yml')
all_tests += ' ' + test_file.sub(base_path, remote_base_path)
end
end
all_tests
Expand All @@ -254,7 +254,6 @@ def sleep_if_set
sleep 1
end
end

end
end
end
end
4 changes: 2 additions & 2 deletions lib/kitchen/verifier/goss_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Kitchen
module Verifier
GOSS_VERSION = '0.1.0'
GOSS_VERSION = '0.1.1'.freeze
end
end
end

0 comments on commit 6bed75d

Please sign in to comment.