kitchen-salt 0.4.0 → 0.4.1

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
- SHA256:
3
- metadata.gz: 31ff032a93c1d76d2a38edb9f9074a84aa4eb19bf80ab0744b243d2ef78e2a09
4
- data.tar.gz: c690d95068e7205c1f53305b11971c92ff73b01b86e3d35e2022770768f3e794
2
+ SHA1:
3
+ metadata.gz: 90801c5a0ac6861667789c0f422110363806d1f2
4
+ data.tar.gz: 352badb1b9702f53ecd314cfd5779b4bf7f3f361
5
5
  SHA512:
6
- metadata.gz: bf0370b1b376923d310a01b1d29482819dcfcba9199075eddceddb4b03c6958754270a40f0d61d811d6f81381f7ee7879b7f8441e9980cb4e72890f592089f9c
7
- data.tar.gz: bf35ed5e32ae7a0d25cdaeae7947af67920ecc173fcf41052ea61824882fc89154cbb41db09ef9da744f9dcf50859cc6e369bb96694eeba86d13402bb7bd8536
6
+ metadata.gz: a91546dd9201fb63503475db3d7aef5d0ccb97846db2e823888d09b3feb61d3f25c97be6178fa544c9bbb1d9a607bec5c21ca86702684ecdede0cb5c372dd1f8
7
+ data.tar.gz: ed3777689beef0dbfde59a821ea2a55f3e1e65e3bc99d9e5c7f67e9ba9a08914ba5c078973a82baebe289d1d1461510fdb33bf38755111e4d18d5e0cb3b475ec
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
5
5
  end
@@ -39,8 +39,8 @@ then
39
39
  #{sudo('sh')} $BOOTSTRAP #{bootstrap_options}
40
40
  elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "pip" ]
41
41
  then
42
- echo "Makesure setuptools is new enough"
43
- #{sudo(salt_pip_bin)} install "setuptools>=30"
42
+ echo "Make sure setuptools and pip are new enough"
43
+ #{sudo(salt_pip_bin)} install "setuptools>=30" "pip>=9"
44
44
  echo #{sudo(salt_pip_bin)} #{salt_pip_install_command} #{salt_pip_pkg}
45
45
  #{sudo(salt_pip_bin)} #{salt_pip_install_command} #{salt_pip_pkg}
46
46
  elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "apt" ]
@@ -27,10 +27,10 @@ module Kitchen
27
27
  ENV['KITCHEN_TESTS'].split(' ').each{|test| config[:tests].push(test)}
28
28
  end
