tracing-matchers 1.1.1 → 1.1.2
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/README.md +23 -19
- data/lib/tracing/matchers.rb +3 -3
- data/lib/tracing/matchers/span_matchers.rb +6 -5
- data/lib/tracing/matchers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6a880779848aa77afcc2f07ed6b5308d61c9d56
|
4
|
+
data.tar.gz: 48fbcc28168a2d447a4792c3b45dfbe6f778ceb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1839cb9e6bf129c05e22ceb409aafec59976b7f86f812aca27afd8798a292a39eb204e84d19d98451608d76399f36047db779cc1849c9982c05634f91eb2e416
|
7
|
+
data.tar.gz: bd5dc512cfbf105a681b98a3474ab38c8acd79c7d3178671c32755ac04674841360ca59a44d412959f86205361845bd471b8f5e4ad6cbc037aea16351962f894
|
data/README.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
[](https://travis-ci.org/iaintshine/ruby-tracing-matchers)
|
2
|
+
|
1
3
|
# Tracing::Matchers
|
2
4
|
|
3
5
|
The gem exposes RSpec-compatible convenient one-liners, matchers, which you can use to test OpenTracing instrumentations, without having to use production OpenTracing Tracer e.g. Jaeger. It's expected that the gem will be used together with [test-tracer](https://github.com/iaintshine/ruby-test-tracer) - an OpenTracing compatible test Tracer implementation.
|
4
6
|
|
7
|
+
## Documentation
|
8
|
+
|
9
|
+
For far more detailed documentation and usage examples check [matchers.rb](https://github.com/iaintshine/ruby-tracing-matchers/blob/master/lib/tracing/matchers.rb), [span_matchers.rb](https://github.com/iaintshine/ruby-tracing-matchers/blob/master/lib/tracing/matchers/span_matchers.rb), specs and [rubydoc.info](http://www.rubydoc.info/gems/tracing-matchers).
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
@@ -27,30 +33,28 @@ expect(tracer).to have_traces(n)
|
|
27
33
|
expect(tracer).to have_spans(n)
|
28
34
|
.started
|
29
35
|
.finished
|
30
|
-
expect(tracer).to have_span(
|
36
|
+
expect(tracer).to have_span(operation_name)
|
31
37
|
.in_progress
|
32
|
-
.started
|
38
|
+
.started
|
33
39
|
.finished
|
34
|
-
.with_tags(
|
35
|
-
.with_logs
|
36
|
-
.with_log(
|
37
|
-
.with_baggage(
|
38
|
-
.child_of(operation_name
|
39
|
-
.following_after(operation_name
|
40
|
-
|
41
|
-
expect(span).to have_tag
|
42
|
-
expect(span).to have_tags
|
43
|
-
expect(span).to have_log
|
44
|
-
expect(span).to have_logs
|
45
|
-
expect(span).to have_baggage
|
46
|
-
expect(span).to have_baggage_item
|
40
|
+
.with_tags(*tags)
|
41
|
+
.with_logs(**fields)
|
42
|
+
.with_log(**fields)
|
43
|
+
.with_baggage(*baggage)
|
44
|
+
.child_of(operation_name|span|span_context)
|
45
|
+
.following_after(operation_name|span)
|
46
|
+
|
47
|
+
expect(span).to have_tag(*tags)
|
48
|
+
expect(span).to have_tags(*tags)
|
49
|
+
expect(span).to have_log(**fields)
|
50
|
+
expect(span).to have_logs(**fields)
|
51
|
+
expect(span).to have_baggage(*baggage)
|
52
|
+
expect(span).to have_baggage_item(*baggage)
|
47
53
|
expect(span).to have_parent
|
48
|
-
expect(span).to be_child_of
|
49
|
-
expect(span).to follow_after(
|
54
|
+
expect(span).to be_child_of(opration_name|span|span_context)
|
55
|
+
expect(span).to follow_after(operation_name|span)
|
50
56
|
```
|
51
57
|
|
52
|
-
Detailed documentation and usage examples can be found in [matchers.rb](https://github.com/iaintshine/ruby-tracing-matchers/blob/master/lib/tracing/matchers.rb) file.
|
53
|
-
|
54
58
|
## Usage
|
55
59
|
|
56
60
|
High-level test examples.
|
data/lib/tracing/matchers.rb
CHANGED
@@ -6,7 +6,7 @@ require "tracing/matchers/have_span"
|
|
6
6
|
|
7
7
|
module Tracing
|
8
8
|
module Matchers
|
9
|
-
# The
|
9
|
+
# The have_traces matcher tests that the tracer traced any or a specific
|
10
10
|
# number of **traces**.
|
11
11
|
#
|
12
12
|
# @example
|
@@ -36,7 +36,7 @@ module Tracing
|
|
36
36
|
Tracing::Matchers::HaveTraces.new(n)
|
37
37
|
end
|
38
38
|
|
39
|
-
# The
|
39
|
+
# The have_spans matcher tests that the tracer traced any or a specific
|
40
40
|
# number of **spans**.
|
41
41
|
#
|
42
42
|
# @example
|
@@ -66,7 +66,7 @@ module Tracing
|
|
66
66
|
Tracing::Matchers::HaveSpans.new(n)
|
67
67
|
end
|
68
68
|
|
69
|
-
# The
|
69
|
+
# The have_span matcher tests that the tracer traced a span matching a criteria.
|
70
70
|
#
|
71
71
|
# @example
|
72
72
|
#
|
@@ -6,7 +6,7 @@ require "tracing/matchers/span/follow_after"
|
|
6
6
|
|
7
7
|
module Tracing
|
8
8
|
module Matchers
|
9
|
-
# The
|
9
|
+
# The have_tag matcher tests that the span includes tags.
|
10
10
|
# @example
|
11
11
|
#
|
12
12
|
# # Passes if span have any tag
|
@@ -22,7 +22,7 @@ module Tracing
|
|
22
22
|
end
|
23
23
|
alias :have_tags :have_tag
|
24
24
|
|
25
|
-
# The
|
25
|
+
# The have_log matcher tests that the span includes a tag.
|
26
26
|
# @example
|
27
27
|
#
|
28
28
|
# # Passes if span have any log
|
@@ -37,7 +37,7 @@ module Tracing
|
|
37
37
|
end
|
38
38
|
alias :have_logs :have_log
|
39
39
|
|
40
|
-
# The
|
40
|
+
# The have_baggage matcher tests that the span/span context includes baggage.
|
41
41
|
# @example
|
42
42
|
#
|
43
43
|
# # Passes if span have any baggage item
|
@@ -53,7 +53,7 @@ module Tracing
|
|
53
53
|
end
|
54
54
|
alias :have_baggage_item :have_baggage
|
55
55
|
|
56
|
-
# The
|
56
|
+
# The be_child_of matcher tests that the span/span context is a child of some other span/span context.
|
57
57
|
# @example
|
58
58
|
#
|
59
59
|
# # Passes if span is a child of any span
|
@@ -64,13 +64,14 @@ module Tracing
|
|
64
64
|
# expect(span).to be_child_of(parent_span)
|
65
65
|
# expect(span).to be_child_of(parent_span_context)
|
66
66
|
#
|
67
|
+
# @param [String, Span, SpanContext] parent
|
67
68
|
# @return [HaveBaggage]
|
68
69
|
def be_child_of(parent = :any)
|
69
70
|
Tracing::Matchers::Span::BeChildOf.new(parent)
|
70
71
|
end
|
71
72
|
alias :have_parent :be_child_of
|
72
73
|
|
73
|
-
# The
|
74
|
+
# The follow_after matcher tests that the span follows after some other span.
|
74
75
|
# @example
|
75
76
|
#
|
76
77
|
# # Passes if span follows after spcific span
|