cosmos 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ module Cosmos
23
23
 
24
24
  @interface = Interface.new
25
25
  $connected_count = 0
26
- allow(@interface).to receive(:connected?) do
26
+ def @interface.connected?
27
27
  if $connected_count == 0
28
28
  $connected_count += 1
29
29
  false
@@ -43,17 +43,16 @@ module Cosmos
43
43
  describe "start" do
44
44
  it "should log the connection" do
45
45
  commanding = double("commanding")
46
- expect(commanding).to receive(:send_command_to_interface)
46
+ expect(commanding).to receive(:send_command_to_interface).at_least(1).times
47
47
  allow(CmdTlmServer).to receive(:commanding).and_return(commanding)
48
48
  @interface.interfaces = [@interface]
49
49
  thread = RouterThread.new(@interface)
50
- threads = Thread.list.length
51
50
  thread.start
52
- sleep 0.1
53
- Thread.list.length.should eql threads + 1
51
+ sleep 0.5
52
+ Thread.list.length.should eql(2)
54
53
  thread.stop
55
54
  sleep 0.5
56
- Thread.list.length.should eql threads
55
+ Thread.list.length.should eql(1)
57
56
  end
58
57
 
59
58
  end
@@ -66,14 +65,13 @@ module Cosmos
66
65
  @interface.interfaces = [@interface]
67
66
  thread = RouterThread.new(@interface)
68
67
  sleep(1)
69
- threads = Thread.list.length
70
68
  capture_io do |stdout|
71
69
  thread.start
72
70
  sleep 0.1
73
- Thread.list.length.should eql threads + 1
71
+ Thread.list.length.should eql(2)
74
72
  thread.stop
75
73
  sleep 0.5
76
- Thread.list.length.should eql threads
74
+ Thread.list.length.should eql(1)
77
75
  stdout.string.should match "Error routing command"
78
76
  end
79
77
  end
@@ -87,14 +85,13 @@ module Cosmos
87
85
  @packet.packet_name = 'SMITH'
88
86
  thread = RouterThread.new(@interface)
89
87
  sleep(1)
90
- threads = Thread.list.length
91
88
  capture_io do |stdout|
92
89
  thread.start
93
90
  sleep 0.1
94
- Thread.list.length.should eql threads + 1
91
+ Thread.list.length.should eql(2)
95
92
  thread.stop
96
93
  sleep 0.5
97
- Thread.list.length.should eql threads
94
+ Thread.list.length.should eql(1)
98
95
  stdout.string.should match "Received unknown identified command: BOB SMITH"
99
96
  end
100
97
  end
@@ -41,6 +41,7 @@ module Cosmos
41
41
  routers.stop
42
42
  end
43
43
  tf.unlink
44
+ sleep(0.2)
44
45
  end
45
46
  end
46
47
 
@@ -69,6 +70,7 @@ module Cosmos
69
70
  stdout.string.should match "Disconnected from router MY_ROUTER"
70
71
  end
71
72
  tf.unlink
73
+ sleep(0.2)
72
74
  end
73
75
  end
74
76
 
@@ -124,10 +126,12 @@ module Cosmos
124
126
  tf.puts 'ROUTE DEST2'
125
127
  tf.close
126
128
  capture_io do |stdout|
127
- server = TCPServer.new('127.0.0.1', 9797)
128
- Thread.new do
129
- client = server.accept
130
- client.close
129
+ server = TCPServer.new('127.0.0.1', 8888)
130
+ clients = []
131
+ server_thread = Thread.new do
132
+ loop do
133
+ clients << server.accept
134
+ end
131
135
  end
132
136
 
133
137
  config = CmdTlmServerConfig.new(tf.path)
@@ -140,7 +144,7 @@ module Cosmos
140
144
  sleep 0.1
141
145
  stdout.string.should match "Connecting to MY_ROUTER"
142
146
  routers.disconnect("MY_ROUTER")
143
- routers.connect("MY_ROUTER",'localhost',9888,9888,6,6,'length')
147
+ routers.connect("MY_ROUTER",'localhost',8888,8888,6,6,'length')
144
148
  sleep 0.1
145
149
  stdout.string.should match "Disconnected from router MY_ROUTER"
146
150
  stdout.string.should match "Connecting to MY_ROUTER"
@@ -149,8 +153,16 @@ module Cosmos
149
153
  config.interfaces['DEST1'].routers[0].name.should eql "MY_ROUTER"
150
154
  config.interfaces['DEST2'].routers[0].name.should eql "MY_ROUTER"
151
155
  routers.disconnect("MY_ROUTER")
156
+ routers.stop
157
+
158
+ server_thread.kill
159
+ server.close
160
+ clients.each do |c|
161
+ c.close
162
+ end
152
163
  end
153
164
  tf.unlink
165
+ sleep(0.2)
154
166
  end
155
167
  end
156
168
 
@@ -274,12 +274,13 @@ module Cosmos
274
274
  describe "safe_thread" do
275
275
  it "should handle exceptions" do
276
276
  capture_io do |stdout|
277
- Cosmos.safe_thread("Test", 1) do
277
+ thread = Cosmos.safe_thread("Test", 1) do
278
278
  raise "TestError"
279
279
  end
280
- sleep 0.5
281
-
280
+ sleep 1
282
281
  stdout.string.should match "Test thread unexpectedly died."
282
+ thread.kill
283
+ sleep(0.2)
283
284
  end
284
285
  Cosmos.cleanup_exceptions()
285
286
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-29 00:00:00.000000000 Z
12
+ date: 2015-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -317,28 +317,14 @@ dependencies:
317
317
  requirements:
318
318
  - - ~>
319
319
  - !ruby/object:Gem::Version
320
- version: '2.4'
321
- type: :development
322
- prerelease: false
323
- version_requirements: !ruby/object:Gem::Requirement
324
- requirements:
325
- - - ~>
326
- - !ruby/object:Gem::Version
327
- version: '2.4'
328
- - !ruby/object:Gem::Dependency
329
- name: wdm
330
- requirement: !ruby/object:Gem::Requirement
331
- requirements:
332
- - - ~>
333
- - !ruby/object:Gem::Version
334
- version: '0.1'
320
+ version: '2'
335
321
  type: :development
336
322
  prerelease: false
337
323
  version_requirements: !ruby/object:Gem::Requirement
338
324
  requirements:
339
325
  - - ~>
340
326
  - !ruby/object:Gem::Version
341
- version: '0.1'
327
+ version: '2'
342
328
  - !ruby/object:Gem::Dependency
343
329
  name: guard-bundler
344
330
  requirement: !ruby/object:Gem::Requirement
@@ -422,10 +408,12 @@ extensions:
422
408
  - ext/cosmos/ext/string/extconf.rb
423
409
  - ext/cosmos/ext/tabbed_plots_config/extconf.rb
424
410
  - ext/cosmos/ext/telemetry/extconf.rb
411
+ - ext/mkrf_conf.rb
425
412
  extra_rdoc_files: []
426
413
  files:
427
414
  - .gitignore
428
415
  - .travis.yml
416
+ - CONTRIBUTING.txt
429
417
  - Gemfile
430
418
  - Guardfile
431
419
  - LICENSE.txt
@@ -941,6 +929,7 @@ files:
941
929
  - ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c
942
930
  - ext/cosmos/ext/telemetry/extconf.rb
943
931
  - ext/cosmos/ext/telemetry/telemetry.c
932
+ - ext/mkrf_conf.rb
944
933
  - install/Gemfile
945
934
  - install/Launcher
946
935
  - install/Launcher.bat