Skip to content

Commit

Permalink
remove tests anbd helpers related to restarting
Browse files Browse the repository at this point in the history
  • Loading branch information
emiltin committed Jan 17, 2024
1 parent 7272798 commit ce074e0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 63 deletions.
1 change: 0 additions & 1 deletion docs/pages/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ timeouts:
command_response: 1 # max time until site responds to a command request, in seconds
alarm: 1 # max time until site raises an alarm, in seconds
disconnect: 1 # max time until site disconnects, in seconds
shutdown: 1 # max time until site shuts down for a restart, in seconds
startup_sequence: 5 # max time until startup sequence completes
functional_position: 2 # max time until requested functional position is reached
yellow_flash: 2 # max time until yellow flash is activated
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/test_site.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Use this unless there's a specific reason to use one of the other methods. A seq
## Validator::Site.reconnected
Disconnects the site if connected, then waits until the site is connected before calling the block.

Use this if your test specifically needs to start with a fresh connection. But be aware that a fresh connection does not guarantee that the equipment will be in a pristine state. The equipment is not restart or otherwise be reset.
Use this if your test specifically needs to start with a fresh connection. But be aware that a fresh connection does not guarantee that the equipment will be in a pristine state. The equipment is not restarted or otherwise reset.

## Validator::Site.isolated
Like `connected`, except that the connection is is closed after the test, before the next test is run.
Expand Down
18 changes: 0 additions & 18 deletions spec/site/tlc/signal_groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,6 @@
end
end

# Verify that groups follow startup sequence after a restart
#
# 1. Given the site is connected
# 2. And has just been restarted
# 3. Then all signal groups should follow the startup sequence
it 'follows startup sequence after restart', sxl: '>=1.0.7', functional: true do |example|
Validator::Site.connected do |task,supervisor,site|
prepare task, site
supervisor.ignore_errors RSMP::DisconnectError do
verify_startup_sequence do
set_restart
site.wait_for_state :disconnected, timeout: Validator.get_config('timeouts','shutdown')
site.wait_for_state :ready, timeout: Validator.get_config('timeouts','ready')
end
end
end
end

# Verify that we can activate normal control after yellow flash mode is turned off
#
# 1. Given the site is connected and in yellow flash mode
Expand Down
28 changes: 0 additions & 28 deletions spec/site/tlc/system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,6 @@
end
end

# 1. Verify connection i Isolated_mode
# 2. Send the control command to restart, include security_code
# 3. Wait for status response= stopped
# 4. Reconnect as Isolated_mode
# 5. Wait for status= ready
# 6. Send command to switch to normal controll
# 7. Wait for status "Yellow flash" = false, "Controller starting"= false, "Controller on"= true
specify 'restart is triggered by M0004', sxl: '>=1.0.7' do |example|
Validator::Site.isolated do |task,supervisor,site|
prepare task, site
supervisor.ignore_errors RSMP::DisconnectError do
set_restart
site.wait_for_state :disconnected, timeout: Validator.get_config('timeouts','shutdown')
end
end

# NOTE
# when a remote site closes the connection, our site proxy object will stop.
# when the site reconnects, a new site proxy object will be created.
# this means we can't wait for the old site to become ready
# it also means we need a new Validator::Site.
Validator::Site.isolated do |task,supervisor,site|
prepare task, site
site.wait_for_state :ready, timeout: Validator.get_config('timeouts','ready')
wait_normal_control
end
end

# 1. Verify connection
# 2. Send control command to set securitycode_level
# 3. Wait for status = true
Expand Down
14 changes: 1 addition & 13 deletions spec/support/command_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,6 @@ def set_fixed_time status
send_command_and_confirm @task, command_list, "Switch to fixed time #{status}"
end

def set_restart
require_security_codes
log "Restarting traffic controller"
command_list = build_command_list :M0004, :setRestart, {
securityCode: Validator.get_config('secrets','security_codes',2),
status: 'True'
}
@site.send_command Validator.get_config('main_component'), command_list
# if the controller restarts immediately, we will not receive a command response,
# so do not expect it
end

def set_emergency_route route, state
if state
enable_emergency_route route
Expand Down Expand Up @@ -528,7 +516,7 @@ def verify_startup_sequence &block
end
end

# let block take other actions, like restarting the site, change control mode, etc.
# let block take other actions, like activating yellow flash, change control mode, etc.
yield

# subscribe, so we start getting status udates
Expand Down
4 changes: 2 additions & 2 deletions spec/support/testee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def connected options={}, &block

# Disconnects the site if connected, then waits until the site is connected
# before calling the block.
#U se this if your test specifically needs to start with a fresh connection.
# Use this if your test specifically needs to start with a fresh connection.
# But be aware that a fresh connection does not guarantee that the equipment
# will be in a pristine state. The equipment is not restart or otherwise be
# will be in a pristine state. The equipment is not restarted or otherwise
# reset.
def reconnected options={}, &block
stop 'Reconnecting'
Expand Down

0 comments on commit ce074e0

Please sign in to comment.