Skip to content

Commit

Permalink
update rsmp gem, update s0006 and s0035 tests to use emergencyroutes=…
Browse files Browse the repository at this point in the history
…0 when status is False
  • Loading branch information
emiltin committed Dec 13, 2023
1 parent 3ce83ab commit 575f5cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ GEM
minitest (5.20.0)
rake (13.0.6)
regexp_parser (2.8.3)
rsmp (0.26.0)
rsmp (0.26.1)
async (~> 2.6.4)
async-io (~> 1.36.0)
colorize (~> 0.8.1)
Expand Down
21 changes: 12 additions & 9 deletions spec/site/tlc/emergency_routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,25 @@
emergency_routes = Validator.config['items']['emergency_routes']
skip("No emergency routes configured") if emergency_routes.nil? || emergency_routes.empty?

def set_and_check_emergecy_states task, emergency_routes, state
emergency_routes.each { |emergency_route| set_emergency_route emergency_route.to_s, state }
def set_emergency_states task, emergency_routes, state
emergency_routes.each do |emergency_route|
set_emergency_route emergency_route.to_s, state
end
wait_for_status(task, "emergency route #{emergency_routes.last} to be enabled",
[
{'sCI'=>'S0006','n'=>'status','s'=>(state ? 'True' : 'False')},
{'sCI'=>'S0006','n'=>'emergencystage','s'=>emergency_routes.last.to_s}
{'sCI'=>'S0006','n'=>'emergencystage','s'=>(state ? emergency_routes.last.to_s : '0')}
]
)
end
end

Validator::Site.connected do |task,supervisor,site|
prepare task, site
set_and_check_emergecy_states task, emergency_routes, false
set_emergency_states task, emergency_routes, false
begin
set_and_check_emergecy_states task, emergency_routes, true
set_emergency_states task, emergency_routes, true
ensure
set_and_check_emergecy_states task, emergency_routes, false
set_emergency_states task, emergency_routes, false
end
end
end
Expand All @@ -65,7 +67,7 @@ def set_and_check_emergecy_states task, emergency_routes, state
# 4. When we request the current emergency routes with S035.
# 5. Then we should receive the list of active routes.

specify 'emergency route is read with S0035', sxl: '>=1.2' do |example|
specify 'emergency routes can be activated with M0005 and read with S0035', sxl: '>=1.2' do |example|
def enable_routes task, emergency_routes
emergency_routes.each { |emergency_route| set_emergency_route emergency_route.to_s, true }
routes = emergency_routes.map {|i| {'id'=>i.to_s} }
Expand All @@ -77,12 +79,13 @@ def enable_routes task, emergency_routes
def disable_routes task, emergency_routes
emergency_routes.each { |emergency_route| set_emergency_route emergency_route.to_s, false }
routes = []
wait_for_status(task, "emergency routes #{emergency_routes.to_s} to be disabled",
wait_for_status(task, "all emergency routes to be disabled",
[ {'sCI'=>'S0035','n'=>'emergencyroutes','s'=>routes} ]
)
end

emergency_routes = Validator.config['items']['emergency_routes']

skip("No emergency routes configured") if emergency_routes.nil? || emergency_routes.empty?

Validator::Site.connected do |task,supervisor,site|
Expand Down

0 comments on commit 575f5cb

Please sign in to comment.