kitchen-salt 0.5.0 → 0.6.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 +4 -4
- data/lib/kitchen-salt/version.rb +1 -1
- data/lib/kitchen/verifier/nox.rb +140 -0
- data/lib/kitchen/verifier/tox.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f711ec1a9e53499fabcbcfd43f13987d9b38bcb5
|
|
4
|
+
data.tar.gz: 5ce22225b656097be617e2cafcca453b43463add
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 410f0585fe62b1fd6be86be74af64f1d1635712b18aab725eff66c112eafb9b16870fbc851f69e372daa44579ff93854ce5c6d4d7390632c43add517d3ef8568
|
|
7
|
+
data.tar.gz: 979dd2e1b87611a79c59c55d75b7eb6587ba2eed6e2617cac0c7c6d121649d0f09fbbffb4e6e4d164926e90c5505b6f94c35a595396f3db9a58e0c88d6cf63a3
|
data/lib/kitchen-salt/version.rb
CHANGED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require "kitchen/verifier/base"
|
|
4
|
+
|
|
5
|
+
module Kitchen
|
|
6
|
+
module Verifier
|
|
7
|
+
class Nox < 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
|
+
noxenv = instance.suite.name
|
|
37
|
+
if config[:pytest]
|
|
38
|
+
noxenv = "pytest"
|
|
39
|
+
tests = config[:tests].join(' ')
|
|
40
|
+
else
|
|
41
|
+
noxenv = "runtests"
|
|
42
|
+
tests = config[:tests].collect{|test| "-n #{test}"}.join(' ')
|
|
43
|
+
end
|
|
44
|
+
noxenv = "#{noxenv}-#{config[:transport] ? config[:transport] : 'zeromq'}"
|
|
45
|
+
if ENV['NOX_SESSION']
|
|
46
|
+
noxenv = "#{noxenv}-#{ENV['NOX_SESSION']}"
|
|
47
|
+
end
|
|
48
|
+
# Nox env's are not py<python-version> named, they just use the <python-version>
|
|
49
|
+
# Additionally, nox envs are parametrised to enable or disable test coverage
|
|
50
|
+
# So, the line below becomes something like:
|
|
51
|
+
# runtests-2(coverage=True)
|
|
52
|
+
# pytest-3(coverage=False)
|
|
53
|
+
suite = instance.suite.name.gsub('py', '').gsub('2', '2.7')
|
|
54
|
+
noxenv = "#{noxenv}-#{suite}(coverage=#{config[:coverage] ? 'True' : 'False'})"
|
|
55
|
+
|
|
56
|
+
if config[:enable_filenames] and ENV['CHANGE_TARGET'] and ENV['BRANCH_NAME']
|
|
57
|
+
require 'git'
|
|
58
|
+
repo = Git.open(Dir.pwd)
|
|
59
|
+
config[:from_filenames] = repo.diff("origin/#{ENV['CHANGE_TARGET']}",
|
|
60
|
+
"origin/#{ENV['BRANCH_NAME']}").name_status.keys.select{|file| file.end_with?('.py')}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if config[:junitxml]
|
|
64
|
+
junitxml = File.join(root_path, config[:testingdir], 'artifacts', 'xml-unittests-output')
|
|
65
|
+
if config[:pytest]
|
|
66
|
+
junitxml = "--junitxml=#{File.join(junitxml, 'test-results.xml')}"
|
|
67
|
+
else
|
|
68
|
+
junitxml = "--xml=#{junitxml}"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Be sure to copy the remote artifacts directory to the local machine
|
|
73
|
+
save = {
|
|
74
|
+
"#{File.join(root_path, config[:testingdir], 'artifacts')}" => "#{Dir.pwd}/"
|
|
75
|
+
}
|
|
76
|
+
# Hash insert order matters, that's why we define a new one and merge
|
|
77
|
+
# the one from config
|
|
78
|
+
save.merge!(config[:save])
|
|
79
|
+
|
|
80
|
+
command = [
|
|
81
|
+
'nox',
|
|
82
|
+
"-f #{File.join(root_path, config[:testingdir], 'noxfile.py')}",
|
|
83
|
+
(config[:windows] ? "-e #{noxenv}" : "-e '#{noxenv}'"),
|
|
84
|
+
'--',
|
|
85
|
+
"--output-columns=#{config[:output_columns]}",
|
|
86
|
+
(config[:sysinfo] ? '--sysinfo' : ''),
|
|
87
|
+
(config[:junitxml] ? junitxml : ''),
|
|
88
|
+
(config[:windows] ? "--names-file=#{root_path}\\testing\\tests\\whitelist.txt" : ''),
|
|
89
|
+
(config[:verbose] ? '-vv' : '-v'),
|
|
90
|
+
(config[:run_destructive] ? "--run-destructive" : ''),
|
|
91
|
+
(config[:ssh_tests] ? "--ssh-tests" : ''),
|
|
92
|
+
(config[:proxy_tests] ? "--proxy-tests" : ''),
|
|
93
|
+
config[:passthrough_opts].join(' '),
|
|
94
|
+
(config[:from_filenames].any? ? "--from-filenames=#{config[:from_filenames].join(',')}" : ''),
|
|
95
|
+
tests,
|
|
96
|
+
].join(' ')
|
|
97
|
+
if config[:windows]
|
|
98
|
+
command = "cmd.exe /c --% \"#{command}\" 2>&1"
|
|
99
|
+
end
|
|
100
|
+
info("Running Command: #{command}")
|
|
101
|
+
instance.transport.connection(state) do |conn|
|
|
102
|
+
begin
|
|
103
|
+
if config[:windows]
|
|
104
|
+
conn.execute('$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")')
|
|
105
|
+
conn.execute("$env:PythonPath = [Environment]::ExpandEnvironmentVariables(\"#{root_path}\\testing\")")
|
|
106
|
+
else
|
|
107
|
+
begin
|
|
108
|
+
conn.execute(sudo("chown -R $USER #{root_path}"))
|
|
109
|
+
rescue => e
|
|
110
|
+
error("Failed to chown #{root_path} :: #{e}")
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
begin
|
|
114
|
+
conn.execute(sudo(command))
|
|
115
|
+
rescue => e
|
|
116
|
+
info("Verify command failed :: #{e}")
|
|
117
|
+
end
|
|
118
|
+
ensure
|
|
119
|
+
save.each do |remote, local|
|
|
120
|
+
unless config[:windows]
|
|
121
|
+
begin
|
|
122
|
+
conn.execute(sudo("chmod -R +r #{remote}"))
|
|
123
|
+
rescue => e
|
|
124
|
+
error("Failed to chown #{remote} :: #{e}")
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
begin
|
|
128
|
+
info("Copying #{remote} to #{local}")
|
|
129
|
+
conn.download(remote, local)
|
|
130
|
+
rescue => e
|
|
131
|
+
error("Failed to copy #{remote} to #{local} :: #{e}")
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
debug("[#{name}] Verify completed.")
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
data/lib/kitchen/verifier/tox.rb
CHANGED
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
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SaltStack Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: hashie
|
|
@@ -28,14 +28,14 @@ dependencies:
|
|
|
28
28
|
name: test-kitchen
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '1.4'
|
|
34
34
|
type: :runtime
|
|
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: '1.4'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
@@ -158,6 +158,7 @@ files:
|
|
|
158
158
|
- lib/kitchen/provisioner/salt_solo.rb
|
|
159
159
|
- lib/kitchen/provisioner/spm.erb
|
|
160
160
|
- lib/kitchen/transport/runtests.rb
|
|
161
|
+
- lib/kitchen/verifier/nox.rb
|
|
161
162
|
- lib/kitchen/verifier/runtests.rb
|
|
162
163
|
- lib/kitchen/verifier/salttox.rb
|
|
163
164
|
- lib/kitchen/verifier/tox.rb
|