cem_win_spec 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -5
- data/cem_win_spec.gemspec +0 -1
- data/exe/cem-win-spec +0 -0
- data/lib/cem_win_spec/test_runner.rb +8 -3
- data/lib/cem_win_spec/version.rb +1 -1
- data/lib/cem_win_spec/win_exec/cmd/winrm_cmd.rb +5 -1
- data/lib/cem_win_spec/win_exec/exec.rb +0 -17
- data/lib/cem_win_spec/win_exec/factory.rb +0 -1
- data/lib/cem_win_spec.rb +9 -14
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8483cd4acfa3729cf4bd453fe3ef09a67c71ddd3dcee46f5dc3986e755ddf07
|
4
|
+
data.tar.gz: a4ef098f7125bf68579dd1b5902d5cb553ccfcbef355d8bd0e4f1d8900eae395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1a521b044cc4c14a26efd6b8936f662dc1d2b173918337e49b591fe1178f6357aff317cd7dab4ae167688eea2304b75dc89fde8273bb8e7dcc3d22b8df8d33
|
7
|
+
data.tar.gz: a31a1631d32ca72d34f276920de7a9f22f34175afac7306e64f7158ec309cc66ce0e80aab6b3ac430627f170291b9e442fd7516a7231b242c059a39836f5e3e1
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cem_win_spec (0.1.
|
4
|
+
cem_win_spec (0.1.4)
|
5
5
|
parallel_tests (~> 3.4)
|
6
6
|
puppet_forge (~> 4.1)
|
7
|
-
tty-spinner (~> 0.9)
|
8
7
|
winrm (~> 2.3)
|
9
8
|
winrm-fs (~> 1.3)
|
10
9
|
|
@@ -83,9 +82,6 @@ GEM
|
|
83
82
|
rubyntlm (0.6.3)
|
84
83
|
rubyzip (2.3.2)
|
85
84
|
semantic_puppet (1.1.0)
|
86
|
-
tty-cursor (0.7.1)
|
87
|
-
tty-spinner (0.9.3)
|
88
|
-
tty-cursor (~> 0.7)
|
89
85
|
unicode-display_width (2.1.0)
|
90
86
|
winrm (2.3.6)
|
91
87
|
builder (>= 2.1.2)
|
@@ -103,6 +99,7 @@ GEM
|
|
103
99
|
winrm (~> 2.0)
|
104
100
|
|
105
101
|
PLATFORMS
|
102
|
+
arm64-darwin-22
|
106
103
|
x86_64-darwin-19
|
107
104
|
x86_64-darwin-20
|
108
105
|
|
data/cem_win_spec.gemspec
CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency "winrm", "~> 2.3"
|
32
32
|
spec.add_dependency "winrm-fs", "~> 1.3"
|
33
|
-
spec.add_dependency "tty-spinner", "~> 0.9"
|
34
33
|
spec.add_dependency "puppet_forge", "~> 4.1"
|
35
34
|
spec.add_dependency "parallel_tests", "~> 3.4"
|
36
35
|
spec.add_development_dependency "pry"
|
data/exe/cem-win-spec
CHANGED
File without changes
|
@@ -44,7 +44,7 @@ module CemWinSpec
|
|
44
44
|
|
45
45
|
def enable_symlinks(**opts)
|
46
46
|
@enable_symlinks ||= new_command('Enable symlinks', **opts) do
|
47
|
-
|
47
|
+
remote_run('fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1')
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -76,8 +76,13 @@ module CemWinSpec
|
|
76
76
|
|
77
77
|
def setup_ruby(**opts)
|
78
78
|
@setup_ruby ||= new_command('Set up ruby', **opts) do
|
79
|
-
remote_run(
|
80
|
-
|
79
|
+
remote_run(
|
80
|
+
[
|
81
|
+
'bundle config disable_platform_warnings true',
|
82
|
+
'bundle config set --local without \'local_development\'',
|
83
|
+
'bundle install',
|
84
|
+
],
|
85
|
+
)
|
81
86
|
end
|
82
87
|
end
|
83
88
|
|
data/lib/cem_win_spec/version.rb
CHANGED
@@ -22,12 +22,16 @@ module CemWinSpec
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def run(cmd, *_args, **_kwargs)
|
25
|
+
cmd = cmd.join('; ') if cmd.is_a?(Array)
|
25
26
|
log_command(cmd)
|
26
27
|
shell = nil
|
27
28
|
output = nil
|
28
29
|
begin
|
29
30
|
shell = conn.shell(:powershell)
|
30
|
-
output = shell.run(command(cmd))
|
31
|
+
output = shell.run(command(cmd)) do |stdout, stderr|
|
32
|
+
logger << stdout unless stdout.nil? || stdout.empty?
|
33
|
+
logger << stderr unless stderr.nil? || stderr.empty?
|
34
|
+
end
|
31
35
|
rescue WinRM::WinRMAuthorizationError => e
|
32
36
|
@available = false
|
33
37
|
raise e
|
@@ -25,7 +25,6 @@ module CemWinSpec
|
|
25
25
|
add_command_block(&block) unless block.nil?
|
26
26
|
@reuse_tunnel = true
|
27
27
|
@ignore_exitcode = false
|
28
|
-
@spinner = nil
|
29
28
|
@result = nil
|
30
29
|
end
|
31
30
|
|
@@ -96,12 +95,6 @@ module CemWinSpec
|
|
96
95
|
false
|
97
96
|
end
|
98
97
|
|
99
|
-
def spinner=(value)
|
100
|
-
raise ArgumentError, 'spinner must implement #auto_spin and #stop methods' unless value.respond_to?(:auto_spin) && value.respond_to?(:stop)
|
101
|
-
|
102
|
-
@spinner = value
|
103
|
-
end
|
104
|
-
|
105
98
|
# Proxy method calls for methods that don't exist here to various other objects.
|
106
99
|
# This allows doing things like: `win_exec.remote_exec('Get-Process')` and
|
107
100
|
# calling the `exec` method on the `winrm_exec` object. This is done by
|
@@ -157,13 +150,10 @@ module CemWinSpec
|
|
157
150
|
def run(*args, **kwargs)
|
158
151
|
validate_instance_variables
|
159
152
|
logger.info "Running #{@title}"
|
160
|
-
@spinner&.auto_spin
|
161
153
|
result = run_with_tunnel { run_in_current_scope(*args, **kwargs) }
|
162
|
-
@spinner&.stop
|
163
154
|
@result = Output.new(result)
|
164
155
|
return if @result.pending_threaded?
|
165
156
|
|
166
|
-
@result.puts_combined
|
167
157
|
unless @result.success? || ignore_exitcode?
|
168
158
|
raise "Command failed with exit code #{@result.exitcode}: #{@result.stdout}\n#{@result.stderr}"
|
169
159
|
end
|
@@ -201,13 +191,6 @@ module CemWinSpec
|
|
201
191
|
def run_in_current_scope(*args, **kwargs)
|
202
192
|
instance_exec(*args, **kwargs, &@block) # self is the "instance"
|
203
193
|
end
|
204
|
-
|
205
|
-
def wrap_spinner
|
206
|
-
@spinner.auto_spin if @spinner
|
207
|
-
yield if block_given?
|
208
|
-
ensure
|
209
|
-
@spinner.stop if @spinner
|
210
|
-
end
|
211
194
|
end
|
212
195
|
end
|
213
196
|
end
|
@@ -47,7 +47,6 @@ module CemWinSpec
|
|
47
47
|
wexec.add_command_block(&block)
|
48
48
|
wexec.reuse_tunnel = opts[:reuse_tunnel] if opts.key?(:reuse_tunnel)
|
49
49
|
wexec.ignore_exitcode = opts[:ignore_exitcode] if opts.key?(:ignore_exitcode)
|
50
|
-
wexec.spinner = opts[:spinner] if opts.key?(:spinner)
|
51
50
|
logger.debug 'Created Wexec'
|
52
51
|
wexec
|
53
52
|
end
|
data/lib/cem_win_spec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'tty-spinner'
|
4
3
|
require_relative 'cem_win_spec/logging'
|
5
4
|
require_relative 'cem_win_spec/test_runner'
|
6
5
|
|
@@ -39,20 +38,19 @@ module CemWinSpec
|
|
39
38
|
logger.debug "Created TestRunner: #{runner}"
|
40
39
|
signal_handler(runner)
|
41
40
|
logger.debug 'Set up signal handler'
|
42
|
-
spinner = TTY::Spinner.new(format: :classic, interval: 1, hide_cursor: true, clear: true)
|
43
41
|
begin
|
44
|
-
sre_out = setup_remote_environment(runner
|
42
|
+
sre_out = setup_remote_environment(runner)
|
45
43
|
check_output!(sre_out, runner)
|
46
44
|
module_dir = sre_out.stdout.chomp
|
47
45
|
logger.debug "Module dir: #{module_dir}"
|
48
|
-
srr_out = setup_remote_ruby(runner, module_dir,
|
46
|
+
srr_out = setup_remote_ruby(runner, module_dir, **options)
|
49
47
|
check_output!(srr_out, runner)
|
50
48
|
case operation
|
51
49
|
when :spec
|
52
|
-
spec_out = run_spec(runner, module_dir,
|
50
|
+
spec_out = run_spec(runner, module_dir, **options)
|
53
51
|
check_output!(spec_out, runner)
|
54
52
|
when :clean_fixture_cache
|
55
|
-
clean_fixture_cache_out = clean_fixture_cache(runner, module_dir,
|
53
|
+
clean_fixture_cache_out = clean_fixture_cache(runner, module_dir, **options)
|
56
54
|
check_output!(clean_fixture_cache_out, runner)
|
57
55
|
else
|
58
56
|
raise ArgumentError, "Unknown operation: #{operation}"
|
@@ -64,7 +62,7 @@ module CemWinSpec
|
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
def self.setup_remote_environment(runner
|
65
|
+
def self.setup_remote_environment(runner)
|
68
66
|
runner.enable_long_paths.run
|
69
67
|
runner.enable_symlinks.run
|
70
68
|
runner.enable_symlinks.run
|
@@ -74,31 +72,28 @@ module CemWinSpec
|
|
74
72
|
runner.upload_module(operation_timeout: 300, receive_timeout: 310, working_dir: working_dir).run
|
75
73
|
end
|
76
74
|
|
77
|
-
def self.setup_remote_ruby(runner, module_dir,
|
75
|
+
def self.setup_remote_ruby(runner, module_dir, **opts)
|
78
76
|
runner.setup_ruby(operation_timeout: 300,
|
79
77
|
receive_timeout: 310,
|
80
78
|
working_dir: module_dir,
|
81
79
|
reuse_tunnel: false,
|
82
|
-
spinner: spinner,
|
83
80
|
**opts).run
|
84
81
|
end
|
85
82
|
|
86
83
|
# Runs RSpec tests
|
87
|
-
def self.run_spec(runner, module_dir,
|
88
|
-
#runner.rspec_prep(working_dir: module_dir, reuse_tunnel: false, spinner: spinner).run
|
84
|
+
def self.run_spec(runner, module_dir, **opts)
|
89
85
|
runner.rspec_tests_parallel(operation_timeout: 300,
|
90
86
|
receive_timeout: 310,
|
91
87
|
working_dir: module_dir,
|
92
88
|
ignore_exitcode: true,
|
93
89
|
reuse_tunnel: false,
|
94
|
-
spinner: spinner,
|
95
90
|
**opts).run
|
96
91
|
end
|
97
92
|
|
98
93
|
# Clean the remote fixture cache
|
99
94
|
# @param options [Hash] Options for the test runner
|
100
|
-
def self.clean_fixture_cache(runner, module_dir,
|
101
|
-
runner.clean_fixture_cache(working_dir: module_dir,
|
95
|
+
def self.clean_fixture_cache(runner, module_dir, **opts)
|
96
|
+
runner.clean_fixture_cache(working_dir: module_dir, **opts).run
|
102
97
|
end
|
103
98
|
|
104
99
|
def self.check_output!(output, runner = nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cem_win_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heston Snodgrass
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: winrm
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: tty-spinner
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.9'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.9'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: puppet_forge
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
139
|
- !ruby/object:Gem::Version
|
154
140
|
version: '0'
|
155
141
|
requirements: []
|
156
|
-
rubygems_version: 3.4.
|
142
|
+
rubygems_version: 3.4.10
|
157
143
|
signing_key:
|
158
144
|
specification_version: 4
|
159
145
|
summary: Write a short summary, because RubyGems requires one.
|