test_bench-bootstrap 6.1.1 → 7.0.0
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/executables/bench-bootstrap +7 -0
- data/lib/test_bench_bootstrap/controls.rb +1 -0
- data/lib/test_bench_bootstrap/test_bench_bootstrap.rb +7 -0
- data/lib/test_bench_bootstrap.rb +4 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls/namespace.rb +84 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls.rb +1 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/import_constants.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/macro.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/import_constants.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls/telemetry_sink.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls.rb +3 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/run.rb +12 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/standard_input.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/defaults.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/executable.rb +61 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/parse_arguments.rb +271 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/build.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/comment_style.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/exception.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/fixture.rb +69 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/output.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/session.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/text.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/title.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls.rb +14 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/evaluate.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +213 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/comment_style.rb +63 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/comment_style.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/event.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/aborted.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/commented.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/detailed.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/failed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_executed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_not_found.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_queued.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/skipped.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/session.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/style.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/text.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls.rb +26 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/detail_policy.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/null.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/substitute.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device.rb +75 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/get.rb +32 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/level.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +572 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/style.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/substitute.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer.rb +119 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/seed.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/sequence.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/defaults.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator/substitute.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator.rb +64 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/iterator.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/random.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/events.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/session.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/status.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/info.rb +108 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/totals.rb +38 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/run.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/telemetry.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/time.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/run.rb +146 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/substitute.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary/substitute.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary.rb +477 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace/location.rb +48 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/comment_disposition.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/event.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/aborted.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/commented.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_finished.rb +112 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/detailed.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/failed.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_executed.rb +101 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_not_found.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_queued.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/skipped.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_finished.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/message.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/raise.rb +52 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception.rb +81 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/message.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/metadata.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/apex_directory.rb +76 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file/create.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path.rb +87 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/result.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/sequence.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/status.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry_sink.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/text.rb +33 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/title.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/defaults.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/events.rb +24 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace/substitute.rb +34 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +114 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate.rb +159 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/result.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +236 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/status.rb +60 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute/sink.rb +99 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +154 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/trace.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session.rb +22 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event/metadata.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event.rb +156 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event_data.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/handler.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/path/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/process_id.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/random.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/sink.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/time.rb +104 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event.rb +130 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data/serialization.rb +85 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler/event_registry.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler.rb +128 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute/sink.rb +71 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/telemetry.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry.rb +18 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench.rb +4 -0
- metadata +353 -16
- data/lib/test_bench/bootstrap.rb +0 -328
@@ -0,0 +1,156 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module Event
|
6
|
+
def self.example(some_attribute: nil, some_other_attribute: nil, event_class: nil, metadata: nil, process_id: nil, time: nil)
|
7
|
+
some_attribute ||= self.some_attribute
|
8
|
+
some_other_attribute ||= self.some_other_attribute
|
9
|
+
|
10
|
+
metadata ||= Metadata.example(process_id:, time:)
|
11
|
+
event_class ||= SomeEvent
|
12
|
+
|
13
|
+
event = event_class.new
|
14
|
+
event.some_attribute = some_attribute
|
15
|
+
event.some_other_attribute = some_other_attribute
|
16
|
+
event.metadata = metadata
|
17
|
+
event
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.event_data
|
21
|
+
event = self.example
|
22
|
+
Telemetry::Event::Export.(event)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.other_example
|
26
|
+
Other.example
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.random
|
30
|
+
Random.example(event_class:)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.event_class
|
34
|
+
SomeEvent
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.some_attribute
|
38
|
+
'some-value'
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.some_other_attribute
|
42
|
+
'some-alternate-value'
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.process_id
|
46
|
+
EventData.process_id
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.time
|
50
|
+
EventData.time
|
51
|
+
end
|
52
|
+
|
53
|
+
SomeEvent = Telemetry::Event.define(
|
54
|
+
:some_attribute,
|
55
|
+
:some_other_attribute
|
56
|
+
)
|
57
|
+
|
58
|
+
SomeOtherEvent = Telemetry::Event.define(
|
59
|
+
:some_attribute,
|
60
|
+
:some_other_attribute
|
61
|
+
)
|
62
|
+
|
63
|
+
module Other
|
64
|
+
def self.example(some_attribute: nil, some_other_attribute: nil, metadata: nil, process_id: nil, time: nil)
|
65
|
+
some_attribute ||= self.some_attribute
|
66
|
+
some_other_attribute ||= self.some_other_attribute
|
67
|
+
metadata ||= Metadata::Other.example(process_id:, time:)
|
68
|
+
|
69
|
+
Event.example(some_attribute:, some_other_attribute:, event_class:, metadata:)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.event_class
|
73
|
+
SomeOtherEvent
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.some_attribute
|
77
|
+
'some-other-value'
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.some_other_attribute
|
81
|
+
'some-other-alternate-value'
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.event_data
|
85
|
+
event = self.example
|
86
|
+
Telemetry::Event::Export.(event)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
module Random
|
91
|
+
def self.example(some_attribute: nil, some_other_attribute: nil, event_class: nil, metadata: nil, process_id: nil, time: nil)
|
92
|
+
some_attribute ||= self.some_attribute
|
93
|
+
some_other_attribute ||= self.some_other_attribute
|
94
|
+
event_class ||= self.event_class
|
95
|
+
metadata ||= Metadata::Random.example(process_id:, time:)
|
96
|
+
|
97
|
+
Event.example(some_attribute:, some_other_attribute:, event_class:, metadata:)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.event_class
|
101
|
+
if Controls::Random.boolean
|
102
|
+
SomeEvent
|
103
|
+
else
|
104
|
+
SomeOtherEvent
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.some_attribute
|
109
|
+
suffix = Controls::Random.string
|
110
|
+
|
111
|
+
"#{Event.some_attribute}-#{suffix}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.some_other_attribute
|
115
|
+
suffix = Controls::Random.string
|
116
|
+
|
117
|
+
"#{Event.some_other_attribute}-#{suffix}"
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.event_data
|
121
|
+
event = self.example
|
122
|
+
Telemetry::Event::Export.(event)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
module Data
|
127
|
+
def self.example
|
128
|
+
some_attribute = Event.some_attribute
|
129
|
+
some_other_attribute = Event.some_other_attribute
|
130
|
+
|
131
|
+
[some_attribute, some_other_attribute]
|
132
|
+
end
|
133
|
+
|
134
|
+
module Other
|
135
|
+
def self.example
|
136
|
+
some_attribute = Event::Other.some_attribute
|
137
|
+
some_other_attribute = Event::Other.some_other_attribute
|
138
|
+
|
139
|
+
[some_attribute, some_other_attribute]
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
module Random
|
144
|
+
def self.example
|
145
|
+
some_attribute = Event::Random.some_attribute
|
146
|
+
some_other_attribute = Event::Random.some_other_attribute
|
147
|
+
|
148
|
+
[some_attribute, some_other_attribute]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module EventData
|
6
|
+
def self.example(type: nil, process_id: nil, time: nil, data: nil)
|
7
|
+
type ||= self.type
|
8
|
+
data ||= self.data
|
9
|
+
|
10
|
+
if process_id == :none
|
11
|
+
process_id = nil
|
12
|
+
else
|
13
|
+
process_id ||= self.process_id
|
14
|
+
end
|
15
|
+
|
16
|
+
if time == :none
|
17
|
+
time = nil
|
18
|
+
else
|
19
|
+
time ||= self.time
|
20
|
+
end
|
21
|
+
|
22
|
+
event_data = Telemetry::EventData.new
|
23
|
+
event_data.type = type
|
24
|
+
event_data.process_id = process_id
|
25
|
+
event_data.time = time
|
26
|
+
event_data.data = data
|
27
|
+
event_data
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.random
|
31
|
+
Random.example
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.type
|
35
|
+
Type.example
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.process_id
|
39
|
+
ProcessID.example
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.time
|
43
|
+
Time.example
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.data
|
47
|
+
Data.example
|
48
|
+
end
|
49
|
+
|
50
|
+
module Random
|
51
|
+
def self.example(type: nil, process_id: nil, time: nil, data: nil)
|
52
|
+
type ||= Type.random
|
53
|
+
process_id ||= ProcessID.random
|
54
|
+
time ||= Time.random
|
55
|
+
data ||= Data.random
|
56
|
+
|
57
|
+
EventData.example(type:, process_id:, time:, data:)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
module Type
|
62
|
+
def self.example
|
63
|
+
:SomeEvent
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.other_example
|
67
|
+
:SomeOtherEvent
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.random
|
71
|
+
:"#{example}#{Controls::Random.string}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
module Data
|
76
|
+
def self.example
|
77
|
+
[
|
78
|
+
nil,
|
79
|
+
true,
|
80
|
+
false,
|
81
|
+
11,
|
82
|
+
'some-string'
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.random
|
87
|
+
[
|
88
|
+
nil,
|
89
|
+
Controls::Random.boolean,
|
90
|
+
Controls::Random.boolean,
|
91
|
+
Controls::Random.integer,
|
92
|
+
Controls::Random.string
|
93
|
+
]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
module Text
|
98
|
+
def self.example(type: nil, process_id: nil, time: nil)
|
99
|
+
type ||= EventData.type
|
100
|
+
process_id ||= EventData.process_id
|
101
|
+
time ||= EventData.time
|
102
|
+
|
103
|
+
time_iso8601 = Time::ISO8601.example(time)
|
104
|
+
|
105
|
+
json_text = JSON.generate([type, process_id, time_iso8601, [nil, true, false, 11, "some-string"]])
|
106
|
+
"#{json_text}\n"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module Handler
|
6
|
+
def self.example
|
7
|
+
Example.new
|
8
|
+
end
|
9
|
+
|
10
|
+
class Example
|
11
|
+
include Telemetry::Sink::Handler
|
12
|
+
|
13
|
+
attr_accessor :handled_event
|
14
|
+
attr_accessor :handled_event_data
|
15
|
+
|
16
|
+
handle Event::SomeEvent do |some_event|
|
17
|
+
self.handled_event = some_event
|
18
|
+
end
|
19
|
+
|
20
|
+
def handle_event_data(event_data)
|
21
|
+
self.handled_event_data = event_data
|
22
|
+
end
|
23
|
+
|
24
|
+
def handled?(event=nil)
|
25
|
+
return false if handled_event.nil?
|
26
|
+
|
27
|
+
return true if event.nil?
|
28
|
+
|
29
|
+
event == handled_event
|
30
|
+
end
|
31
|
+
|
32
|
+
def handled_event_data?(event_data)
|
33
|
+
self.handled_event_data == event_data
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
module NoHandler
|
38
|
+
def self.example
|
39
|
+
Example.new
|
40
|
+
end
|
41
|
+
|
42
|
+
class Example
|
43
|
+
include Telemetry::Sink::Handler
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module NoArgument
|
48
|
+
def self.example
|
49
|
+
Example.new
|
50
|
+
end
|
51
|
+
|
52
|
+
class Example
|
53
|
+
include Telemetry::Sink::Handler
|
54
|
+
|
55
|
+
attr_accessor :handled_event
|
56
|
+
def handled? = !!handled_event
|
57
|
+
|
58
|
+
handle Event::SomeEvent do
|
59
|
+
self.handled_event = true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
module Method
|
65
|
+
def self.example(event_type=nil)
|
66
|
+
event_type ||= Event::SomeEvent.event_type
|
67
|
+
|
68
|
+
event_name = Telemetry::Event::EventName.get(event_type)
|
69
|
+
|
70
|
+
:"handle_#{event_name}"
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.other_example
|
74
|
+
event_type = Event::SomeOtherEvent.event_type
|
75
|
+
|
76
|
+
example(event_type)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module Path
|
6
|
+
module File
|
7
|
+
def self.example(basename: nil, extension: nil)
|
8
|
+
basename ||= self.basename
|
9
|
+
extension ||= self.extension
|
10
|
+
|
11
|
+
filename = "#{basename}#{extension}"
|
12
|
+
|
13
|
+
tempfile = Tempfile.create(filename)
|
14
|
+
tempfile.close
|
15
|
+
|
16
|
+
::File.unlink(tempfile)
|
17
|
+
|
18
|
+
tempfile.path
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.basename
|
22
|
+
"some-basename"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.extension
|
26
|
+
".some-extension"
|
27
|
+
end
|
28
|
+
|
29
|
+
module Read
|
30
|
+
def self.call(file_path)
|
31
|
+
::File.read(file_path)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module ProcessID
|
6
|
+
def self.example
|
7
|
+
11111
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.other_example
|
11
|
+
22222
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.random
|
15
|
+
Random.integer
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.current_process
|
19
|
+
::Process.pid
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module Sink
|
6
|
+
def self.example
|
7
|
+
Example.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.other_example
|
11
|
+
OtherExample.new
|
12
|
+
end
|
13
|
+
|
14
|
+
class Example
|
15
|
+
include Telemetry::Sink
|
16
|
+
|
17
|
+
attr_accessor :received_event_data
|
18
|
+
|
19
|
+
def receive(event_data)
|
20
|
+
self.received_event_data = event_data
|
21
|
+
end
|
22
|
+
|
23
|
+
def received?(event_data)
|
24
|
+
self.received_event_data == event_data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class OtherExample
|
29
|
+
include Telemetry::Sink
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Telemetry
|
4
|
+
module Controls
|
5
|
+
module Time
|
6
|
+
def self.example(offset_seconds: nil, offset_milliseconds: nil, offset_nanoseconds: nil)
|
7
|
+
offset_nanoseconds ||= 0
|
8
|
+
|
9
|
+
if not offset_seconds.nil?
|
10
|
+
offset_milliseconds = offset_seconds * 1_000
|
11
|
+
return example(offset_milliseconds:)
|
12
|
+
elsif not offset_milliseconds.nil?
|
13
|
+
offset_nanoseconds = offset_milliseconds * 1_000_000
|
14
|
+
return example(offset_nanoseconds:)
|
15
|
+
end
|
16
|
+
|
17
|
+
nanoseconds = 111_111_111
|
18
|
+
seconds = 11
|
19
|
+
minutes = 11
|
20
|
+
hours = 11
|
21
|
+
day = 1
|
22
|
+
month = 1
|
23
|
+
year = 2000
|
24
|
+
|
25
|
+
nanoseconds += offset_nanoseconds
|
26
|
+
|
27
|
+
remaining_offset_seconds, nanoseconds = nanoseconds.divmod(1_000_000_000)
|
28
|
+
|
29
|
+
microseconds = Rational(nanoseconds, 1_000)
|
30
|
+
|
31
|
+
time = ::Time.utc(year, month, day, hours, minutes, seconds, microseconds)
|
32
|
+
|
33
|
+
time + remaining_offset_seconds
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.other_example
|
37
|
+
Other.example
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.random
|
41
|
+
Random.example
|
42
|
+
end
|
43
|
+
|
44
|
+
module ISO8601
|
45
|
+
def self.example(time=nil, **arguments)
|
46
|
+
time ||= Time.example(**arguments)
|
47
|
+
|
48
|
+
time.strftime('%Y-%m-%dT%H:%M:%S.%NZ')
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.other_example
|
52
|
+
time = Time.other_example
|
53
|
+
|
54
|
+
example(time)
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.random
|
58
|
+
time = Time.random
|
59
|
+
|
60
|
+
example(time)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
module Offset
|
65
|
+
def self.example
|
66
|
+
Time.example(offset_nanoseconds:)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.offset_nanoseconds
|
70
|
+
Elapsed.nanoseconds
|
71
|
+
end
|
72
|
+
end
|
73
|
+
Other = Offset
|
74
|
+
|
75
|
+
module Random
|
76
|
+
def self.example
|
77
|
+
offset_nanoseconds = Controls::Random.integer
|
78
|
+
|
79
|
+
Time.example(offset_nanoseconds:)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
module Elapsed
|
84
|
+
def self.example
|
85
|
+
seconds
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.nanoseconds
|
89
|
+
111_111_111
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.milliseconds
|
93
|
+
111.111_111
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.seconds
|
97
|
+
0.111_111_111
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/random'
|
4
|
+
|
5
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/process_id'
|
6
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/time'
|
7
|
+
|
8
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/path/file'
|
9
|
+
|
10
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/event_data'
|
11
|
+
|
12
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/event'
|
13
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/event/metadata'
|
14
|
+
|
15
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/sink'
|
16
|
+
require 'test_bench_bootstrap/test_bench/telemetry/controls/handler'
|