rsmp-validator 0.3.2 → 0.3.3
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/lib/rsmp/validator/version.rb +1 -1
- data/test/site/tlc/subscribe_spec.rb +30 -27
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec84b58102563bba94566d083e07f4180e2522a977b5d8c94fe10bd397518c06
|
|
4
|
+
data.tar.gz: 511f803b289f6bdb2a8483174b50bccb2b7bc56e60f32c6209d48becc82c584f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ada00db87ffe79709e3fa3003037da04894a5aa39f3699e608aa1c33dea845726a37cc7c13923a9b7af8870af25c160a0ac2a946d6c89f0b3efed8360af28e87
|
|
7
|
+
data.tar.gz: 0f90a7420de0f29caefb21f83dba9657684536d597b58a4399e74d40f3e34e295b2ae65114a6f3a6e60aaf4b2e6607add3a7c133f97a2eef1f0c3401f9f488f4
|
|
@@ -5,9 +5,10 @@ describe 'Site::Tlc::Subscribe' do
|
|
|
5
5
|
# is arbitrary as we simply want to check that
|
|
6
6
|
# the subscription mechanism works.
|
|
7
7
|
#
|
|
8
|
-
# 1.
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# 1. Given the site_proxy is connected
|
|
9
|
+
# 2. When we subscribe to S0001
|
|
10
|
+
# 3. Then we should receive a status update
|
|
11
|
+
# 4. Finally we unsubscribe from S0001
|
|
11
12
|
|
|
12
13
|
it 'can be turned on and off for S0001' do
|
|
13
14
|
with_site(:connected) do |site_proxy|
|
|
@@ -30,39 +31,41 @@ describe 'Site::Tlc::Subscribe' do
|
|
|
30
31
|
# The test subscribes to S0001 'cyclecounter' attribute with an initial update rate of 60s,
|
|
31
32
|
# then changes the update rate to 1s and verifies the new rate is in effect.
|
|
32
33
|
#
|
|
33
|
-
# 1.
|
|
34
|
-
# 2.
|
|
35
|
-
# 3.
|
|
36
|
-
# 4.
|
|
34
|
+
# 1. Given the site_proxy is connected
|
|
35
|
+
# 2. When we subscribe to S0001 'cyclecounter' with update rate 60s
|
|
36
|
+
# 3. And we change the update rate to 1s
|
|
37
|
+
# 4. Then we should receive two immediate updates and one periodic update within 2s
|
|
38
|
+
# 5. Finally we unsubscribe from S0001
|
|
37
39
|
|
|
38
40
|
it 'can change interval during active subscription' do
|
|
39
41
|
with_site(:connected) do |site_proxy|
|
|
40
42
|
component = RSMP::Validator.get_config('main_component')
|
|
43
|
+
matcher = RSMP::StatusMatcher.new('sCI' => 'S0001', 'n' => 'cyclecounter')
|
|
41
44
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
# start collecting matching status updates
|
|
46
|
+
collector = RSMP::Collector.new(
|
|
47
|
+
site_proxy,
|
|
48
|
+
filter: RSMP::Filter.new(type: 'StatusUpdate', component: component, ingoing: true, outgoing: false),
|
|
49
|
+
num: 3,
|
|
50
|
+
timeout: 2
|
|
51
|
+
)
|
|
52
|
+
collector.start do |message|
|
|
53
|
+
:keep if message.attributes.fetch('sS', []).any? { |item| matcher.match(item) }
|
|
54
|
+
end
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
log 'Subscribe to S0001 cyclecounter with 60s update rate'
|
|
57
|
+
status_list = [{ 'sCI' => 'S0001', 'n' => 'cyclecounter', 'uRt' => '60' }]
|
|
58
|
+
status_list.each { |item| item['sOc'] = false } if site_proxy.tlc.use_soc?
|
|
59
|
+
site_proxy.subscribe_to_status! status_list, component: component
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
within: 2).value!
|
|
61
|
+
log 'Change update rate to 1s and wait for three updates within 2s'
|
|
62
|
+
status_list.first['uRt'] = '1'
|
|
63
|
+
site_proxy.subscribe_to_status! status_list, component: component
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'Expected to receive status update within 2s with new 1s update rate')
|
|
64
|
-
log 'Successfully received status update within 2s, confirming 1s update rate is active'
|
|
65
|
+
expect(collector.wait.success?).to be == true
|
|
66
|
+
log 'Received three updates within 2s, confirming periodic updates at the new rate'
|
|
65
67
|
ensure
|
|
68
|
+
collector&.stop
|
|
66
69
|
# Clean up subscription
|
|
67
70
|
unsubscribe_list = [{ 'sCI' => 'S0001', 'n' => 'cyclecounter' }]
|
|
68
71
|
site_proxy.unsubscribe_to_status! unsubscribe_list, component: component
|