towel 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -22
- data/extensions/towel-minitest/examples/.towel.toml +2 -0
- data/extensions/towel-rspec/examples/.rspec +1 -0
- data/extensions/towel-rspec/examples/.towel.toml +39 -0
- data/extensions/towel-rspec/examples/simple_spec.rb +3 -1
- data/extensions/towel-rspec/lib/towel/rspec/formatter.rb +74 -14
- data/lib/towel/session.rb +0 -1
- data/lib/towel/version.rb +1 -1
- data/towel.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c801c1b0875a6adef94c5c999b78faa1e30a1915f88d1b8bd00ac9116bff8ff
|
4
|
+
data.tar.gz: b65d98d9d20b055089d4b71e85e221c54d9dfbe31381df6187f124ad475142c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 891f98b490fcd6a6158f3c7e477295f3fb8bc2ffde9f727b4b035995f68235895f0c474057bed38cc28112dc7bfb999ded2708f85ba21a88cf0aa1c12fbf2470
|
7
|
+
data.tar.gz: f2b5fed2e95665584de1e048855e494f286266e4ef450a088f46fe4bb2dccc8d6f0f8a85ccf86155fae8f17e8561fbceb00652fe918cfa38246b6c02ae6b9e44
|
data/README.md
CHANGED
@@ -1,28 +1,14 @@
|
|
1
1
|
# Towel
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'towel'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install towel
|
3
|
+
[Towel](https://towel.dev) is a test results collector. As you run tests, Towel streams them to its storage service and displays them in your web browser. You can search for and filter results, see nicely formatted errors, dig into test logs, view artifacts such as screenshots, and more.
|
22
4
|
|
23
5
|
## Usage
|
24
6
|
|
25
|
-
|
7
|
+
This repository holds several gems:
|
8
|
+
|
9
|
+
* `towel` -- The base gem that contains gRPC-generated code and support code that applies to all test frameworks. You won't use this directly.
|
10
|
+
* [towel-minitest](extensions/towel-minitest/README.md) -- Supports collecting Minitest results.
|
11
|
+
* [towel-rspec](extensions/towel-rspec/README.md) -- Supports collecting RSpec results.
|
26
12
|
|
27
13
|
## Development
|
28
14
|
|
@@ -32,7 +18,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
18
|
|
33
19
|
## Contributing
|
34
20
|
|
35
|
-
Bug reports and pull requests are welcome on
|
21
|
+
Bug reports and pull requests are welcome on Bitbucket at https://bitbucket.org/VelvetSoftware/towel-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
22
|
|
37
23
|
## License
|
38
24
|
|
@@ -40,4 +26,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
26
|
|
41
27
|
## Code of Conduct
|
42
28
|
|
43
|
-
Everyone interacting in the Towel project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://
|
29
|
+
Everyone interacting in the Towel project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://bitbucket.org/VelvetSoftware/towel-ruby/src/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# This is an example configuration file for Towel. It shows most of the
|
2
|
+
# different options that can be set, even though a normal config file will only
|
3
|
+
# have a subset of options specified. Towel uses TOML for configuration. It's a
|
4
|
+
# lot like INI, but well-defined. To get a feel for the syntax, look at
|
5
|
+
# https://github.com/toml-lang/toml/blob/v0.5.0/README.md
|
6
|
+
|
7
|
+
|
8
|
+
[auth]
|
9
|
+
# The Towel account that is reporting invocations. This is how your invocations
|
10
|
+
# are linked to you.
|
11
|
+
account = "wile.e.coyote@acme.corp"
|
12
|
+
|
13
|
+
# The API key to communicate with. DO NOT commit this or make this public to
|
14
|
+
# others that you do not want them to be able to report to Towel.
|
15
|
+
api_key = "AezKF3gPPyzD8dvgDYFYF9we5YP4R87UqhTzDxs3CnkY"
|
16
|
+
|
17
|
+
|
18
|
+
[collector]
|
19
|
+
# Where should results be reported to. This should be a hostname and port if
|
20
|
+
# non-standard (443). This allows you to point against different Towel instances
|
21
|
+
# (staging for example).
|
22
|
+
address = "localhost:10081"
|
23
|
+
|
24
|
+
# The organization handle for the organization that holds your Towel projects.
|
25
|
+
organization = "acme"
|
26
|
+
|
27
|
+
# The project handle for the project that invocations should be reported under.
|
28
|
+
project = "dynamite"
|
29
|
+
|
30
|
+
|
31
|
+
# This section is free-form. You can add whatever labels you would like to
|
32
|
+
# appear on all invocations reported using this configuration. This is useful
|
33
|
+
# for per-branch or per-environment annotations. NOTE: Only string values are
|
34
|
+
# allowed here.
|
35
|
+
[labels]
|
36
|
+
branch = "master"
|
37
|
+
environment = "test"
|
38
|
+
language = "ruby"
|
39
|
+
framework = "rspec"
|
@@ -10,14 +10,48 @@ module Towel
|
|
10
10
|
:close
|
11
11
|
|
12
12
|
def initialize(io)
|
13
|
-
super
|
13
|
+
super
|
14
14
|
@session = Towel::Session.new
|
15
|
+
@stdout = nil
|
16
|
+
@stderr = nil
|
17
|
+
@previous_stdout = nil
|
18
|
+
@previous_stderr = nil
|
19
|
+
@cancel_queue = Queue.new
|
20
|
+
|
21
|
+
# Start a thread to listen for cancellations. Cancel the invocation if
|
22
|
+
# requested. This exists because gRPC requests may not be made directly
|
23
|
+
# from within a signal handler. It appears that RSpec shutdown runs as
|
24
|
+
# such.
|
25
|
+
Thread.new do
|
26
|
+
cancelled = @cancel_queue.pop
|
27
|
+
@session.cancel_invocation if cancelled
|
28
|
+
end
|
15
29
|
end
|
16
30
|
|
17
31
|
def start(_notification)
|
18
32
|
super
|
33
|
+
|
19
34
|
url = @session.create_invocation
|
20
35
|
puts "View test results at #{url}"
|
36
|
+
|
37
|
+
# Register a cancellation handler
|
38
|
+
old_handler = Signal.trap("INT") do
|
39
|
+
@cancel_queue << true
|
40
|
+
# Mark the queue as closed so that other observers can determine if
|
41
|
+
# the run has been cancelled or not.
|
42
|
+
@cancel_queue.close
|
43
|
+
if old_handler.respond_to?(:call)
|
44
|
+
old_handler.call
|
45
|
+
else
|
46
|
+
raise Interrupt
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Capture logs
|
51
|
+
@previous_stdout = $stdout
|
52
|
+
$stdout = @stdout = Towel::LogIO.new(@session.create_log("STDOUT"))
|
53
|
+
@previous_stderr = $stderr
|
54
|
+
$stderr = @stderr = Towel::LogIO.new(@session.create_log("STDERR"))
|
21
55
|
end
|
22
56
|
|
23
57
|
def example_started(notification)
|
@@ -25,12 +59,14 @@ module Towel
|
|
25
59
|
example = notification.example
|
26
60
|
group = example_group.described_class.to_s + example_group.description
|
27
61
|
|
28
|
-
puts "CALLING create_result(#{group.inspect}, #{example.id.inspect})"
|
29
62
|
context = @session.create_result(
|
30
63
|
group,
|
31
64
|
example.id,
|
32
65
|
display_name: example.description
|
33
66
|
)
|
67
|
+
|
68
|
+
@stdout.context = context
|
69
|
+
@stderr.context = context
|
34
70
|
end
|
35
71
|
|
36
72
|
def example_finished(notification)
|
@@ -39,24 +75,48 @@ module Towel
|
|
39
75
|
group = example_group.described_class.to_s + example_group.description
|
40
76
|
|
41
77
|
state = case example.execution_result.status
|
42
|
-
when :passed then Towel::ResultState::
|
43
|
-
when :failed then Towel::ResultState::FAILURE
|
44
|
-
when :pending then Towel::ResultState::SKIPPED
|
45
|
-
else
|
46
|
-
status = example.execution_result.status
|
47
|
-
raise RuntimeError, "Unknown RSpec result state '#{status}'"
|
78
|
+
when :passed then Towel::V1alpha::ResultState::SUCCESS
|
79
|
+
when :failed then Towel::V1alpha::ResultState::FAILURE
|
80
|
+
when :pending then Towel::V1alpha::ResultState::SKIPPED
|
48
81
|
end
|
49
82
|
|
50
|
-
|
51
|
-
|
52
|
-
example.
|
53
|
-
|
54
|
-
|
83
|
+
duration = nil
|
84
|
+
unless state == Towel::V1alpha::ResultState::SKIPPED
|
85
|
+
duration = example.execution_result.run_time
|
86
|
+
end
|
87
|
+
|
88
|
+
description = nil
|
89
|
+
if state == Towel::V1alpha::ResultState::SKIPPED
|
90
|
+
description = example.execution_result.pending_message
|
91
|
+
elsif state == Towel::V1alpha::ResultState::FAILURE
|
92
|
+
description = example.execution_result.exception.message
|
93
|
+
end
|
94
|
+
|
95
|
+
# Cannot make a gRPC call from a signal handler, so check to make sure
|
96
|
+
# we aren't operating from one.
|
97
|
+
unless @cancel_queue.closed?
|
98
|
+
@session.update_result(
|
99
|
+
group,
|
100
|
+
example.id,
|
101
|
+
state: state,
|
102
|
+
duration: duration,
|
103
|
+
description: description
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
@stdout.context = nil
|
108
|
+
@stderr.context = nil
|
55
109
|
end
|
56
110
|
|
57
111
|
def close(_notification)
|
58
112
|
super
|
59
|
-
|
113
|
+
|
114
|
+
$stdout = @previous_stdout
|
115
|
+
$stderr = @previous_stderr
|
116
|
+
|
117
|
+
unless @cancel_queue.closed?
|
118
|
+
@session.finish_invocation
|
119
|
+
end
|
60
120
|
end
|
61
121
|
end
|
62
122
|
end
|
data/lib/towel/session.rb
CHANGED
@@ -25,7 +25,6 @@ module Towel
|
|
25
25
|
def create_invocation
|
26
26
|
invocation = Towel::V1alpha::Invocation.new
|
27
27
|
invocation.project = @project
|
28
|
-
invocation.labels["language"] = "ruby"
|
29
28
|
@config["labels"].each {|k, v| invocation.labels[k] = v }
|
30
29
|
invocation.start_time = Time.now.utc
|
31
30
|
|
data/lib/towel/version.rb
CHANGED
data/towel.gemspec
CHANGED
@@ -33,7 +33,7 @@ END
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib", "generated"]
|
35
35
|
|
36
|
-
spec.add_dependency "concurrent-ruby", "~> 1.
|
36
|
+
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
37
37
|
spec.add_dependency "grpc", "~> 1.22"
|
38
38
|
spec.add_dependency "toml", "~> 0.2"
|
39
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: towel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grpc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- extensions/towel-rspec/bin/console
|
167
167
|
- extensions/towel-rspec/bin/setup
|
168
168
|
- extensions/towel-rspec/examples/.rspec
|
169
|
+
- extensions/towel-rspec/examples/.towel.toml
|
169
170
|
- extensions/towel-rspec/examples/simple_spec.rb
|
170
171
|
- extensions/towel-rspec/lib/towel/rspec.rb
|
171
172
|
- extensions/towel-rspec/lib/towel/rspec/formatter.rb
|