29
29
  command = [
30
- 'tox -c',
31
- File.join(root_path, config[:testingdir], 'tox.ini'),
32
- "-e #{instance.suite.name}",
33
- '--',
30
+ 'tox -c',
31
+ File.join(root_path, config[:testingdir], 'tox.ini'),
32
+ "-e #{instance.suite.name}",
33
+ '--',
34
34
  '--sysinfo',
35
35
  '--output-columns=80',
36
36
  (config[:windows] ? "--names-file=#{root_path}\\testing\\tests\\whitelist.txt" : ''),
@@ -0,0 +1,134 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "kitchen/verifier/base"
4
+
5
+ module Kitchen
6
+ module Verifier
7
+ class Tox < Kitchen::Verifier::Base
8
+ kitchen_verifier_api_version 1
9
+
10
+ plugin_version Kitchen::VERSION
11
+
12
+ default_config :testingdir, '/testing'
13
+ default_config :tests, []
14
+ default_config :transport, false
15
+ default_config :save, {}
16
+ default_config :windows, false
17
+ default_config :verbose, false
18
+ default_config :run_destructive, false
19
+ default_config :ssh_tests, true
20
+ default_config :proxy_tests, false
21
+ default_config :pytest, false
22
+ default_config :coverage, false
23
+ default_config :junitxml, false
24
+ default_config :from_filenames, []
25
+ default_config :enable_filenames, false
26
+ default_config :passthrough_opts, []
27
+ default_config :output_columns, 120
28
+ default_config :sysinfo, true
29
+
30
+ def call(state)
31
+ info("[#{name}] Verify on instance #{instance.name} with state=#{state}")
32
+ root_path = (config[:windows] ? '%TEMP%\\kitchen' : '/tmp/kitchen')
33
+ if ENV['KITCHEN_TESTS']
34
+ ENV['KITCHEN_TESTS'].split(' ').each{|test| config[:tests].push(test)}
35
+ end
36
+ toxenv = instance.suite.name
37
+ if config[:pytest]
38
+ toxenv = "#{toxenv}-pytest"
39
+ tests = config[:tests].join(' ')
40
+ else
41
+ toxenv = "#{toxenv}-runtests"
42
+ tests = config[:tests].collect{|test| "-n #{test}"}.join(' ')
43
+ end
44
+ if config[:coverage]
45
+ toxenv = "#{toxenv}-coverage"
46
+ end
47
+
48
+ if config[:enable_filenames] and ENV['CHANGE_TARGET'] and ENV['BRANCH_NAME']
49
+ require 'git'
50
+ repo = Git.open(Dir.pwd)
51
+ config[:from_filenames] = repo.diff("origin/#{ENV['CHANGE_TARGET']}",
52
+ "origin/#{ENV['BRANCH_NAME']}").name_status.keys.select{|file| file.end_with?('.py')}
53
+ end
54
+
55
+ if config[:junitxml]
56
+ junitxml = File.join(root_path, config[:testingdir], 'artifacts', 'xml-unittests-output')
57
+ if config[:pytest]
58
+ junitxml = "--junitxml=#{File.join(junitxml, 'test-results.xml')}"
59
+ else
60
+ junitxml = "--xml=#{junitxml}"
61
+ end
62
+ end
63
+
64
+ # Be sure to copy the remote artifacts directory to the local machine
65
+ save = {
66
+ "#{File.join(root_path, config[:testingdir], 'artifacts')}" => "#{Dir.pwd}/"
67
+ }
68
+ # Hash insert order matters, that's why we define a new one and merge
69
+ # the one from config
70
+ save.merge!(config[:save])
71
+
72
+ command = [
73
+ 'tox -c',
74
+ File.join(root_path, config[:testingdir], 'tox.ini'),
75
+ "-e #{toxenv}",
76
+ '--',
77
+ "--output-columns=#{config[:output_columns]}",
78
+ (config[:sysinfo] ? '--sysinfo' : ''),
79
+ (config[:junitxml] ? junitxml : ''),
80
+ (config[:windows] ? "--names-file=#{root_path}\\testing\\tests\\whitelist.txt" : ''),
81
+ (config[:transport] ? "--transport=#{config[:transport]}" : ''),
82
+ (config[:verbose] ? '-vv' : '-v'),
83
+ (config[:run_destructive] ? "--run-destructive" : ''),
84
+ (config[:ssh_tests] ? "--ssh-tests" : ''),
85
+ (config[:proxy_tests] ? "--proxy-tests" : ''),
86
+ config[:passthrough_opts].join(' '),
87
+ (config[:from_filenames].any? ? "--from-filenames=#{config[:from_filenames].join(',')}" : ''),
88
+ tests,
89
+ '2>&1',
90
+ ].join(' ')
91
+ if config[:windows]
92
+ command = "cmd.exe /c \"#{command}\" 2>&1"
93
+ end
94
+ info("Running Command: #{command}")
95
+ instance.transport.connection(state) do |conn|
96
+ begin
97
+ if config[:windows]
98
+ conn.execute('$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")')
99
+ conn.execute("$env:PythonPath = [Environment]::ExpandEnvironmentVariables(\"#{root_path}\\testing\")")
100
+ else
101
+ begin
102
+ conn.execute(sudo("chown -R $USER #{root_path}"))
103
+ rescue => e
104
+ error("Failed to chown #{root_path} :: #{e}")
105
+ end
106
+ end
107
+ begin
108
+ conn.execute(sudo(command))
109
+ rescue => e
110
+ info("Verify command failed :: #{e}")
111
+ end
112
+ ensure
113
+ save.each do |remote, local|
114
+ unless config[:windows]
115
+ begin
116
+ conn.execute(sudo("chmod -R +r #{remote}"))
117
+ rescue => e
118
+ error("Failed to chown #{remote} :: #{e}")
119
+ end
120
+ end
121
+ begin
122
+ info("Copying #{remote} to #{local}")
123
+ conn.download(remote, local)
124
+ rescue => e
125
+ error("Failed to copy #{remote} to #{local} :: ${e}")
126
+ end
127
+ end
128
+ end
129
+ end
130
+ debug("[#{name}] Verify completed.")
131
+ end
132
+ end
133
+ end
134
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaltStack Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -160,6 +160,7 @@ files:
160
160
  - lib/kitchen/transport/runtests.rb
161
161
  - lib/kitchen/verifier/runtests.rb
162
162
  - lib/kitchen/verifier/salttox.rb
163
+ - lib/kitchen/verifier/tox.rb
163
164
  homepage: https://github.com/saltstack/kitchen-salt
164
165
  licenses:
165
166
  - Apache-2.0
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  requirements: []
182
183
  rubyforge_project: "[none]"
183
- rubygems_version: 2.7.3
184
+ rubygems_version: 2.5.2.3
184
185
  signing_key:
185
186
  specification_version: 4
186
187
  summary: salt provisioner for test-kitchen