cosmos 4.0.3 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -5
- data/Manifest.txt +11 -1
- data/README.md +3 -2
- data/Rakefile +18 -4
- data/appveyor.yml +19 -0
- data/cosmos.gemspec +14 -3
- data/data/config/cmd_tlm_server.yaml +3 -0
- data/data/crc.txt +63 -60
- data/demo/config/targets/INST/cmd_tlm_server.txt +1 -0
- data/demo/config/targets/INST/cmd_tlm_server2.txt +7 -0
- data/demo/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +8 -12
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +7 -9
- data/demo/lib/cmd_sequence_exporter.rb +52 -0
- data/demo/lib/example_background_task.rb +1 -0
- data/demo/procedures/replay_test.rb +32 -0
- data/ext/cosmos/ext/structure/structure.c +39 -3
- data/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +1 -0
- data/install/config/tools/launcher/launcher.txt +2 -0
- data/lib/cosmos/config/config_parser.rb +2 -0
- data/lib/cosmos/core_ext/io.rb +89 -60
- data/lib/cosmos/gui/qt.rb +5 -8
- data/lib/cosmos/gui/qt_tool.rb +8 -8
- data/lib/cosmos/gui/text/ruby_editor.rb +12 -12
- data/lib/cosmos/gui/utilities/script_module_gui.rb +9 -9
- data/lib/cosmos/gui/widgets/realtime_button_bar.rb +18 -17
- data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +2 -2
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +3 -0
- data/lib/cosmos/interfaces/udp_interface.rb +27 -14
- data/lib/cosmos/io/buffered_file.rb +0 -1
- data/lib/cosmos/io/json_drb.rb +134 -214
- data/lib/cosmos/io/json_drb_object.rb +22 -61
- data/lib/cosmos/io/json_drb_rack.rb +79 -0
- data/lib/cosmos/io/json_rpc.rb +27 -0
- data/lib/cosmos/io/udp_sockets.rb +102 -58
- data/lib/cosmos/packets/commands.rb +1 -1
- data/lib/cosmos/packets/structure.rb +1 -1
- data/lib/cosmos/packets/structure_item.rb +37 -5
- data/lib/cosmos/script/cmd_tlm_server.rb +76 -2
- data/lib/cosmos/script/replay.rb +60 -0
- data/lib/cosmos/script/script.rb +20 -2
- data/lib/cosmos/script/scripting.rb +9 -9
- data/lib/cosmos/script/tools.rb +14 -0
- data/lib/cosmos/system/system.rb +185 -92
- data/lib/cosmos/system/target.rb +1 -1
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +44 -4
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +4 -0
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +7 -0
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +347 -20
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +3 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +329 -111
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +13 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +261 -95
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +46 -35
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +18 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +39 -28
- data/lib/cosmos/tools/cmd_tlm_server/gui/replay_tab.rb +242 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +24 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +18 -6
- data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +5 -4
- data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +375 -0
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +10 -2
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +40 -5
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +18 -20
- data/lib/cosmos/tools/launcher/launcher_config.rb +5 -16
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +65 -39
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +19 -0
- data/lib/cosmos/tools/replay/replay.rb +5 -505
- data/lib/cosmos/tools/script_runner/script_audit.rb +1 -0
- data/lib/cosmos/tools/script_runner/script_runner.rb +3 -4
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +3 -4
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +44 -23
- data/lib/cosmos/tools/test_runner/results_writer.rb +4 -0
- data/lib/cosmos/tools/test_runner/test_runner.rb +0 -3
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +6 -2
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +26 -1
- data/lib/cosmos/tools/tlm_viewer/screen.rb +24 -1
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +25 -0
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +24 -14
- data/lib/cosmos/top_level.rb +34 -24
- data/lib/cosmos/utilities/csv.rb +60 -8
- data/lib/cosmos/version.rb +5 -5
- data/spec/config/config_parser_spec.rb +10 -1
- data/spec/core_ext/socket_spec.rb +4 -2
- data/spec/gui/utilities/script_module_gui_spec.rb +102 -0
- data/spec/install/config/data/data.txt +1 -0
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +2 -0
- data/spec/interfaces/cmd_tlm_server_interface_spec.rb +1 -2
- data/spec/interfaces/protocols/template_protocol_spec.rb +72 -2
- data/spec/interfaces/serial_interface_spec.rb +1 -1
- data/spec/interfaces/udp_interface_spec.rb +14 -0
- data/spec/io/buffered_file_spec.rb +37 -0
- data/spec/io/json_drb_object_spec.rb +2 -15
- data/spec/io/json_drb_spec.rb +61 -121
- data/spec/io/udp_sockets_spec.rb +42 -2
- data/spec/packet_logs/packet_log_reader_spec.rb +5 -2
- data/spec/packets/binary_accessor_spec.rb +1 -1
- data/spec/packets/packet_item_spec.rb +1 -1
- data/spec/packets/structure_item_spec.rb +5 -6
- data/spec/script/cmd_tlm_server_spec.rb +39 -4
- data/spec/script/commands_disconnect_spec.rb +1 -1
- data/spec/script/commands_spec.rb +2 -1
- data/spec/script/scripting_spec.rb +18 -3
- data/spec/script/telemetry_spec.rb +5 -0
- data/spec/spec_helper.rb +43 -26
- data/spec/streams/tcpip_socket_stream_spec.rb +2 -2
- data/spec/system/system_spec.rb +11 -9
- data/spec/system/target_spec.rb +3 -0
- data/spec/tools/cmd_tlm_server/api_spec.rb +543 -29
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +2 -2
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +31 -75
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +199 -66
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -9
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +29 -127
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +10 -50
- data/spec/tools/launcher/launcher_config_spec.rb +1 -1
- data/spec/tools/table_manager/table_item_spec.rb +1 -1
- data/spec/tools/table_manager/tablemanager_core_spec.rb +4 -4
- data/spec/top_level/top_level_spec.rb +151 -3
- data/spec/utilities/csv_spec.rb +24 -5
- metadata +61 -9
- data/lib/cosmos/tools/replay/replay_server.rb +0 -91
@@ -83,20 +83,12 @@ module Cosmos
|
|
83
83
|
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_logging')
|
84
84
|
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_cmd_log')
|
85
85
|
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_tlm_log')
|
86
|
-
threads = Thread.list.length
|
87
|
-
cts.start # Call start again ... it should do nothing
|
88
|
-
expect(CmdTlmServer.json_drb.method_whitelist).to include('start_logging')
|
89
|
-
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_logging')
|
90
|
-
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_cmd_log')
|
91
|
-
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_tlm_log')
|
92
86
|
ensure
|
93
87
|
cts.stop
|
94
88
|
sleep 0.2
|
95
89
|
end
|
96
90
|
|
97
|
-
|
98
|
-
# Now start the server in production mode
|
99
|
-
cts.start(true)
|
91
|
+
cts = CmdTlmServer.new(CmdTlmServer::DEFAULT_CONFIG_FILE, true)
|
100
92
|
begin
|
101
93
|
# Verify we disabled the ability to stop logging
|
102
94
|
expect(CmdTlmServer.json_drb.method_whitelist).to include('start_logging')
|
@@ -201,6 +193,11 @@ module Cosmos
|
|
201
193
|
end
|
202
194
|
|
203
195
|
describe "self.subscribe_limits_events" do
|
196
|
+
it "rejects bad queue sizes" do
|
197
|
+
expect{ CmdTlmServer.subscribe_limits_events(0) }.to raise_error(ArgumentError)
|
198
|
+
expect{ CmdTlmServer.subscribe_limits_events(true) }.to raise_error(ArgumentError)
|
199
|
+
end
|
200
|
+
|
204
201
|
it "subscribes to limits events" do
|
205
202
|
allow(System).to receive_message_chain(:telemetry,:stale).and_return([])
|
206
203
|
allow(System).to receive_message_chain(:telemetry,:limits_change_callback=)
|
@@ -306,9 +303,14 @@ module Cosmos
|
|
306
303
|
|
307
304
|
describe "self.subscribe_packet_data" do
|
308
305
|
it "rejects bad queue sizes" do
|
306
|
+
expect{ CmdTlmServer.subscribe_packet_data([["SYSTEM","LIMITS_CHANGE"]], 0) }.to raise_error(ArgumentError)
|
309
307
|
expect{ CmdTlmServer.subscribe_packet_data([["SYSTEM","LIMITS_CHANGE"]], true) }.to raise_error(ArgumentError)
|
310
308
|
end
|
311
309
|
|
310
|
+
it "rejects bad packet lists" do
|
311
|
+
expect{ CmdTlmServer.subscribe_packet_data(["SYSTEM","LIMITS_CHANGE"]) }.to raise_error(ArgumentError, /packets must be nested array/)
|
312
|
+
end
|
313
|
+
|
312
314
|
it "subscribes to packets" do
|
313
315
|
cts = CmdTlmServer.new
|
314
316
|
id = CmdTlmServer.subscribe_packet_data([["SYSTEM","LIMITS_CHANGE"]])
|
@@ -400,6 +402,80 @@ module Cosmos
|
|
400
402
|
end
|
401
403
|
end
|
402
404
|
|
405
|
+
describe "self.get_packet_data" do
|
406
|
+
it "raises an error if the queue is empty and non_block" do
|
407
|
+
cts = CmdTlmServer.new
|
408
|
+
id = CmdTlmServer.subscribe_packet_data([["SYSTEM","LIMITS_CHANGE"]])
|
409
|
+
|
410
|
+
expect { CmdTlmServer.get_packet_data(id, true) }.to raise_error(ThreadError)
|
411
|
+
cts.stop
|
412
|
+
sleep 0.2
|
413
|
+
end
|
414
|
+
|
415
|
+
it "works in disconnect mode" do
|
416
|
+
cts = CmdTlmServer.new(CmdTlmServer::DEFAULT_CONFIG_FILE, false, true)
|
417
|
+
id = CmdTlmServer.subscribe_packet_data([["SYSTEM","LIMITS_CHANGE"]])
|
418
|
+
buffer,tgt,pkt,tv_sec,tv_usec,cnt = CmdTlmServer.get_packet_data(id, true)
|
419
|
+
expect(buffer).not_to be_nil
|
420
|
+
expect(tgt).to eql "SYSTEM"
|
421
|
+
expect(pkt).to eql "LIMITS_CHANGE"
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
describe "self.subscribe_server_messages" do
|
426
|
+
it "rejects bad queue sizes" do
|
427
|
+
expect{ CmdTlmServer.subscribe_server_messages(0) }.to raise_error(ArgumentError)
|
428
|
+
expect{ CmdTlmServer.subscribe_server_messages(true) }.to raise_error(ArgumentError)
|
429
|
+
end
|
430
|
+
|
431
|
+
it "subscribes to server messages" do
|
432
|
+
cts = CmdTlmServer.new
|
433
|
+
id = CmdTlmServer.subscribe_server_messages()
|
434
|
+
cts.post_server_message("This is a test")
|
435
|
+
cts.post_server_message("Another test")
|
436
|
+
message = CmdTlmServer.get_server_message(id, true)
|
437
|
+
expect(message).to eql "This is a test"
|
438
|
+
message = CmdTlmServer.get_server_message(id, true)
|
439
|
+
expect(message).to eql "Another test"
|
440
|
+
|
441
|
+
cts.stop
|
442
|
+
sleep 0.2
|
443
|
+
end
|
444
|
+
|
445
|
+
it "deletes queues after the max packets is reached" do
|
446
|
+
cts = CmdTlmServer.new
|
447
|
+
id = CmdTlmServer.subscribe_server_messages(2)
|
448
|
+
cts.post_server_message("One message")
|
449
|
+
message = CmdTlmServer.get_server_message(id, true)
|
450
|
+
expect(message).to eql "One message"
|
451
|
+
|
452
|
+
# Fill the queue
|
453
|
+
1001.times { cts.post_server_message("Message") }
|
454
|
+
|
455
|
+
# Try to get another message
|
456
|
+
expect { CmdTlmServer.get_server_message(id) }.to raise_error("Server message queue with id #{id} not found")
|
457
|
+
|
458
|
+
cts.stop
|
459
|
+
sleep 0.2
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
describe "self.subscribe_server_messages" do
|
464
|
+
it "unsubscribes to messages" do
|
465
|
+
cts = CmdTlmServer.new
|
466
|
+
id = CmdTlmServer.subscribe_server_messages(2)
|
467
|
+
cts.post_server_message("One message")
|
468
|
+
message = CmdTlmServer.get_server_message(id, true)
|
469
|
+
expect(message).to eql "One message"
|
470
|
+
|
471
|
+
CmdTlmServer.unsubscribe_server_messages(id)
|
472
|
+
cts.post_server_message("Two message")
|
473
|
+
expect { CmdTlmServer.get_server_message(id) }.to raise_error("Server message queue with id #{id} not found")
|
474
|
+
cts.stop
|
475
|
+
sleep 0.2
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
403
479
|
describe "self.get_packet_data" do
|
404
480
|
it "raises an error if the queue is empty and non_block" do
|
405
481
|
cts = CmdTlmServer.new
|
@@ -59,18 +59,10 @@ module Cosmos
|
|
59
59
|
thread = InterfaceThread.new(@interface)
|
60
60
|
thread.start
|
61
61
|
sleep 0.1
|
62
|
-
|
63
|
-
expect(Thread.list.length).to eql(2)
|
64
|
-
else
|
65
|
-
expect(Thread.list.length).to eql(3)
|
66
|
-
end
|
62
|
+
expect(running_threads.length).to eql(2)
|
67
63
|
thread.stop
|
68
64
|
sleep 0.2
|
69
|
-
|
70
|
-
expect(Thread.list.length).to eql(1)
|
71
|
-
else
|
72
|
-
expect(Thread.list.length).to eql(2)
|
73
|
-
end
|
65
|
+
expect(running_threads.length).to eql(1)
|
74
66
|
|
75
67
|
expect(stdout.string).to match "Connection Failed: RuntimeError : ConnectError"
|
76
68
|
end
|
@@ -80,10 +72,9 @@ module Cosmos
|
|
80
72
|
capture_io do |stdout|
|
81
73
|
allow(@interface).to receive(:connected?).and_return(false)
|
82
74
|
allow(@interface).to receive(:connect) { raise "ConnectError" }
|
83
|
-
# Make the reconnect_delay be
|
84
|
-
#
|
85
|
-
|
86
|
-
@interface.reconnect_delay = 0.15
|
75
|
+
# Make the reconnect_delay be 0.2 so we see the initial error and a
|
76
|
+
# reconnect error during the 0.3 sleep after starting the thread
|
77
|
+
@interface.reconnect_delay = 0.2
|
87
78
|
thread = InterfaceThread.new(@interface)
|
88
79
|
error_count = 0
|
89
80
|
thread.connection_failed_callback = Proc.new do |error|
|
@@ -91,19 +82,11 @@ module Cosmos
|
|
91
82
|
error_count += 1
|
92
83
|
end
|
93
84
|
thread.start
|
94
|
-
sleep 0.
|
95
|
-
|
96
|
-
expect(Thread.list.length).to eql(2)
|
97
|
-
else
|
98
|
-
expect(Thread.list.length).to eql(3)
|
99
|
-
end
|
85
|
+
sleep 0.3
|
86
|
+
expect(running_threads.length).to eql(2)
|
100
87
|
thread.stop
|
101
|
-
sleep 0.
|
102
|
-
|
103
|
-
expect(Thread.list.length).to eql(1)
|
104
|
-
else
|
105
|
-
expect(Thread.list.length).to eql(2)
|
106
|
-
end
|
88
|
+
sleep 0.1
|
89
|
+
expect(running_threads.length).to eql(1)
|
107
90
|
expect(error_count).to eql 2
|
108
91
|
|
109
92
|
expect(stdout.string).not_to match "Connection Failed: ConnectError"
|
@@ -115,18 +98,10 @@ module Cosmos
|
|
115
98
|
thread = InterfaceThread.new(@interface)
|
116
99
|
thread.start
|
117
100
|
sleep 0.1
|
118
|
-
|
119
|
-
expect(Thread.list.length).to eql(2)
|
120
|
-
else
|
121
|
-
expect(Thread.list.length).to eql(3)
|
122
|
-
end
|
101
|
+
expect(running_threads.length).to eql(2)
|
123
102
|
thread.stop
|
124
103
|
sleep 0.2
|
125
|
-
|
126
|
-
expect(Thread.list.length).to eql(1)
|
127
|
-
else
|
128
|
-
expect(Thread.list.length).to eql(2)
|
129
|
-
end
|
104
|
+
expect(running_threads.length).to eql(1)
|
130
105
|
|
131
106
|
expect(stdout.string).to match "Connection Success"
|
132
107
|
end
|
@@ -141,18 +116,10 @@ module Cosmos
|
|
141
116
|
end
|
142
117
|
thread.start
|
143
118
|
sleep 0.1
|
144
|
-
|
145
|
-
expect(Thread.list.length).to eql(2)
|
146
|
-
else
|
147
|
-
expect(Thread.list.length).to eql(3)
|
148
|
-
end
|
119
|
+
expect(running_threads.length).to eql(2)
|
149
120
|
thread.stop
|
150
121
|
sleep 0.2
|
151
|
-
|
152
|
-
expect(Thread.list.length).to eql(1)
|
153
|
-
else
|
154
|
-
expect(Thread.list.length).to eql(2)
|
155
|
-
end
|
122
|
+
expect(running_threads.length).to eql(1)
|
156
123
|
expect(callback_called).to be true
|
157
124
|
|
158
125
|
expect(stdout.string).not_to match "Connection Success"
|
@@ -169,18 +136,10 @@ module Cosmos
|
|
169
136
|
thread = InterfaceThread.new(@interface)
|
170
137
|
thread.start
|
171
138
|
sleep 0.1
|
172
|
-
|
173
|
-
expect(Thread.list.length).to eql(2)
|
174
|
-
else
|
175
|
-
expect(Thread.list.length).to eql(3)
|
176
|
-
end
|
139
|
+
expect(running_threads.length).to eql(2)
|
177
140
|
thread.stop
|
178
141
|
sleep 0.2
|
179
|
-
|
180
|
-
expect(Thread.list.length).to eql(1)
|
181
|
-
else
|
182
|
-
expect(Thread.list.length).to eql(2)
|
183
|
-
end
|
142
|
+
expect(running_threads.length).to eql(1)
|
184
143
|
|
185
144
|
expect(stdout.string).to match "Connection Lost"
|
186
145
|
end
|
@@ -199,18 +158,10 @@ module Cosmos
|
|
199
158
|
sleep 1
|
200
159
|
# Since we set auto_reconnect to false we shouldn't see the interface
|
201
160
|
# thread because it will be killed
|
202
|
-
|
203
|
-
expect(Thread.list.length).to eql(1)
|
204
|
-
else
|
205
|
-
expect(Thread.list.length).to eql(2)
|
206
|
-
end
|
161
|
+
expect(running_threads.length).to eql(1)
|
207
162
|
thread.stop
|
208
163
|
sleep 0.2
|
209
|
-
|
210
|
-
expect(Thread.list.length).to eql(1)
|
211
|
-
else
|
212
|
-
expect(Thread.list.length).to eql(2)
|
213
|
-
end
|
164
|
+
expect(running_threads.length).to eql(1)
|
214
165
|
expect(callback_called).to be true
|
215
166
|
|
216
167
|
expect(stdout.string).not_to match "Connection Lost"
|
@@ -223,18 +174,10 @@ module Cosmos
|
|
223
174
|
thread = InterfaceThread.new(@interface)
|
224
175
|
thread.start
|
225
176
|
sleep 0.1
|
226
|
-
|
227
|
-
expect(Thread.list.length).to eql(2)
|
228
|
-
else
|
229
|
-
expect(Thread.list.length).to eql(3)
|
230
|
-
end
|
177
|
+
expect(running_threads.length).to eql(2)
|
231
178
|
thread.stop
|
232
179
|
sleep 0.2
|
233
|
-
|
234
|
-
expect(Thread.list.length).to eql(1)
|
235
|
-
else
|
236
|
-
expect(Thread.list.length).to eql(2)
|
237
|
-
end
|
180
|
+
expect(running_threads.length).to eql(1)
|
238
181
|
expect(stdout.string).to match "ReadError"
|
239
182
|
end
|
240
183
|
end
|
@@ -249,18 +192,10 @@ module Cosmos
|
|
249
192
|
thread = InterfaceThread.new(@interface)
|
250
193
|
thread.start
|
251
194
|
sleep 0.1
|
252
|
-
|
253
|
-
expect(Thread.list.length).to eql(2)
|
254
|
-
else
|
255
|
-
expect(Thread.list.length).to eql(3)
|
256
|
-
end
|
195
|
+
expect(running_threads.length).to eql(2)
|
257
196
|
thread.stop
|
258
197
|
sleep 0.2
|
259
|
-
|
260
|
-
expect(Thread.list.length).to eql(1)
|
261
|
-
else
|
262
|
-
expect(Thread.list.length).to eql(2)
|
263
|
-
end
|
198
|
+
expect(running_threads.length).to eql(1)
|
264
199
|
|
265
200
|
expect(stdout.string).to match "ECONNRESET"
|
266
201
|
end
|
@@ -304,18 +239,10 @@ module Cosmos
|
|
304
239
|
thread = InterfaceThread.new(@interface)
|
305
240
|
thread.start
|
306
241
|
sleep 0.1
|
307
|
-
|
308
|
-
expect(Thread.list.length).to eql(2)
|
309
|
-
else
|
310
|
-
expect(Thread.list.length).to eql(3)
|
311
|
-
end
|
242
|
+
expect(running_threads.length).to eql(2)
|
312
243
|
thread.stop
|
313
244
|
sleep 0.2
|
314
|
-
|
315
|
-
expect(Thread.list.length).to eql(1)
|
316
|
-
else
|
317
|
-
expect(Thread.list.length).to eql(2)
|
318
|
-
end
|
245
|
+
expect(running_threads.length).to eql(1)
|
319
246
|
|
320
247
|
expect(stdout.string).to match "Unknown 2 byte packet"
|
321
248
|
end
|
@@ -330,18 +257,10 @@ module Cosmos
|
|
330
257
|
thread.start
|
331
258
|
sleep 0.1
|
332
259
|
|
333
|
-
|
334
|
-
expect(Thread.list.length).to eql(2)
|
335
|
-
else
|
336
|
-
expect(Thread.list.length).to eql(3)
|
337
|
-
end
|
260
|
+
expect(running_threads.length).to eql(2)
|
338
261
|
thread.stop
|
339
262
|
sleep 0.2
|
340
|
-
|
341
|
-
expect(Thread.list.length).to eql(1)
|
342
|
-
else
|
343
|
-
expect(Thread.list.length).to eql(2)
|
344
|
-
end
|
263
|
+
expect(running_threads.length).to eql(1)
|
345
264
|
expect(stdout.string).to match "Received unknown identified telemetry: BOB SMITH"
|
346
265
|
end
|
347
266
|
end
|
@@ -357,18 +276,10 @@ module Cosmos
|
|
357
276
|
thread = InterfaceThread.new(@interface)
|
358
277
|
thread.start
|
359
278
|
sleep 0.1
|
360
|
-
|
361
|
-
expect(Thread.list.length).to eql(2)
|
362
|
-
else
|
363
|
-
expect(Thread.list.length).to eql(3)
|
364
|
-
end
|
279
|
+
expect(running_threads.length).to eql(2)
|
365
280
|
thread.stop
|
366
281
|
sleep 0.2
|
367
|
-
|
368
|
-
expect(Thread.list.length).to eql(1)
|
369
|
-
else
|
370
|
-
expect(Thread.list.length).to eql(2)
|
371
|
-
end
|
282
|
+
expect(running_threads.length).to eql(1)
|
372
283
|
|
373
284
|
expect(stdout.string).to match "Problem writing to router"
|
374
285
|
end
|
@@ -379,21 +290,12 @@ module Cosmos
|
|
379
290
|
allow(writer).to receive_message_chain(:tlm_log_writer,:write)
|
380
291
|
@interface.packet_log_writer_pairs = [writer]
|
381
292
|
thread = InterfaceThread.new(@interface)
|
382
|
-
threads = Thread.list.length
|
383
293
|
thread.start
|
384
294
|
sleep 0.1
|
385
|
-
|
386
|
-
expect(Thread.list.length).to eql(2)
|
387
|
-
else
|
388
|
-
expect(Thread.list.length).to eql(3)
|
389
|
-
end
|
295
|
+
expect(running_threads.length).to eql(2)
|
390
296
|
thread.stop
|
391
297
|
sleep 0.2
|
392
|
-
|
393
|
-
expect(Thread.list.length).to eql(1)
|
394
|
-
else
|
395
|
-
expect(Thread.list.length).to eql(2)
|
396
|
-
end
|
298
|
+
expect(running_threads.length).to eql(1)
|
397
299
|
end
|
398
300
|
|
399
301
|
end
|
@@ -39,18 +39,10 @@ module Cosmos
|
|
39
39
|
capture_io do |stdout|
|
40
40
|
thread.start
|
41
41
|
sleep 0.2
|
42
|
-
|
43
|
-
expect(Thread.list.length).to eql(2)
|
44
|
-
else
|
45
|
-
expect(Thread.list.length).to eql(3)
|
46
|
-
end
|
42
|
+
expect(running_threads.length).to eql(2)
|
47
43
|
thread.stop
|
48
44
|
sleep 0.5
|
49
|
-
|
50
|
-
expect(Thread.list.length).to eql(1)
|
51
|
-
else
|
52
|
-
expect(Thread.list.length).to eql(2)
|
53
|
-
end
|
45
|
+
expect(running_threads.length).to eql(1)
|
54
46
|
expect(stdout.string).to match "disconnected interface"
|
55
47
|
end
|
56
48
|
end
|
@@ -65,18 +57,10 @@ module Cosmos
|
|
65
57
|
capture_io do |stdout|
|
66
58
|
thread.start
|
67
59
|
sleep 0.2
|
68
|
-
|
69
|
-
expect(Thread.list.length).to eql(2)
|
70
|
-
else
|
71
|
-
expect(Thread.list.length).to eql(3)
|
72
|
-
end
|
60
|
+
expect(running_threads.length).to eql(2)
|
73
61
|
thread.stop
|
74
62
|
sleep 0.5
|
75
|
-
|
76
|
-
expect(Thread.list.length).to eql(1)
|
77
|
-
else
|
78
|
-
expect(Thread.list.length).to eql(2)
|
79
|
-
end
|
63
|
+
expect(running_threads.length).to eql(1)
|
80
64
|
expect(stdout.string).to match "Error routing command"
|
81
65
|
end
|
82
66
|
end
|
@@ -97,18 +81,10 @@ module Cosmos
|
|
97
81
|
capture_io do |stdout|
|
98
82
|
thread.start
|
99
83
|
sleep 0.2
|
100
|
-
|
101
|
-
expect(Thread.list.length).to eql(2)
|
102
|
-
else
|
103
|
-
expect(Thread.list.length).to eql(3)
|
104
|
-
end
|
84
|
+
expect(running_threads.length).to eql(2)
|
105
85
|
thread.stop
|
106
86
|
sleep 0.5
|
107
|
-
|
108
|
-
expect(Thread.list.length).to eql(1)
|
109
|
-
else
|
110
|
-
expect(Thread.list.length).to eql(2)
|
111
|
-
end
|
87
|
+
expect(running_threads.length).to eql(1)
|
112
88
|
expect(stdout.string).to match "Received unknown identified command: BOB SMITH"
|
113
89
|
end
|
114
90
|
end
|
@@ -133,18 +109,10 @@ module Cosmos
|
|
133
109
|
capture_io do |stdout|
|
134
110
|
thread.start
|
135
111
|
sleep 0.2
|
136
|
-
|
137
|
-
expect(Thread.list.length).to eql(2)
|
138
|
-
else
|
139
|
-
expect(Thread.list.length).to eql(3)
|
140
|
-
end
|
112
|
+
expect(running_threads.length).to eql(2)
|
141
113
|
thread.stop
|
142
114
|
sleep 0.5
|
143
|
-
|
144
|
-
expect(Thread.list.length).to eql(1)
|
145
|
-
else
|
146
|
-
expect(Thread.list.length).to eql(2)
|
147
|
-
end
|
115
|
+
expect(running_threads.length).to eql(1)
|
148
116
|
expect(stdout.string).to match "Received unknown identified command: BOB SMITH"
|
149
117
|
end
|
150
118
|
expect(target).to have_received(:interface).at_least(2).times #and_return(@interface)
|
@@ -170,18 +138,10 @@ module Cosmos
|
|
170
138
|
capture_io do |stdout|
|
171
139
|
thread.start
|
172
140
|
sleep 0.2
|
173
|
-
|
174
|
-
expect(Thread.list.length).to eql(2)
|
175
|
-
else
|
176
|
-
expect(Thread.list.length).to eql(3)
|
177
|
-
end
|
141
|
+
expect(running_threads.length).to eql(2)
|
178
142
|
thread.stop
|
179
143
|
sleep 0.5
|
180
|
-
|
181
|
-
expect(Thread.list.length).to eql(1)
|
182
|
-
else
|
183
|
-
expect(Thread.list.length).to eql(2)
|
184
|
-
end
|
144
|
+
expect(running_threads.length).to eql(1)
|
185
145
|
expect(stdout.string).to match "target with no interface"
|
186
146
|
end
|
187
147
|
end
|