Skip to content
Snippets Groups Projects
Commit 13666a0c authored by Drew Devereux's avatar Drew Devereux
Browse files

Update docker base images and CI runner

New docker base images include new cppTango and more
of the Python dependencies.  Including pytest-forked.

The docker-executor runner is deprecated, replacement
is k8srunner.
parent 7e07894c
No related branches found
No related tags found
No related merge requests found
Showing
with 4028 additions and 1537 deletions
......@@ -146,7 +146,7 @@ class BaseCommand:
:param action: the action to perform on the state model
:type action: string
:raises: CommandError if the action is not allowed in current state
:raises CommandError: if the action is not allowed in current state
:returns: True is the action is allowed
"""
try:
......@@ -288,7 +288,7 @@ class ActionCommand(ResponseCommand):
:param return_code: The return_code returned by the ``do()``
method
:type return_code: ResultCode
:type return_code: :py:class:`ResultCode`
"""
if return_code == ResultCode.OK:
self.succeeded()
......
......@@ -139,7 +139,7 @@ class SKALogger(SKABaseDevice):
* argin[0]: list of DevLong. Desired logging level.
* argin[1]: list of DevString. Desired tango device.
:type argin: DevVarLongStringArray
:type argin: :py:class:`tango.DevVarLongStringArray`
:returns: None.
"""
......
......@@ -231,7 +231,7 @@ class SKAMaster(SKABaseDevice):
* [nrInstances]: DevLong. Number of instances of the capability.
* [Capability types]: DevString. Type of capability.
:type argin: DevVarLongStringArray.
:type argin: :py:class:`tango.DevVarLongStringArray`.
:return: True if capability can be achieved, False if cannot
:rtype: DevBoolean
......
......@@ -102,7 +102,7 @@ class SKAObsDevice(SKABaseDevice):
callback
:param obs_state: the new obs_state value
:type obs_state: ObsState
:type admin_mode: :py:class:`~ska.base.control_model.ObsState`
"""
self._obs_state = obs_state
self.push_change_event("obsState", obs_state)
......
......@@ -7,7 +7,7 @@
"""Release information for lmc-base-classes Python Package"""
name = """lmcbaseclasses"""
version = "0.6.6"
version = "0.7.0"
version_info = version.split(".")
description = """A set of generic base devices for SKA Telescope."""
author = "SKA India and SARAO and CSIRO"
......
This diff is collapsed.
This diff is collapsed.
"""
A module defining a list of fixtures that are shared across all ska.base tests.
"""
from collections import defaultdict
import importlib
import itertools
import json
......@@ -8,9 +9,11 @@ import pytest
from queue import Empty, Queue
from transitions import MachineError
from tango import EventType
from tango import DevState, EventType
from tango.test_context import DeviceTestContext
from ska.base.control_model import AdminMode, ObsState
def pytest_configure(config):
"""
......@@ -31,32 +34,30 @@ def pytest_generate_tests(metafunc):
will have its tests parameterised by the states and actions in the
specification provided by that mark
"""
# called once per each test function
mark = metafunc.definition.get_closest_marker("state_machine_tester")
if mark:
spec = mark.args[0]
states = set()
triggers = set()
expected = {}
for (from_state, trigger, to_state) in spec:
states.add(from_state)
states.add(to_state)
triggers.add(trigger)
expected[(from_state, trigger)] = to_state
states = {state: spec["states"][state] or state for state in spec["states"]}
states = sorted(states)
triggers = sorted(triggers)
triggers = set()
expected = defaultdict(lambda: None)
for transition in spec["transitions"]:
triggers.add(transition["trigger"])
expected[(transition["from"], transition["trigger"])] = states[transition["to"]]
test_cases = list(itertools.product(sorted(states), sorted(triggers)))
test_ids = [f"{state}-{trigger}" for (state, trigger) in test_cases]
metafunc.parametrize(
"state_under_test, action_under_test, expected_state",
[
(
state,
states[state],
trigger,
expected[(state, trigger)] if (state, trigger) in expected else None
) for (state, trigger) in itertools.product(states, triggers)
]
expected[(state, trigger)]
) for (state, trigger) in test_cases
],
ids=test_ids
)
......@@ -102,10 +103,12 @@ class StateMachineTester:
# Test that the action under test does what we expect it to
if expected_state is None:
# Action should fail and the state should not change
self.check_action_disallowed(machine, action_under_test)
assert not self.is_action_allowed(machine, action_under_test)
self.check_action_fails(machine, action_under_test)
self.assert_state(machine, state_under_test)
else:
# Action should succeed
assert self.is_action_allowed(machine, action_under_test)
self.perform_action(machine, action_under_test)
self.assert_state(machine, expected_state)
......@@ -122,6 +125,18 @@ class StateMachineTester:
"""
raise NotImplementedError()
def is_action_allowed(self, machine, action):
"""
Abstract method for checking whether the action under test is
allowed from the current state.
:param machine: the state machine under test
:type machine: state machine object instance
:param action: action to be performed on the state machine
:type action: str
"""
raise NotImplementedError()
def perform_action(self, machine, action):
"""
Abstract method for performing an action on the state machine
......@@ -133,7 +148,7 @@ class StateMachineTester:
"""
raise NotImplementedError()
def check_action_disallowed(self, machine, action):
def check_action_fails(self, machine, action):
"""
Abstract method for asserting that an action fails if performed
on the state machine under test in its current state.
......@@ -179,6 +194,18 @@ class TransitionsStateMachineTester(StateMachineTester):
"""
assert machine.state == state
def is_action_allowed(self, machine, action):
"""
Check whether the action under test is allowed from the current
state.
:param machine: the state machine under test
:type machine: state machine object instance
:param action: action to be performed on the state machine
:type action: str
"""
return action in machine.get_triggers(machine.state)
def perform_action(self, machine, action):
"""
Perform a given action on the state machine under test.
......@@ -190,9 +217,9 @@ class TransitionsStateMachineTester(StateMachineTester):
"""
machine.trigger(action)
def check_action_disallowed(self, machine, action):
def check_action_fails(self, machine, action):
"""
Assert that performing a given action on the state maching under
Check that attempting a given action on the state machine under
test fails in its current state.
:param machine: the state machine under test
......@@ -233,6 +260,25 @@ def load_data(name):
with open(f"tests/data/{name}.json", "r") as json_file:
return json.load(json_file)
def load_state_machine_spec(name):
"""
Loads a state machine specification by name.
:param name: name of the dataset to be loaded; this implementation
uses the name to find a JSON file containing the data to be
loaded.
:type name: string
"""
machine_spec = load_data(name)
for state in machine_spec["states"]:
state_spec = machine_spec["states"][state]
if "admin_mode" in state_spec:
state_spec["admin_mode"] = AdminMode[state_spec["admin_mode"]]
if "op_state" in state_spec:
state_spec["op_state"] = getattr(DevState, state_spec["op_state"])
if "obs_state" in state_spec:
state_spec["obs_state"] = ObsState[state_spec["obs_state"]]
return machine_spec
@pytest.fixture(scope="class")
def tango_context(request):
......@@ -252,7 +298,6 @@ def tango_context(request):
'CapabilityTypes': '',
'MaxCapabilities': ['BAND1:1', 'BAND2:1']
},
'SKASubarray': {
"CapabilityTypes": ["BAND1", "BAND2"],
'LoggingTargetsDefault': '',
......@@ -319,12 +364,14 @@ def tango_change_event_helper(tango_context):
state_callback.assert_calls([DevState.OFF, DevState.ON])
"""
class _Callback:
"""
Private callback handler class, an instance of which is returned
by the tango_change_event_helper each time it is used to
subscribe to a change event.
"""
@staticmethod
def subscribe(attribute_name):
"""
......@@ -371,7 +418,7 @@ def tango_change_event_helper(tango_context):
Event subscription callback
:param event_data: data about the change events
:type event_data: tango.EventData
:type event_data: :py:class:`tango.EventData`
"""
if event_data.err:
error = event_data.errors[0]
......
{
"states": {
"RESERVED": {},
"NOT_FITTED": {},
"OFFLINE": {},
"MAINTENANCE": {},
"ONLINE": {}
},
"transitions": [
{
"from": "NOT_FITTED",
"to": "NOT_FITTED",
"trigger": "to_notfitted"
},
{
"from": "NOT_FITTED",
"to": "RESERVED",
"trigger": "to_reserved"
},
{
"from": "NOT_FITTED",
"to": "OFFLINE",
"trigger": "to_offline"
},
{
"from": "RESERVED",
"to": "NOT_FITTED",
"trigger": "to_notfitted"
},
{
"from": "RESERVED",
"to": "RESERVED",
"trigger": "to_reserved"
},
{
"from": "RESERVED",
"to": "OFFLINE",
"trigger": "to_offline"
},
{
"from": "OFFLINE",
"to": "RESERVED",
"trigger": "to_reserved"
},
{
"from": "OFFLINE",
"to": "NOT_FITTED",
"trigger": "to_notfitted"
},
{
"from": "OFFLINE",
"to": "OFFLINE",
"trigger": "to_offline"
},
{
"from": "OFFLINE",
"to": "MAINTENANCE",
"trigger": "to_maintenance"
},
{
"from": "OFFLINE",
"to": "ONLINE",
"trigger": "to_online"
},
{
"from": "MAINTENANCE",
"to": "OFFLINE",
"trigger": "to_offline"
},
{
"from": "MAINTENANCE",
"to": "MAINTENANCE",
"trigger": "to_maintenance"
},
{
"from": "MAINTENANCE",
"to": "ONLINE",
"trigger": "to_online"
},
{
"from": "ONLINE",
"to": "OFFLINE",
"trigger": "to_offline"
},
{
"from": "ONLINE",
"to": "MAINTENANCE",
"trigger": "to_maintenance"
},
{
"from": "ONLINE",
"to": "ONLINE",
"trigger": "to_online"
}
]
}
\ No newline at end of file
[
[
"UNINITIALISED",
"init_started",
"INIT_ENABLED"
],
[
"INIT_ENABLED",
"to_notfitted",
"INIT_DISABLED"
],
[
"INIT_ENABLED",
"to_offline",
"INIT_DISABLED"
],
[
"INIT_ENABLED",
"to_online",
"INIT_ENABLED"
],
[
"INIT_ENABLED",
"to_maintenance",
"INIT_ENABLED"
],
[
"INIT_ENABLED",
"init_succeeded",
"OFF"
],
[
"INIT_ENABLED",
"init_failed",
"FAULT_ENABLED"
],
[
"INIT_ENABLED",
"fatal_error",
"FAULT_ENABLED"
],
[
"INIT_DISABLED",
"to_notfitted",
"INIT_DISABLED"
],
[
"INIT_DISABLED",
"to_offline",
"INIT_DISABLED"
],
[
"INIT_DISABLED",
"to_online",
"INIT_ENABLED"
],
[
"INIT_DISABLED",
"to_maintenance",
"INIT_ENABLED"
],
[
"INIT_DISABLED",
"init_succeeded",
"DISABLED"
],
[
"INIT_DISABLED",
"init_failed",
"FAULT_DISABLED"
],
[
"INIT_DISABLED",
"fatal_error",
"FAULT_DISABLED"
],
[
"FAULT_DISABLED",
"to_notfitted",
"FAULT_DISABLED"
],
[
"FAULT_DISABLED",
"to_offline",
"FAULT_DISABLED"
],
[
"FAULT_DISABLED",
"to_online",
"FAULT_ENABLED"
],
[
"FAULT_DISABLED",
"to_maintenance",
"FAULT_ENABLED"
],
[
"FAULT_DISABLED",
"reset_succeeded",
"DISABLED"
],
[
"FAULT_DISABLED",
"reset_failed",
"FAULT_DISABLED"
],
[
"FAULT_DISABLED",
"fatal_error",
"FAULT_DISABLED"
],
[
"FAULT_ENABLED",
"to_notfitted",
"FAULT_DISABLED"
],
[
"FAULT_ENABLED",
"to_offline",
"FAULT_DISABLED"
],
[
"FAULT_ENABLED",
"to_online",
"FAULT_ENABLED"
],
[
"FAULT_ENABLED",
"to_maintenance",
"FAULT_ENABLED"
],
[
"FAULT_ENABLED",
"reset_succeeded",
"OFF"
],
[
"FAULT_ENABLED",
"reset_failed",
"FAULT_ENABLED"
],
[
"FAULT_ENABLED",
"fatal_error",
"FAULT_ENABLED"
],
[
"DISABLED",
"to_notfitted",
"DISABLED"
],
[
"DISABLED",
"to_offline",
"DISABLED"
],
[
"DISABLED",
"to_online",
"OFF"
],
[
"DISABLED",
"to_maintenance",
"OFF"
],
[
"DISABLED",
"fatal_error",
"FAULT_DISABLED"
],
[
"OFF",
"to_notfitted",
"DISABLED"
],
[
"OFF",
"to_offline",
"DISABLED"
],
[
"OFF",
"to_online",
"OFF"
],
[
"OFF",
"to_maintenance",
"OFF"
],
[
"OFF",
"on_succeeded",
"ON"
],
[
"OFF",
"on_failed",
"FAULT_ENABLED"
],
[
"OFF",
"fatal_error",
"FAULT_ENABLED"
],
[
"ON",
"off_succeeded",
"OFF"
],
[
"ON",
"off_failed",
"FAULT_ENABLED"
],
[
"ON",
"fatal_error",
"FAULT_ENABLED"
]
]
\ No newline at end of file
This diff is collapsed.
[
[
"EMPTY",
"assign_started",
"RESOURCING"
],
[
"EMPTY",
"fatal_error",
"FAULT"
],
[
"RESOURCING",
"resourcing_succeeded_some_resources",
"IDLE"
],
[
"RESOURCING",
"resourcing_succeeded_no_resources",
"EMPTY"
],
[
"RESOURCING",
"resourcing_failed",
"FAULT"
],
[
"RESOURCING",
"fatal_error",
"FAULT"
],
[
"IDLE",
"assign_started",
"RESOURCING"
],
[
"IDLE",
"release_started",
"RESOURCING"
],
[
"IDLE",
"configure_started",
"CONFIGURING"
],
[
"IDLE",
"abort_started",
"ABORTING"
],
[
"IDLE",
"fatal_error",
"FAULT"
],
[
"CONFIGURING",
"configure_succeeded",
"READY"
],
[
"CONFIGURING",
"configure_failed",
"FAULT"
],
[
"CONFIGURING",
"abort_started",
"ABORTING"
],
[
"CONFIGURING",
"fatal_error",
"FAULT"
],
[
"READY",
"end_succeeded",
"IDLE"
],
[
"READY",
"end_failed",
"FAULT"
],
[
"READY",
"configure_started",
"CONFIGURING"
],
[
"READY",
"abort_started",
"ABORTING"
],
[
"READY",
"scan_started",
"SCANNING"
],
[
"READY",
"fatal_error",
"FAULT"
],
[
"SCANNING",
"scan_succeeded",
"READY"
],
[
"SCANNING",
"scan_failed",
"FAULT"
],
[
"SCANNING",
"end_scan_succeeded",
"READY"
],
[
"SCANNING",
"end_scan_failed",
"FAULT"
],
[
"SCANNING",
"abort_started",
"ABORTING"
],
[
"SCANNING",
"fatal_error",
"FAULT"
],
[
"ABORTING",
"abort_succeeded",
"ABORTED"
],
[
"ABORTING",
"abort_failed",
"FAULT"
],
[
"ABORTING",
"fatal_error",
"FAULT"
],
[
"ABORTED",
"obs_reset_started",
"RESETTING"
],
[
"ABORTED",
"restart_started",
"RESTARTING"
],
[
"ABORTED",
"fatal_error",
"FAULT"
],
[
"FAULT",
"obs_reset_started",
"RESETTING"
],
[
"FAULT",
"restart_started",
"RESTARTING"
],
[
"FAULT",
"fatal_error",
"FAULT"
],
[
"RESETTING",
"obs_reset_succeeded",
"IDLE"
],
[
"RESETTING",
"obs_reset_failed",
"FAULT"
],
[
"RESETTING",
"abort_started",
"ABORTING"
],
[
"RESETTING",
"fatal_error",
"FAULT"
],
[
"RESTARTING",
"restart_succeeded",
"EMPTY"
],
[
"RESTARTING",
"restart_failed",
"FAULT"
],
[
"RESTARTING",
"fatal_error",
"FAULT"
]
{
"states": {
"EMPTY": {},
"RESOURCING": {},
"FAULT": {},
"IDLE": {},
"CONFIGURING": {},
"ABORTING": {},
"READY": {},
"SCANNING": {},
"ABORTED": {},
"RESETTING": {},
"RESTARTING": {}
},
"transitions": [
{
"from": "EMPTY",
"to": "RESOURCING",
"trigger": "assign_started"
},
{
"from": "EMPTY",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "RESOURCING",
"to": "IDLE",
"trigger": "resourcing_succeeded_some_resources"
},
{
"from": "RESOURCING",
"to": "EMPTY",
"trigger": "resourcing_succeeded_no_resources"
},
{
"from": "RESOURCING",
"to": "FAULT",
"trigger": "resourcing_failed"
},
{
"from": "RESOURCING",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "IDLE",
"to": "RESOURCING",
"trigger": "assign_started"
},
{
"from": "IDLE",
"to": "RESOURCING",
"trigger": "release_started"
},
{
"from": "IDLE",
"to": "CONFIGURING",
"trigger": "configure_started"
},
{
"from": "IDLE",
"to": "ABORTING",
"trigger": "abort_started"
},
{
"from": "IDLE",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "CONFIGURING",
"to": "READY",
"trigger": "configure_succeeded"
},
{
"from": "CONFIGURING",
"to": "FAULT",
"trigger": "configure_failed"
},
{
"from": "CONFIGURING",
"to": "ABORTING",
"trigger": "abort_started"
},
{
"from": "CONFIGURING",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "READY",
"to": "IDLE",
"trigger": "end_succeeded"
},
{
"from": "READY",
"to": "FAULT",
"trigger": "end_failed"
},
{
"from": "READY",
"to": "CONFIGURING",
"trigger": "configure_started"
},
{
"from": "READY",
"to": "ABORTING",
"trigger": "abort_started"
},
{
"from": "READY",
"to": "SCANNING",
"trigger": "scan_started"
},
{
"from": "READY",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "SCANNING",
"to": "READY",
"trigger": "scan_succeeded"
},
{
"from": "SCANNING",
"to": "FAULT",
"trigger": "scan_failed"
},
{
"from": "SCANNING",
"to": "READY",
"trigger": "end_scan_succeeded"
},
{
"from": "SCANNING",
"to": "FAULT",
"trigger": "end_scan_failed"
},
{
"from": "SCANNING",
"to": "ABORTING",
"trigger": "abort_started"
},
{
"from": "SCANNING",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "ABORTING",
"to": "ABORTED",
"trigger": "abort_succeeded"
},
{
"from": "ABORTING",
"to": "FAULT",
"trigger": "abort_failed"
},
{
"from": "ABORTING",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "ABORTED",
"to": "RESETTING",
"trigger": "reset_started"
},
{
"from": "ABORTED",
"to": "RESTARTING",
"trigger": "restart_started"
},
{
"from": "ABORTED",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "FAULT",
"to": "RESETTING",
"trigger": "reset_started"
},
{
"from": "FAULT",
"to": "RESTARTING",
"trigger": "restart_started"
},
{
"from": "FAULT",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "RESETTING",
"to": "IDLE",
"trigger": "reset_succeeded"
},
{
"from": "RESETTING",
"to": "FAULT",
"trigger": "reset_failed"
},
{
"from": "RESETTING",
"to": "ABORTING",
"trigger": "abort_started"
},
{
"from": "RESETTING",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "RESTARTING",
"to": "EMPTY",
"trigger": "restart_succeeded"
},
{
"from": "RESTARTING",
"to": "FAULT",
"trigger": "restart_failed"
},
{
"from": "RESTARTING",
"to": "FAULT",
"trigger": "fatal_error"
}
]
}
\ No newline at end of file
{
"states": {
"UNINITIALISED": {},
"INIT": {},
"DISABLE": {},
"INIT_ADMIN": {},
"DISABLE_ADMIN": {},
"STANDBY": {},
"OFF": {},
"FAULT": {},
"FAULT_ADMIN": {},
"ON": {}
},
"transitions": [
{
"from": "UNINITIALISED",
"to": "INIT",
"trigger": "init_started"
},
{
"from": "INIT",
"to": "DISABLE",
"trigger": "init_succeeded_disable"
},
{
"from": "INIT_ADMIN",
"to": "DISABLE_ADMIN",
"trigger": "init_succeeded_disable"
},
{
"from": "INIT",
"to": "STANDBY",
"trigger": "init_succeeded_standby"
},
{
"from": "INIT",
"to": "OFF",
"trigger": "init_succeeded_off"
},
{
"from": "INIT",
"to": "FAULT",
"trigger": "init_failed"
},
{
"from": "INIT_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "init_failed"
},
{
"from": "INIT",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "INIT",
"to": "INIT_ADMIN",
"trigger": "admin_on"
},
{
"from": "INIT",
"to": "INIT",
"trigger": "admin_off"
},
{
"from": "INIT_ADMIN",
"to": "INIT_ADMIN",
"trigger": "admin_on"
},
{
"from": "INIT_ADMIN",
"to": "INIT",
"trigger": "admin_off"
},
{
"from": "INIT_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "fatal_error"
},
{
"from": "FAULT",
"to": "DISABLE",
"trigger": "reset_succeeded_disable"
},
{
"from": "FAULT_ADMIN",
"to": "DISABLE_ADMIN",
"trigger": "reset_succeeded_disable"
},
{
"from": "FAULT",
"to": "STANDBY",
"trigger": "reset_succeeded_standby"
},
{
"from": "FAULT",
"to": "OFF",
"trigger": "reset_succeeded_off"
},
{
"from": "FAULT",
"to": "FAULT",
"trigger": "reset_failed"
},
{
"from": "FAULT_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "reset_failed"
},
{
"from": "FAULT",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "FAULT_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "fatal_error"
},
{
"from": "FAULT",
"to": "FAULT_ADMIN",
"trigger": "admin_on"
},
{
"from": "FAULT",
"to": "FAULT",
"trigger": "admin_off"
},
{
"from": "FAULT_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "admin_on"
},
{
"from": "FAULT_ADMIN",
"to": "FAULT",
"trigger": "admin_off"
},
{
"from": "DISABLE",
"to": "DISABLE",
"trigger": "disable_succeeded"
},
{
"from": "DISABLE",
"to": "FAULT",
"trigger": "disable_failed"
},
{
"from": "DISABLE",
"to": "STANDBY",
"trigger": "standby_succeeded"
},
{
"from": "DISABLE",
"to": "FAULT",
"trigger": "standby_failed"
},
{
"from": "DISABLE",
"to": "OFF",
"trigger": "off_succeeded"
},
{
"from": "DISABLE",
"to": "FAULT",
"trigger": "off_failed"
},
{
"from": "DISABLE",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "DISABLE_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "fatal_error"
},
{
"from": "DISABLE",
"to": "DISABLE_ADMIN",
"trigger": "admin_on"
},
{
"from": "DISABLE",
"to": "DISABLE",
"trigger": "admin_off"
},
{
"from": "DISABLE_ADMIN",
"to": "DISABLE_ADMIN",
"trigger": "admin_on"
},
{
"from": "DISABLE_ADMIN",
"to": "DISABLE",
"trigger": "admin_off"
},
{
"from": "DISABLE_ADMIN",
"to": "DISABLE_ADMIN",
"trigger": "disable_succeeded"
},
{
"from": "DISABLE_ADMIN",
"to": "FAULT_ADMIN",
"trigger": "disable_failed"
},
{
"from": "STANDBY",
"to": "DISABLE",
"trigger": "disable_succeeded"
},
{
"from": "STANDBY",
"to": "FAULT",
"trigger": "disable_failed"
},
{
"from": "STANDBY",
"to": "STANDBY",
"trigger": "standby_succeeded"
},
{
"from": "STANDBY",
"to": "FAULT",
"trigger": "standby_failed"
},
{
"from": "STANDBY",
"to": "OFF",
"trigger": "off_succeeded"
},
{
"from": "STANDBY",
"to": "FAULT",
"trigger": "off_failed"
},
{
"from": "STANDBY",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "OFF",
"to": "DISABLE",
"trigger": "disable_succeeded"
},
{
"from": "OFF",
"to": "FAULT",
"trigger": "disable_failed"
},
{
"from": "OFF",
"to": "STANDBY",
"trigger": "standby_succeeded"
},
{
"from": "OFF",
"to": "FAULT",
"trigger": "standby_failed"
},
{
"from": "OFF",
"to": "OFF",
"trigger": "off_succeeded"
},
{
"from": "OFF",
"to": "FAULT",
"trigger": "off_failed"
},
{
"from": "OFF",
"to": "ON",
"trigger": "on_succeeded"
},
{
"from": "OFF",
"to": "FAULT",
"trigger": "on_failed"
},
{
"from": "OFF",
"to": "FAULT",
"trigger": "fatal_error"
},
{
"from": "ON",
"to": "OFF",
"trigger": "off_succeeded"
},
{
"from": "ON",
"to": "FAULT",
"trigger": "off_failed"
},
{
"from": "ON",
"to": "ON",
"trigger": "on_succeeded"
},
{
"from": "ON",
"to": "FAULT",
"trigger": "on_failed"
},
{
"from": "ON",
"to": "FAULT",
"trigger": "fatal_error"
}
]
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -3,31 +3,57 @@ This module contains the tests for the ska.base.state_machine module.
"""
import pytest
from ska.base.state_machine import BaseDeviceStateMachine, ObservationStateMachine
from .conftest import load_data, TransitionsStateMachineTester
from ska.base.state_machine import (
AdminModeStateMachine,
OperationStateMachine,
ObservationStateMachine,
)
from .conftest import load_state_machine_spec, TransitionsStateMachineTester
@pytest.mark.state_machine_tester(load_data("base_device_state_machine"))
class BaseDeviceStateMachineTester(TransitionsStateMachineTester):
@pytest.mark.state_machine_tester(load_state_machine_spec("operation_state_machine"))
class TestOperationStateMachine(TransitionsStateMachineTester):
"""
This class contains the test for the BaseDeviceStateMachine class.
This class contains the test for the DeviceStateMachine class.
"""
@pytest.fixture
def machine(self):
"""
Fixture that returns the state machine under test in this class
:yields: the state machine under test
"""
yield BaseDeviceStateMachine()
yield OperationStateMachine()
@pytest.mark.state_machine_tester(load_data("observation_state_machine"))
@pytest.mark.state_machine_tester(load_state_machine_spec("admin_mode_state_machine"))
class TestAdminModeStateMachine(TransitionsStateMachineTester):
"""
This class contains the test for the DeviceStateMachine class.
"""
@pytest.fixture
def machine(self):
"""
Fixture that returns the state machine under test in this class
:yields: the state machine under test
"""
yield AdminModeStateMachine()
@pytest.mark.state_machine_tester(load_state_machine_spec("observation_state_machine"))
class TestObservationStateMachine(TransitionsStateMachineTester):
"""
This class contains the test for the ObservationStateMachine class.
"""
@pytest.fixture
def machine(self):
"""
Fixture that returns the state machine under test in this class
:yields: the state machine under test
"""
yield ObservationStateMachine()
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment