beaker-testmode_switcher 0.2.1 → 0.3.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/.travis.yml +1 -0
- data/CHANGELOG.md +10 -0
- data/README.md +2 -0
- data/lib/beaker/testmode_switcher/beaker_runners.rb +3 -2
- data/lib/beaker/testmode_switcher/dsl.rb +4 -1
- data/lib/beaker/testmode_switcher/local_runner.rb +5 -7
- data/lib/beaker/testmode_switcher/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7ff5d01994fcc8fd23b932a148f2652929885a9
|
4
|
+
data.tar.gz: 1f09d49b242599f033255c7089837cf7a75fd19a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29e63bc99d6a810af62c3695f6a9447e81c73428a38367b95534e9cb38c801ddc8896cc9f484c93ad182ad639136e0240963e06bb7dc154ec5b3bce49faaf79e
|
7
|
+
data.tar.gz: 9ead4a0fc8906c2703c2fb66e7befd317fcd6b4b6a77c0684f9c777d18e0dcf2565fc38cba2c23ce6d9935af51e534d4d80c85bcc0b6ab979a859fafa373bfb5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 2017-06-08 Version 0.3.0
|
2
|
+
### Summary
|
3
|
+
Adds a new parameter for shell_ex; and improvements for local test running.
|
4
|
+
|
5
|
+
### Features
|
6
|
+
- Implements `:chdir` option to `shell_ex`.
|
7
|
+
|
8
|
+
### BugFixes
|
9
|
+
- Makes `my_hosts` and `logger` global methods optional.
|
10
|
+
|
1
11
|
# 2017-06-02 Version 0.2.1
|
2
12
|
### Summary
|
3
13
|
Fixes for shell_ex when running on Windows; and a minor README update.
|
data/README.md
CHANGED
@@ -79,6 +79,8 @@ This experimental version supports only a minimal set of functionality from the
|
|
79
79
|
`opts` keys:
|
80
80
|
* `:dry_run`: set to true to skip executing the actual command.
|
81
81
|
* `:environment`: pass environment variables for the command as a hash.
|
82
|
+
* `:chdir`: the directory in which to run the command.
|
83
|
+
* See `Process.spawn()`'s `options` argument for more attributes.
|
82
84
|
|
83
85
|
Other helpful methods:
|
84
86
|
|
@@ -7,7 +7,10 @@ module Beaker
|
|
7
7
|
# pass through methods to the runner
|
8
8
|
%i[create_remote_file_ex scp_to_ex shell_ex resource execute_manifest execute_manifest_on].each do |name|
|
9
9
|
define_method(name) do |*args|
|
10
|
-
|
10
|
+
# `hosts`, and `logger` are beaker DSL accessors in the global scope. Do not fail here, if they're not available.
|
11
|
+
my_hosts = (hosts if respond_to? :hosts)
|
12
|
+
my_logger = (logger if respond_to? :logger)
|
13
|
+
Beaker::TestmodeSwitcher.runner(my_hosts, my_logger).send(name, *args)
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -19,7 +19,7 @@ module Beaker
|
|
19
19
|
if commands.empty?
|
20
20
|
success_result
|
21
21
|
else
|
22
|
-
use_local_shell(commands.join(' && '),
|
22
|
+
use_local_shell(commands.join(' && '), {})
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -70,8 +70,6 @@ module Beaker
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# run a command through a local shell
|
73
|
-
# Pass options to alter execution through `opts`:
|
74
|
-
# * `:environment`: default: `{}`; these will be treated as extra environment variables that should be set before running the command
|
75
73
|
def shell_ex(cmd, opts = {})
|
76
74
|
use_local_shell(cmd, opts)
|
77
75
|
end
|
@@ -87,24 +85,24 @@ module Beaker
|
|
87
85
|
end
|
88
86
|
|
89
87
|
# fork/exec a process and collect its output
|
90
|
-
def use_local_shell(cmd, opts)
|
88
|
+
def use_local_shell(cmd, opts = {})
|
91
89
|
if opts[:dry_run]
|
92
90
|
puts "Would have run '#{cmd}'"
|
93
91
|
success_result
|
94
92
|
else
|
95
|
-
capture_command(cmd, opts
|
93
|
+
capture_command(cmd, opts)
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
99
97
|
# runs a command and captures its output in a Beaker::Result
|
100
|
-
def capture_command(cmd,
|
98
|
+
def capture_command(cmd, opts = {})
|
101
99
|
blocks = {
|
102
100
|
combined: [],
|
103
101
|
out: [],
|
104
102
|
err: []
|
105
103
|
}
|
106
104
|
exit_code = -1
|
107
|
-
Open3.popen3(environment, cmd) do |stdin, stdout, stderr, wait_thr|
|
105
|
+
Open3.popen3(opts[:environment] || {}, cmd, opts) do |stdin, stdout, stderr, wait_thr|
|
108
106
|
# TODO: pass through $stdin/terminal to subprocess to allow interaction - e.g. pry - the subprocess
|
109
107
|
stdin.close_write
|
110
108
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-testmode_switcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-06-
|
15
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: beaker
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.5.
|
91
|
+
rubygems_version: 2.5.2
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Let's you run your puppet module tests in master/agent, apply or local mode.
|