cucumber-pro 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/pro/README.md +153 -0
- data/lib/cucumber/pro/info.rb +19 -0
- data/lib/cucumber/pro/version +1 -1
- data/spec/cucumber/pro/info_spec.rb +11 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a57bcad6666fb5df2180cb02c2206bc18fe2bf99
|
4
|
+
data.tar.gz: 5957942d5725e1f253d222763e2e2493aaa69307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47a6059e95e4e5c381f33d74f2875785cfba2ca3a0cb47d77427b4fb8200cd6d33dcac1e9ab4dc83002eb676a418abdfb3b7a379172b64db0cbda4bf3dd8810a
|
7
|
+
data.tar.gz: c4efd4814be45731a516aeb7247584cab215696b6a280bfd2fa922641e9108f03bdf4bb30014452d8f7332b59c61d3d42e9a9fc3a636a91c0043d6c6d304b8ce
|
@@ -0,0 +1,153 @@
|
|
1
|
+
Metarepo is a service for storing and retrieving metadata about files in
|
2
|
+
a repository.
|
3
|
+
|
4
|
+
Metarepo is both a standalone server (for receiving and storing metadata via
|
5
|
+
a WebSocket connection) and a library (npm module) for querying stored metadata.
|
6
|
+
|
7
|
+
The typical use case is an application that displays files in a repository
|
8
|
+
such as Git or Subversion where there is additional information about files
|
9
|
+
that can't live in Git/Subversion. For example:
|
10
|
+
|
11
|
+
* Comments or discussions about a file
|
12
|
+
* Information about a line in a file
|
13
|
+
|
14
|
+
Metarepo stores this extra information (metadata) about files.
|
15
|
+
Each little piece of information has the following attributes:
|
16
|
+
|
17
|
+
* `url` (what repository is it)
|
18
|
+
* `rev` (what branch does the file live in)
|
19
|
+
* `rev` (what revision of the file is it)
|
20
|
+
* `group` (grouping metadata for the same url+rev) - typically a CI run id.
|
21
|
+
* `path` (where is the file)
|
22
|
+
* `location` (where in the file should the metadata be attached - currently a line number)
|
23
|
+
* `mime_type` (what kind of data)
|
24
|
+
* `json_body` (the metadata)
|
25
|
+
|
26
|
+
This is split up over 3 tables:
|
27
|
+
|
28
|
+
+-------+ +--------+ +-----------+
|
29
|
+
| repos +-----> | group +-----> | metadata |
|
30
|
+
+-------+ +--------+ +-----------+
|
31
|
+
| url | | branch | | path |
|
32
|
+
+-------+ | rev | | location |
|
33
|
+
| group | | mime_type |
|
34
|
+
+--------+ | json_body |
|
35
|
+
+-----------+
|
36
|
+
|
37
|
+
|
38
|
+
Here are some examples of metadata:
|
39
|
+
|
40
|
+
## Ruby Stacktrace
|
41
|
+
|
42
|
+
mime_type: text/vnd.cucumber-pro.stacktrace.ruby+plain
|
43
|
+
json_body: { "text" : "some ruby stacktrace" }
|
44
|
+
|
45
|
+
## Screenshot
|
46
|
+
|
47
|
+
mime_type: image/png
|
48
|
+
json_body: { "path" : "path/within/s3" }
|
49
|
+
|
50
|
+
See below about the protocol for storing binary attachments.
|
51
|
+
|
52
|
+
## Test Case result (typically a Cucumber Scenario, but could also be from RSpec, JUnit etc)
|
53
|
+
|
54
|
+
mime_type: application/vnd.cucumber-pro.test-case-result+json
|
55
|
+
json_body: { "status" : "failed" }
|
56
|
+
|
57
|
+
|
58
|
+
## Test Step result (Cucumber Step)
|
59
|
+
|
60
|
+
application/vnd.cucumber.test-step-result+json
|
61
|
+
json_body: { "status" : "failed" }
|
62
|
+
|
63
|
+
## Discussion
|
64
|
+
|
65
|
+
mime_type: application/vnd.cucumber-pro.discussion-message+json
|
66
|
+
json_body: { "who": "matt", "message": "I like this" }
|
67
|
+
|
68
|
+
Metadata can be stored with WebSockets (for the standalone mode) and retrieved with method calls
|
69
|
+
(in the npm module mode).
|
70
|
+
|
71
|
+
# Hacking
|
72
|
+
|
73
|
+
## Create the local databases
|
74
|
+
|
75
|
+
```
|
76
|
+
createdb metarepo-test
|
77
|
+
createdb metarepo-development
|
78
|
+
createuser -s -r postgres
|
79
|
+
```
|
80
|
+
|
81
|
+
Run the tests (this will automatically migrate the databases):
|
82
|
+
|
83
|
+
```
|
84
|
+
npm test
|
85
|
+
```
|
86
|
+
|
87
|
+
# Try it out
|
88
|
+
|
89
|
+
## Fire up the server
|
90
|
+
|
91
|
+
```
|
92
|
+
DEBUG="metarepo:*,omnirepo:*,svnlite:*" npm start
|
93
|
+
```
|
94
|
+
|
95
|
+
## Store some metadata over the WebSocket API
|
96
|
+
|
97
|
+
First, you need the `authToken` of a cpro user, which you will find in mongodb.
|
98
|
+
|
99
|
+
Connect a WebSocket
|
100
|
+
|
101
|
+
```
|
102
|
+
./node_modules/.bin/wscat --connect ws://localhost:5000/ws?token=authToken
|
103
|
+
```
|
104
|
+
|
105
|
+
Or if you want to do it on Heroku:
|
106
|
+
|
107
|
+
```
|
108
|
+
./node_modules/.bin/wscat --no-check --connect wss://results.cucumber.pro/ws?token=authToken
|
109
|
+
```
|
110
|
+
|
111
|
+
Initiate the session
|
112
|
+
|
113
|
+
```json
|
114
|
+
{ "repo_url": "memory://metarepo/test", "rev": "1", "branch": "master", "group": "run-1", "info": {} }
|
115
|
+
```
|
116
|
+
|
117
|
+
Store some metadata
|
118
|
+
|
119
|
+
```json
|
120
|
+
{ "path": "hello/world.feature", "location": 2, "mime_type": "application/vnd.cucumber.test-case-result+json", "body": { "status": "passed" } }
|
121
|
+
{ "path": "hello/world.feature", "location": 3, "mime_type": "application/vnd.cucumber.test-case-result+json", "body": { "status": "failed" } }
|
122
|
+
{ "path": "hello/world.feature", "location": 4, "mime_type": "application/vnd.cucumber.test-case-result+json", "body": { "status": "pending" } }
|
123
|
+
```
|
124
|
+
|
125
|
+
Query the database:
|
126
|
+
|
127
|
+
```sql
|
128
|
+
SELECT json_body->>'status' AS status, count(json_body) FROM metadata GROUP BY json_body->>'status';
|
129
|
+
```
|
130
|
+
|
131
|
+
The `PgStore.aggregateResult` method uses a similar query to report aggregate results.
|
132
|
+
|
133
|
+
## Storing blobs
|
134
|
+
|
135
|
+
The protocol for storing metadata where the body is a blob (such as an image) is
|
136
|
+
to send two messages where the first one is a regular metadata JSON message
|
137
|
+
*without* the body field set.
|
138
|
+
|
139
|
+
When the `body` field is not set, metarepo expects the next message to be a *binary* message.
|
140
|
+
The body of the binary message will be stored in an external store (S3), and the metadata record
|
141
|
+
in the database will point to the path of the file in S3.
|
142
|
+
|
143
|
+
## BUGS
|
144
|
+
|
145
|
+
2) Not storing timezones
|
146
|
+
|
147
|
+
See http://www.craigkerstiens.com/2014/05/07/Postgres-datatypes-the-ones-youre-not-using/
|
148
|
+
|
149
|
+
## Release process
|
150
|
+
|
151
|
+
npm version NEW_VERSION
|
152
|
+
npm publish
|
153
|
+
git push --tags
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'etc'
|
3
|
+
require 'cucumber/platform'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module Pro
|
7
|
+
class Info
|
8
|
+
def to_h
|
9
|
+
{
|
10
|
+
os: "#{RbConfig::CONFIG['host_os']} (#{RbConfig::CONFIG['host_cpu']})",
|
11
|
+
platform_version: "#{RbConfig::CONFIG['ruby_install_name']} #{RbConfig::CONFIG['ruby_version']}",
|
12
|
+
tool_version: "cucumber-ruby #{Cucumber::VERSION}}",
|
13
|
+
os_user: Etc.getlogin,
|
14
|
+
client_version: "cucumber-pro-ruby #{File.read(File.dirname(__FILE__) + '/version').strip}"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/cucumber/pro/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wynne
|
@@ -158,10 +158,13 @@ files:
|
|
158
158
|
- features/support/fake_results_service.rb
|
159
159
|
- features/support/world.rb
|
160
160
|
- lib/cucumber/pro.rb
|
161
|
+
- lib/cucumber/pro/README.md
|
161
162
|
- lib/cucumber/pro/formatter.rb
|
163
|
+
- lib/cucumber/pro/info.rb
|
162
164
|
- lib/cucumber/pro/scm.rb
|
163
165
|
- lib/cucumber/pro/version
|
164
166
|
- lib/cucumber/pro/web_socket/session.rb
|
167
|
+
- spec/cucumber/pro/info_spec.rb
|
165
168
|
- spec/cucumber/pro/scm/git_repo_spec.rb
|
166
169
|
- spec/cucumber/pro/web_socket/worker_spec.rb
|
167
170
|
- tmp/.gitkeep
|
@@ -189,7 +192,7 @@ rubyforge_project:
|
|
189
192
|
rubygems_version: 2.0.14
|
190
193
|
signing_key:
|
191
194
|
specification_version: 4
|
192
|
-
summary: cucumber-pro-0.0.
|
195
|
+
summary: cucumber-pro-0.0.8
|
193
196
|
test_files:
|
194
197
|
- features/publish_results.feature
|
195
198
|
- features/security.feature
|
@@ -198,6 +201,7 @@ test_files:
|
|
198
201
|
- features/support/env.rb
|
199
202
|
- features/support/fake_results_service.rb
|
200
203
|
- features/support/world.rb
|
204
|
+
- spec/cucumber/pro/info_spec.rb
|
201
205
|
- spec/cucumber/pro/scm/git_repo_spec.rb
|
202
206
|
- spec/cucumber/pro/web_socket/worker_spec.rb
|
203
207
|
has_rdoc:
|