test_bench-telemetry 2.0.0.0 → 2.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/test_bench/telemetry/controls/event/event_data.rb +15 -0
  3. data/lib/test_bench/telemetry/controls/event/metadata.rb +70 -0
  4. data/lib/test_bench/telemetry/controls/event.rb +112 -51
  5. data/lib/test_bench/telemetry/controls/event_data.rb +129 -0
  6. data/lib/test_bench/telemetry/controls/file.rb +84 -0
  7. data/lib/test_bench/telemetry/controls/handler.rb +48 -43
  8. data/lib/test_bench/telemetry/controls/{detail_level.rb → process_id.rb} +7 -3
  9. data/lib/test_bench/telemetry/controls/projection/receiver.rb +31 -0
  10. data/lib/test_bench/telemetry/controls/projection.rb +84 -0
  11. data/lib/test_bench/telemetry/controls/random.rb +1 -1
  12. data/lib/test_bench/telemetry/controls/sink.rb +23 -1
  13. data/lib/test_bench/telemetry/controls/time.rb +49 -2
  14. data/lib/test_bench/telemetry/controls.rb +10 -33
  15. data/lib/test_bench/telemetry/event.rb +74 -13
  16. data/lib/test_bench/telemetry/{event → event_data}/serialization.rb +78 -53
  17. data/lib/test_bench/telemetry/event_data.rb +13 -0
  18. data/lib/test_bench/telemetry/sink/file.rb +3 -3
  19. data/lib/test_bench/telemetry/sink/handler/event_registry.rb +42 -0
  20. data/lib/test_bench/telemetry/sink/handler.rb +54 -30
  21. data/lib/test_bench/telemetry/sink/projection.rb +132 -0
  22. data/lib/test_bench/telemetry/sink.rb +11 -0
  23. data/lib/test_bench/telemetry/substitute/sink.rb +83 -0
  24. data/lib/test_bench/telemetry/substitute.rb +13 -46
  25. data/lib/test_bench/telemetry/telemetry.rb +60 -19
  26. data/lib/test_bench/telemetry.rb +8 -10
  27. metadata +17 -40
  28. data/lib/test_bench/telemetry/controls/capture_sink/path.rb +0 -30
  29. data/lib/test_bench/telemetry/controls/capture_sink/record.rb +0 -21
  30. data/lib/test_bench/telemetry/controls/comment.rb +0 -19
  31. data/lib/test_bench/telemetry/controls/error.rb +0 -36
  32. data/lib/test_bench/telemetry/controls/events/asserted.rb +0 -32
  33. data/lib/test_bench/telemetry/controls/events/commented.rb +0 -26
  34. data/lib/test_bench/telemetry/controls/events/context_entered.rb +0 -31
  35. data/lib/test_bench/telemetry/controls/events/context_exited.rb +0 -34
  36. data/lib/test_bench/telemetry/controls/events/context_skipped.rb +0 -31
  37. data/lib/test_bench/telemetry/controls/events/detail_decreased.rb +0 -23
  38. data/lib/test_bench/telemetry/controls/events/detail_increased.rb +0 -23
  39. data/lib/test_bench/telemetry/controls/events/error_raised.rb +0 -26
  40. data/lib/test_bench/telemetry/controls/events/file_entered.rb +0 -29
  41. data/lib/test_bench/telemetry/controls/events/file_exited.rb +0 -32
  42. data/lib/test_bench/telemetry/controls/events/fixture_finished.rb +0 -29
  43. data/lib/test_bench/telemetry/controls/events/fixture_started.rb +0 -26
  44. data/lib/test_bench/telemetry/controls/events/run_aborted.rb +0 -29
  45. data/lib/test_bench/telemetry/controls/events/run_finished.rb +0 -32
  46. data/lib/test_bench/telemetry/controls/events/run_started.rb +0 -29
  47. data/lib/test_bench/telemetry/controls/events/test_finished.rb +0 -34
  48. data/lib/test_bench/telemetry/controls/events/test_skipped.rb +0 -31
  49. data/lib/test_bench/telemetry/controls/events/test_started.rb +0 -31
  50. data/lib/test_bench/telemetry/controls/events.rb +0 -27
  51. data/lib/test_bench/telemetry/controls/fixture_name.rb +0 -19
  52. data/lib/test_bench/telemetry/controls/line_number.rb +0 -10
  53. data/lib/test_bench/telemetry/controls/path.rb +0 -87
  54. data/lib/test_bench/telemetry/controls/result.rb +0 -12
  55. data/lib/test_bench/telemetry/controls/title.rb +0 -43
  56. data/lib/test_bench/telemetry/event/events.rb +0 -35
  57. data/lib/test_bench/telemetry/event/type.rb +0 -27
  58. data/lib/test_bench/telemetry/sink/capture/path.rb +0 -69
  59. data/lib/test_bench/telemetry/sink/capture/record/generate.rb +0 -49
  60. data/lib/test_bench/telemetry/sink/capture/record.rb +0 -73
  61. data/lib/test_bench/telemetry/sink/capture.rb +0 -55
