beaker 4.37.2 → 4.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/beaker.gemspec +0 -3
- data/docs/how_to/debug_beaker_tests.md +8 -4
- data/lib/beaker/dsl/structure.rb +16 -4
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +0 -7
- data/spec/beaker/dsl/structure_spec.rb +1 -0
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1ac6690e4ad7436057320fe86b41db78a6f805e7fa93e1a5565ca84c778a5e0
|
4
|
+
data.tar.gz: 54cdf1e43fea24d2b1a1421612b12c9cc41cd9a529d00d78a79d37a6b746dadd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe3ecdd06a58edf0a841aac2009eb0f03974edeaf4441d5843760dfa30e364be94c030c144173080abcdfc12f3b4b87dac1deaef6644e6cc56cc83297b51f2a
|
7
|
+
data.tar.gz: 5d7ec12ffce5318ca9470d9e66d689c6a9f51ef10fd29e5fa26d43bebcf47d6978d2f5d392a43223aba21f4d2372fe69994217adbaff73f4bb078a40a5633359
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [4.38.0](https://github.com/voxpupuli/beaker/tree/4.37.2) (2022-08-11)
|
4
|
+
|
5
|
+
## Added
|
6
|
+
|
7
|
+
- Drop pry dependency, allow using debug gem ([#1737](https://github.com/voxpupuli/beaker/pull/1737))
|
8
|
+
|
3
9
|
## [4.37.2](https://github.com/voxpupuli/beaker/tree/4.37.2) (2022-07-28)
|
4
10
|
|
5
11
|
## Fixed
|
data/beaker.gemspec
CHANGED
@@ -32,9 +32,6 @@ Gem::Specification.new do |s|
|
|
32
32
|
# Run time dependencies
|
33
33
|
s.add_runtime_dependency 'minitest', '~> 5.4'
|
34
34
|
s.add_runtime_dependency 'minitar', '~> 0.6'
|
35
|
-
s.add_runtime_dependency 'pry-byebug', '~> 3.9'
|
36
|
-
# pry-byebug can have issues with native readline libs so add rb-readline
|
37
|
-
s.add_runtime_dependency 'rb-readline', '~> 0.5.3'
|
38
35
|
s.add_runtime_dependency 'rexml'
|
39
36
|
|
40
37
|
s.add_runtime_dependency 'hocon', '~> 1.0'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Debug beaker tests
|
2
2
|
|
3
|
-
beaker
|
3
|
+
beaker can use [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug), a gem that combines two powerful related tools: pry and byebug. It falls back to [debug](https://github.com/ruby/debug) if pry is unavailable.
|
4
4
|
|
5
5
|
### What is Pry?
|
6
6
|
|
@@ -16,6 +16,10 @@ There are several ways to have your tests break and enter debugging:
|
|
16
16
|
2. [Use the --debug-errors option](#use-the---debug-errors-option)
|
17
17
|
3. [Defining external breakpoints with byebug](#defining-external-breakpoints-with-byebug)
|
18
18
|
|
19
|
+
### What is debug?
|
20
|
+
|
21
|
+
[debug](https://github.com/ruby/debug) is the new debugger bundled since Ruby 3.1.
|
22
|
+
|
19
23
|
## Add a breakpoint to your test file
|
20
24
|
|
21
25
|
Add Pry to individual tests by adding `require 'pry'` to the Ruby test file. Then add the statement `binding.pry` at the point in code where you want access to the full, current Beaker environment.
|
@@ -232,7 +236,7 @@ Simply `exit` the console.
|
|
232
236
|
|
233
237
|
## Use the --debug-errors option
|
234
238
|
|
235
|
-
You can run beaker and pass the option `--debug-errors` to have beaker enter the pry console if or when a test error occurs. This is useful for transient/intermittent errors where you may need to run the test a large number of times before seeing the failure. It's also useful to keep your hosts at the state where error occurred, as the test's teardown will not (yet) have executed.
|
239
|
+
You can run beaker and pass the option `--debug-errors` to have beaker enter the pry or debug console if or when a test error occurs. This is useful for transient/intermittent errors where you may need to run the test a large number of times before seeing the failure. It's also useful to keep your hosts at the state where error occurred, as the test's teardown will not (yet) have executed.
|
236
240
|
|
237
241
|
### Example
|
238
242
|
|
@@ -249,10 +253,10 @@ Consider this example test case _test.rb_, which is going to fail:
|
|
249
253
|
|
250
254
|
You can run this test using `beaker -t test.rb` or (to use the `run` subcommand and just run the test and bypass host provisioning etc) `beaker run -t test.rb`. It fails.
|
251
255
|
|
252
|
-
Now try `beaker run -t test.rb --debug-errors` This will enter a pry console when the failure occurs.
|
256
|
+
Now try `beaker run -t test.rb --debug-errors` This will enter a pry or debug console when the failure occurs.
|
253
257
|
|
254
258
|
* Assert expected matches actual
|
255
|
-
Exception raised during step execution and debug-errors option is set, entering pry. Exception was: #<Minitest::Assertion: This product is faulty.
|
259
|
+
Exception raised during step execution and debug-errors option is set, entering pry or debug. Exception was: #<Minitest::Assertion: This product is faulty.
|
256
260
|
Expected: 3
|
257
261
|
Actual: 2>
|
258
262
|
HINT: Use the pry 'backtrace' and 'up' commands to navigate to the test code
|
data/lib/beaker/dsl/structure.rb
CHANGED
@@ -31,7 +31,6 @@ module Beaker
|
|
31
31
|
# end
|
32
32
|
#
|
33
33
|
module Structure
|
34
|
-
require 'pry'
|
35
34
|
# Provides a method to help structure tests into coherent steps.
|
36
35
|
# @param [String] step_name The name of the step to be logged.
|
37
36
|
# @param [Proc] block The actions to be performed in this step.
|
@@ -45,9 +44,22 @@ module Beaker
|
|
45
44
|
end
|
46
45
|
rescue Exception => e
|
47
46
|
if(@options.has_key?(:debug_errors) && @options[:debug_errors] == true)
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
begin
|
48
|
+
require 'pry'
|
49
|
+
rescue LoadError
|
50
|
+
begin
|
51
|
+
require 'debug'
|
52
|
+
rescue LoadError
|
53
|
+
logger.exception('Unable to load pry and debug while debug_errors was true')
|
54
|
+
else
|
55
|
+
logger.info("Exception raised during step execution and debug-errors option is set, entering debug. Exception was: #{e.inspect}")
|
56
|
+
binding.break
|
57
|
+
end
|
58
|
+
else
|
59
|
+
logger.info("Exception raised during step execution and debug-errors option is set, entering pry. Exception was: #{e.inspect}")
|
60
|
+
logger.info("HINT: Use the pry 'backtrace' and 'up' commands to navigate to the test code")
|
61
|
+
binding.pry
|
62
|
+
end
|
51
63
|
end
|
52
64
|
raise e
|
53
65
|
end
|
data/lib/beaker/version.rb
CHANGED
data/lib/beaker.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -108,34 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.6'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: pry-byebug
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.9'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.9'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rb-readline
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 0.5.3
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 0.5.3
|
139
111
|
- !ruby/object:Gem::Dependency
|
140
112
|
name: rexml
|
141
113
|
requirement: !ruby/object:Gem::Requirement
|