Tests for LUC management
Tests for LUC management
How to verify that the NSC correctly sets the LUC and brings up apps in the LUC
correctly during start-up.
Test environment and setup
GDBus
This test assumes that the gdbus command line tool is installed
on the system. Without this application, the LUC tests described here can not be
performed.
Helpful functions
gdbus functions will be used frequently. To avoid excessive typing, the following
functions should be defined and called:
# function to begin registration
begin()
{
gdbus call --system \
-d org.genivi.NodeStartupController1 \
-o /org/genivi/NodeStartupController1/NodeStartupController \
-m org.genivi.NodeStartupController1.NodeStartupController.BeginLUCRegistration \
}
# function to make a registration call
register()
{
gdbus call --system \
-d org.genivi.NodeStartupController1 \
-o /org/genivi/NodeStartupController1/NodeStartupController \
-m org.genivi.NodeStartupController1.NodeStartupController.RegisterWithLUC \
"$1"
}
# function to finish registration
end()
{
gdbus call --system \
-d org.genivi.NodeStartupController1 \
-o /org/genivi/NodeStartupController1/NodeStartupController \
-m org.genivi.NodeStartupController1.NodeStartupController.FinishLUCRegistration \
}
Starting the necessary services
The NSM dummy and the Node Startup Controller services need to be started
prior to running any of the tests described here. This is done using the
following commands:
systemctl start nsm-dummy.service
systemctl start node-startup-controller.service
Check the DLT log after starting these services. If the following messages
was logged to the DLT you need to restart
node-startup-controller.service:
APID CTID Payload
NSC- CTRL [LUC is not required]
To restart node-startup-controller.service simply run:
systemctl restart node-startup-controller.service
Test cases
The following test cases for LUC management are described in this document:
All of these tests need to be executed in the order they are listed here.
1. Registration of a simple dictionary
Description
Registers one application for a single LUC type, restarts the
Node Startup Controller and verifies that it attempts to start this app
as part of the LUC.
Test commands
begin
register "{0: ['app1.unit']}"
end
systemctl restart node-startup-controller.service
Desired behaviour and output
The DLT log should now contain the following log messages:
APID CTID Payload
NSC- CTRL [Updated LUC to: "{0: ['app1.unit']}"]
NSC- CTRL [Starting LUC group: 0]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 0]
2. Registration does not happen on an isolated RegisterWithLUC() call
Description
Attempts to register an application by calling
RegisterWithLUC() all by itself. Restarts the Node Startup
Controller and verifies that the last user context hasn't changed.
Test commands
register "{1: ['app2.unit']}"
systemctl restart node-startup-controller.service
Desired behaviour and output
The DLT log should now contain the following log messages:
APID CTID Payload
NSC- CTRL [Starting LUC group: 0]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 0]
3. An isolated FinishLUCRegistration() call will not change the LUC
Description
Calls FinishLUCRegistration() without having started
registration or registered any apps with it. Restarts the Node Startup Controller
to verify that the LUC hasn't changed.
Test commands
end
systemctl restart node-startup-controller.service
Desired behaviour and output
The DLT log should now contain the following log messages:
APID CTID Payload
NSC- CTRL [Starting LUC group: 0]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 0]
4. Registration of a complex dictionary
Description
Registers the Last User Context with multiple LUC groups and multiple apps in
a single LUC group. Restarts the Node Startup Controller to verify the LUC was
changed and starts the apps in the correct order.
Test commands
begin
register "{0: ['app1.unit'], 1: ['app1.unit', 'app3.unit'], 2: ['app2.unit']}"
end
systemctl restart node-startup-controller.service
Desired behaviour and output
The start order of LUC groups may be different depending on the build-time
configuration of the Node Startup Controller in the test system.
The DLT log should now contain the following messages
APID CTID Payload
NSC- CTRL [Updated LUC to: "{0: ['app1.unit'], 1: ['app1.unit', 'app3.unit'], 2: ['app2.unit']}"]
NSC- CTRL [Starting LUC group: 0]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 0]
NSC- CTRL [Starting LUC group: 1]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Starting LUC app: app3.unit]
NSC- CTRL [Finished starting LUC app: app3.unit]
NSC- CTRL [Finished starting LUC group: 1]
NSC- CTRL [Starting LUC group: 2]
NSC- CTRL [Starting LUC app: app2.unit]
NSC- CTRL [Finished starting LUC app: app2.unit]
NSC- CTRL [Finished starting LUC group: 2]
5. Registration can happen with a series of RegisterWithLUC() calls
Description
Registers multiple applications to the LUC in a series of
RegisterWithLUC() calls. Restarts the Node Startup Controller
and verifies that the apps added in each call are started in the correct order.
Test commands
begin
register "{0: ['app1.unit']}"
register "{1: ['app3.unit']}"
end
systemctl restart node-startup-controller.service
Desired behaviour and output
The DLT log should now contain the following log messages:
APID CTID Payload
NSC- CTRL [Updated LUC to: "{0: ['app1.unit']}"]
NSC- CTRL [Updated LUC to: "{0: ['app1.unit'], 1: ['app3.unit']}"]
NSC- CTRL [Starting LUC group: 0]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 0]
NSC- CTRL [Starting LUC group: 1]
NSC- CTRL [Starting LUC app: app3.unit]
NSC- CTRL [Finished starting LUC app: app3.unit]
NSC- CTRL [Finished starting LUC group: 1]
6. Repeated registration of an app changes the order in the LUC
Description
Registers two applications, then registers the first application again. Restarts
the Node Startup Controller to verify that the order the applications start is
changed by the second registration.
Test commands
begin
register "{1: ['app1.unit', 'app2.unit']}"
register "{1: ['app1.unit']}"
end
systemctl restart node-startup-controller.service
Desired behaviour and output
The DLT log should now contain the following log messages:
APID CTID Payload
NSC- CTRL [Updated LUC to: "{1: ['app1.unit', 'app2.unit']}"]
NSC- CTRL [Updated LUC to: "{1: ['app2.unit', 'app1.unit']}"]
NSC- CTRL [Starting LUC group: 1]
NSC- CTRL [Starting LUC app: app2.unit]
NSC- CTRL [Finished starting LUC app: app2.unit]
NSC- CTRL [Starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC app: app1.unit]
NSC- CTRL [Finished starting LUC group: 1]