@@ -1,30 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module CaptureSink
5
- module Path
6
- def self.example(segments=nil)
7
- segments ||= Segment.examples
8
-
9
- segments = segments.dup
10
-
11
- path = TestBench::Telemetry::Sink::Capture::Path.new
12
- path.segments = segments
13
- path
14
- end
15
-
16
- module Segment
17
- def self.examples
18
- [example, Context.other_example, Test.example]
19
- end
20
-
21
- def self.example = Context.example
22
-
23
- Test = Title::Test
24
- Context = Title::Context
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,21 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module CaptureSink
5
- module Record
6
- def self.example(event: nil, path: nil, detail_level: nil)
7
- event ||= self.event
8
- path ||= self.path
9
- detail_level ||= self.detail_level
10
-
11
- TestBench::Telemetry::Sink::Capture::Record.new(event, path, detail_level)
12
- end
13
-
14
- def self.event = Event.example
15
- def self.path = Path.example
16
- def self.detail_level = DetailLevel.example
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,19 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Comment
5
- def self.example(suffix=nil)
6
- suffix = " #{suffix}" if not suffix.nil?
7
-
8
- "Some comment#{suffix}"
9
- end
10
-
11
- def self.random
12
- suffix = Random.string
13
-
14
- example(suffix)
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,36 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Error
5
- module Text
6
- def self.example(message: nil, label: nil, path: nil, line_number: nil, exception_class: nil)
7
- message ||= self.message
8
- label ||= self.label
9
- path ||= self.path
10
- line_number ||= self.line_number
11
- exception_class ||= self.exception_class
12
-
13
- "#{path}:#{line_number}:in `#{label}': \e[1m#{message} (\e[4m#{exception_class}\e[24m)\e[m"
14
- end
15
-
16
- def self.random
17
- message = "#{self.message} #{Random.string}"
18
- label = "#{self.label}_#{Random.string}"
19
- path = Path::Absolute::Local.random
20
- line_number = LineNumber.random
21
-
22
- example(message:, label:, path:, line_number:)
23
- end
24
-
25
- def self.message = "Some error message"
26
- def self.label = 'some_method'
27
- def self.path = Path::Absolute::Local.example
28
- def self.line_number = LineNumber.example
29
- def self.exception_class = Example
30
- end
31
-
32
- Example = Class.new(RuntimeError)
33
- end
34
- end
35
- end
36
- end
@@ -1,32 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module Asserted
6
- def self.example(result: nil, path: nil, line_number: nil, time: nil)
7
- result ||= self.result
8
- path ||= self.path
9
- line_number ||= self.line_number
10
- time ||= self.time
11
-
12
- TestBench::Telemetry::Event::Asserted.new(result, path, line_number, time)
13
- end
14
-
15
- def self.random
16
- result = Result.random
17
- path = Path.random
18
- line_number = LineNumber.random
19
- time = Time.random
20
-
21
- example(result:, path:, line_number:, time:)
22
- end
23
-
24
- def self.result = Result.example
25
- def self.path = Path.example
26
- def self.line_number = LineNumber.example
27
- def self.time = Time.example
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,26 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module Commented
6
- def self.example(comment: nil, time: nil)
7
- comment ||= self.comment
8
- time ||= self.time
9
-
10
- TestBench::Telemetry::Event::Commented.new(comment, time)
11
- end
12
-
13
- def self.random
14
- comment = Comment.random
15
- time = Time.random
16
-
17
- example(comment:, time:)
18
- end
19
-
20
- def self.comment = Comment.example
21
- def self.time = Time.example
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,31 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module ContextEntered
6
- def self.example(title: nil, time: nil)
7
- time ||= self.time
8
-
9
- if title == :none
10
- title = nil
11
- else
12
- title ||= self.title
13
- end
14
-
15
- TestBench::Telemetry::Event::ContextEntered.new(title, time)
16
- end
17
-
18
- def self.random
19
- title = Title::Context.random
20
- time = Time.random
21
-
22
- example(title:, time:)
23
- end
24
-
25
- def self.title = Title::Context.example
26
- def self.time = Time.example
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,34 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module ContextExited
6
- def self.example(result: nil, title: nil, time: nil)
7
- result ||= self.result
8
- time ||= self.time
9
-
10
- if title == :none
11
- title = nil
12
- else
13
- title ||= self.title
14
- end
15
-
16
- TestBench::Telemetry::Event::ContextExited.new(result, title, time)
17
- end
18
-
19
- def self.random
20
- result = Result.random
21
- title = Title::Context.random
22
- time = Time.random
23
-
24
- example(result:, title:, time:)
25
- end
26
-
27
- def self.result = Result.example
28
- def self.title = Title::Context.example
29
- def self.time = Time.example
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,31 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module ContextSkipped
6
- def self.example(title: nil, time: nil)
7
- time ||= self.time
8
-
9
- if title == :none
10
- title = nil
11
- else
12
- title ||= self.title
13
- end
14
-
15
- TestBench::Telemetry::Event::ContextSkipped.new(title, time)
16
- end
17
-
18
- def self.random
19
- title = Title::Context.random
20
- time = Time.random
21
-
22
- example(title:, time:)
23
- end
24
-
25
- def self.title = Title::Context.example
26
- def self.time = Time.example
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,23 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module DetailDecreased
6
- def self.example(time: nil)
7
- time ||= self.time
8
-
9
- TestBench::Telemetry::Event::DetailDecreased.new(time)
10
- end
11
-
12
- def self.random
13
- time = Time.random
14
-
15
- example(time:)
16
- end
17
-
18
- def self.time = Time.example
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module DetailIncreased
6
- def self.example(time: nil)
7
- time ||= self.time
8
-
9
- TestBench::Telemetry::Event::DetailIncreased.new(time)
10
- end
11
-
12
- def self.random
13
- time = Time.random
14
-
15
- example(time:)
16
- end
17
-
18
- def self.time = Time.example
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,26 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module ErrorRaised
6
- def self.example(error_text: nil, time: nil)
7
- error_text ||= self.error_text
8
- time ||= self.time
9
-
10
- TestBench::Telemetry::Event::ErrorRaised.new(error_text, time)
11
- end
12
-
13
- def self.random
14
- error_text = Error::Text.random
15
- time = Time.random
16
-
17
- example(error_text:, time:)
18
- end
19
-
20
- def self.error_text = Error::Text.example
21
- def self.time = Time.example
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module FileEntered
6
- def self.example(path: nil, executor: nil, time: nil)
7
- path ||= self.path
8
- executor ||= self.executor
9
- time ||= self.time
10
-
11
- TestBench::Telemetry::Event::FileEntered.new(path, executor, time)
12
- end
13
-
14
- def self.random
15
- path = Path.random
16
- executor = Random.integer % self.executor
17
- time = Time.random
18
-
19
- example(path:, executor:, time:)
20
- end
21
-
22
- def self.path = Path.example
23
- def self.executor = 1
24
- def self.time = Time.example
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module FileExited
6
- def self.example(result: nil, path: nil, executor: nil, time: nil)
7
- result ||= self.result
8
- path ||= self.path
9
- executor ||= self.executor
10
- time ||= self.time
11
-
12
- TestBench::Telemetry::Event::FileExited.new(result, path, executor, time)
13
- end
14
-
15
- def self.random
16
- result = Result.random
17
- path = Path.random
18
- executor = Random.integer % self.executor
19
- time = Time.random
20
-
21
- example(result:, path:, executor:, time:)
22
- end
23
-
24
- def self.result = Result.example
25
- def self.path = Path.example
26
- def self.executor = 1
27
- def self.time = Time.example
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,29 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module FixtureFinished
6
- def self.example(result: nil, name: nil, time: nil)
7
- result ||= self.result
8
- name ||= self.fixture_name
9
- time ||= self.time
10
-
11
- TestBench::Telemetry::Event::FixtureFinished.new(result, name, time)
12
- end
13
-
14
- def self.random
15
- result = Result.random
16
- name = FixtureName.random
17
- time = Time.random
18
-
19
- example(result:, name:, time:)
20
- end
21
-
22
- def self.result = Result.example
23
- def self.fixture_name = FixtureName.example
24
- def self.time = Time.example
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,26 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module FixtureStarted
6
- def self.example(name: nil, time: nil)
7
- name ||= self.fixture_name
8
- time ||= self.time
9
-
10
- TestBench::Telemetry::Event::FixtureStarted.new(name, time)
11
- end
12
-
13
- def self.random
14
- name = FixtureName.random
15
- time = Time.random
16
-
17
- example(name:, time:)
18
- end
19
-
20
- def self.fixture_name = FixtureName.example
21
- def self.time = Time.example
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module RunAborted
6
- def self.example(random_seed: nil, executors: nil, time: nil)
7
- random_seed ||= self.random_seed
8
- executors ||= self.executors
9
- time ||= self.time
10
-
11
- TestBench::Telemetry::Event::RunAborted.new(random_seed, executors, time)
12
- end
13
-
14
- def self.random
15
- random_seed = Random.integer
16
- executors = Random.integer % self.executors
17
- time = Time.random
18
-
19
- example(random_seed:, executors:, time:)
20
- end
21
-
22
- def self.random_seed = 1
23
- def self.executors = 11
24
- def self.time = Time.example
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module RunFinished
6
- def self.example(result: nil, random_seed: nil, executors: nil, time: nil)
7
- result ||= self.result
8
- random_seed ||= self.random_seed
9
- executors ||= self.executors
10
- time ||= self.time
11
-
12
- TestBench::Telemetry::Event::RunFinished.new(result, random_seed, executors, time)
13
- end
14
-
15
- def self.random
16
- result = Result.random
17
- random_seed = Random.integer
18
- executors = Random.integer % self.executors
19
- time = Time.random
20
-
21
- example(result:, random_seed:, executors:, time:)
22
- end
23
-
24
- def self.result = Result.example
25
- def self.random_seed = RunStarted.random_seed
26
- def self.executors = RunStarted.executors
27
- def self.time = Time.example
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,29 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module RunStarted
6
- def self.example(random_seed: nil, executors: nil, time: nil)
7
- random_seed ||= self.random_seed
8
- executors ||= self.executors
9
- time ||= self.time
10
-
11
- TestBench::Telemetry::Event::RunStarted.new(random_seed, executors, time)
12
- end
13
-
14
- def self.random
15
- random_seed = Random.integer
16
- executors = Random.integer % self.executors
17
- time = Time.random
18
-
19
- example(random_seed:, executors:, time:)
20
- end
21
-
22
- def self.random_seed = 1
23
- def self.executors = 11
24
- def self.time = Time.example
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,34 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module TestFinished
6
- def self.example(result: nil, title: nil, time: nil)
7
- result ||= self.result
8
- time ||= self.time
9
-
10
- if title == :none
11
- title = nil
12
- else
13
- title ||= self.title
14
- end
15
-
16
- TestBench::Telemetry::Event::TestFinished.new(result, title, time)
17
- end
18
-
19
- def self.random
20
- result = Result.random
21
- title = Title::Test.random
22
- time = Time.random
23
-
24
- example(result:, title:, time:)
25
- end
26
-
27
- def self.result = Result.example
28
- def self.title = Title::Test.example
29
- def self.time = Time.example
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,31 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module TestSkipped
6
- def self.example(title: nil, time: nil)
7
- time ||= self.time
8
-
9
- if title == :none
10
- title = nil
11
- else
12
- title ||= self.title
13
- end
14
-
15
- TestBench::Telemetry::Event::TestSkipped.new(title, time)
16
- end
17
-
18
- def self.random
19
- title = Title::Test.random
20
- time = Time.random
21
-
22
- example(title:, time:)
23
- end
24
-
25
- def self.title = Title::Test.example
26
- def self.time = Time.example
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- module TestStarted
6
- def self.example(title: nil, time: nil)
7
- time ||= self.time
8
-
9
- if title == :none
10
- title = nil
11
- else
12
- title ||= self.title
13
- end
14
-
15
- TestBench::Telemetry::Event::TestStarted.new(title, time)
16
- end
17
-
18
- def self.random
19
- title = Title::Test.random
20
- time = Time.random
21
-
22
- example(title:, time:)
23
- end
24
-
25
- def self.title = Title::Test.example
26
- def self.time = Time.example
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,27 +0,0 @@
1
- module TestBench
2
- class Telemetry
3
- module Controls
4
- module Events
5
- def self.each_example(random: nil, &block)
6
- examples(random:).each(&block)
7
- end
8
-
9
- def self.examples(random: nil)
10
- random ||= false
11
-
12
- if random
13
- method_name = :random
14
- else
15
- method_name = :example
16
- end
17
-
18
- controls = TestBench::Telemetry::Event.each_event_type.map do |event_type|
19
- const_get(event_type)
20
- end
21
-
22
- controls.map(&method_name)
23
- end
24
- end
25
- end
26
- end
27
- end