ci: lcm: making lcm-pcm test indifferent to index changes
During the course of the test, containers are created and tested to properly survive a simulated software upgrade. However, pcm does not guarantee that indexes will be the same after SWU, especially if there were any gaps in numbering prior to the upgrade. This change to the test makes it index-agnostic by replacing all possibly affected indexes with placeholders. References: PPW-1787 Closes: PPW-1787 Signed-off-by: a.kuznetsov <a.kuznetsov@inango-systems.com>
This commit is contained in:
parent
7393c11941
commit
5dd16ff32c
@ -6,10 +6,12 @@ If test is running on a Valyrian, skip the test due to PCF-2669:
|
||||
|
||||
$ alias R="${CRAM_REMOTE_COMMAND:-}"
|
||||
$ alias C="${CRAM_REMOTE_COPY:-}"
|
||||
$ T="/tmp/lcm-pcm"
|
||||
$ S=". /tmp/script_functions.sh"
|
||||
$ . ${TESTDIR}/script_functions.sh
|
||||
$ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null
|
||||
$ R "${S} && setup_hostobjects"
|
||||
$ mkdir /tmp/lcm-pcm
|
||||
$ mkdir ${T}
|
||||
|
||||
Restart the LCM Agent so we start fresh with resetted indexes for ease of comparing the data models:
|
||||
$ R "service rlyeh stop"
|
||||
@ -51,9 +53,9 @@ Perform the backup process:
|
||||
|
||||
Save the data model before simulated firmware upgrade:
|
||||
|
||||
$ R "ba-cli 'Cthulhu.?'" > /tmp/lcm-pcm/cthulhu_before.dm
|
||||
$ R "ba-cli 'SoftwareModules.?'" > /tmp/lcm-pcm/timingila_before.dm
|
||||
$ R "ba-cli 'Rlyeh.?'" > /tmp/lcm-pcm/rlyeh_before.dm
|
||||
$ R "ba-cli 'Cthulhu.?'" > ${T}/cthulhu_before.dm
|
||||
$ R "ba-cli 'SoftwareModules.?'" > ${T}/timingila_before.dm
|
||||
$ R "ba-cli 'Rlyeh.?'" > ${T}/rlyeh_before.dm
|
||||
|
||||
Simulate firmware upgrade with manual configuration removal:
|
||||
|
||||
@ -61,20 +63,22 @@ Simulate firmware upgrade with manual configuration removal:
|
||||
|
||||
Save the data model after simulated firmware upgrade:
|
||||
|
||||
$ R "ba-cli 'Cthulhu.?'" > /tmp/lcm-pcm/cthulhu_after.dm
|
||||
$ R "ba-cli 'SoftwareModules.?'" > /tmp/lcm-pcm/timingila_after.dm
|
||||
$ R "ba-cli 'Rlyeh.?'" > /tmp/lcm-pcm/rlyeh_after.dm
|
||||
$ R "ba-cli 'Cthulhu.?'" > ${T}/cthulhu_after.dm
|
||||
$ R "ba-cli 'SoftwareModules.?'" > ${T}/timingila_after.dm
|
||||
$ R "ba-cli 'Rlyeh.?'" > ${T}/rlyeh_after.dm
|
||||
|
||||
Compare the data models before and after the firmware upgrade:
|
||||
|
||||
$ diff /tmp/lcm-pcm/rlyeh_before.dm /tmp/lcm-pcm/rlyeh_after.dm
|
||||
$ sed -i -e "s/\(Sandbox\.Instances\)\.2/\1\.1/g" /tmp/lcm-pcm/cthulhu_after.dm
|
||||
$ sed -i -e "s/\(Sandbox\.Instances\)\.3/\1\.2/g" /tmp/lcm-pcm/cthulhu_after.dm
|
||||
$ cp ${TESTDIR}/lcm-pcm_runtime_params /tmp/lcm-pcm/runtime_params
|
||||
$ cthulhu_diff_params=$(diff -n /tmp/lcm-pcm/cthulhu_before.dm /tmp/lcm-pcm/cthulhu_after.dm | grep -o '^Cthulhu[^=]\+')
|
||||
$ for param in ${cthulhu_diff_params}; do grep -Fxq "${param}" /tmp/lcm-pcm/runtime_params || echo "ERROR: runtime parameter mismatch - ${param}"; done
|
||||
$ timingila_diff_params=$(diff -n /tmp/lcm-pcm/timingila_before.dm /tmp/lcm-pcm/timingila_after.dm | grep -o '^SoftwareModules[^=]\+')
|
||||
$ for param in ${timingila_diff_params}; do grep -Fxq "${param}" /tmp/lcm-pcm/runtime_params || echo "ERROR: runtime parameter mismatch - ${param}"; done
|
||||
$ diff ${T}/rlyeh_before.dm ${T}/rlyeh_after.dm
|
||||
$ normalize_dump ${T}/cthulhu_before.dm
|
||||
$ normalize_dump ${T}/cthulhu_after.dm
|
||||
$ cp ${TESTDIR}/lcm-pcm_runtime_params ${T}/runtime_params
|
||||
$ cthulhu_diff_params=$(diff -n ${T}/cthulhu_before.dm ${T}/cthulhu_after.dm | grep -o '^Cthulhu[^=]\+')
|
||||
$ for param in ${cthulhu_diff_params}; do grep -Fxq "${param}" ${T}/runtime_params || echo "ERROR: runtime parameter mismatch - ${param}"; done
|
||||
$ normalize_dump ${T}/timingila_before.dm
|
||||
$ normalize_dump ${T}/timingila_after.dm
|
||||
$ timingila_diff_params=$(diff -n ${T}/timingila_before.dm ${T}/timingila_after.dm | grep -o '^SoftwareModules[^=]\+')
|
||||
$ for param in ${timingila_diff_params}; do grep -Fxq "${param}" ${T}/runtime_params || echo "ERROR: runtime parameter mismatch - ${param}"; done
|
||||
|
||||
Check that ApplicationData volumes are available inside the container and use them:
|
||||
|
||||
|
||||
@ -1,36 +1,37 @@
|
||||
Cthulhu.Container.Instances.1.RootfsIsMounted
|
||||
Cthulhu.Container.Instances.1.Pid
|
||||
Cthulhu.Container.Instances.1.StartTime
|
||||
Cthulhu.Container.Instances.1.AutoRestart.RunningSince
|
||||
Cthulhu.Container.Instances.1.Interfaces.6.Addresses.1.Address
|
||||
Cthulhu.Container.Instances.1.PluginsPrivate.NetworkConfig.FirewallRules.1.Path
|
||||
Cthulhu.Container.Instances.1.PluginsPrivate.NetworkConfig.FirewallRules.2.Path
|
||||
Cthulhu.Container.Instances.1.Resources.Stats.DiskSpace.Free
|
||||
Cthulhu.Container.Instances.1.Resources.Stats.DiskSpace.Used
|
||||
Cthulhu.Container.Instances.1.Resources.Stats.Memory.Used
|
||||
Cthulhu.Sandbox.Instances.1.Pid
|
||||
Cthulhu.Sandbox.Instances.1.Stats.DiskSpace.Free
|
||||
Cthulhu.Sandbox.Instances.1.Stats.DiskSpace.Used
|
||||
Cthulhu.Sandbox.Instances.1.Stats.Memory.Used
|
||||
Cthulhu.Sandbox.Instances.2.Created
|
||||
Cthulhu.Sandbox.Instances.2.Pid
|
||||
Cthulhu.Sandbox.Instances.2.Stats.DiskSpace.Free
|
||||
Cthulhu.Sandbox.Instances.2.Stats.DiskSpace.Used
|
||||
Cthulhu.Sandbox.Instances.2.Stats.Memory.Used
|
||||
SoftwareModules.ExecEnv.1.AvailableDiskSpace
|
||||
SoftwareModules.ExecutionUnit.1.AvailableDiskSpace
|
||||
SoftwareModules.ExecutionUnit.1.DiskSpaceInUse
|
||||
SoftwareModules.ExecutionUnit.1.MemoryInUse
|
||||
SoftwareModules.ExecutionUnit.1.Uptime
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.Action
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.Alias
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.CurrentModuleVersion
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.Date
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.Event
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.ExecEnvName
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.FaultMessage
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.PolicyScope
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.PreviousModuleVersion
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.Status
|
||||
Cthulhu.Information.LocalPolicyManager.Action.1.UUID
|
||||
Cthulhu.Container.Instances.{i}.RootfsIsMounted
|
||||
Cthulhu.Container.Instances.{i}.Pid
|
||||
Cthulhu.Container.Instances.{i}.StartTime
|
||||
Cthulhu.Container.Instances.{i}.AutoRestart.RunningSince
|
||||
Cthulhu.Container.Instances.{i}.Interfaces.2.Addresses.1.Address
|
||||
Cthulhu.Container.Instances.{i}.Interfaces.6.Addresses.1.Address
|
||||
Cthulhu.Container.Instances.{i}.PluginsPrivate.NetworkConfig.FirewallRules.1.Path
|
||||
Cthulhu.Container.Instances.{i}.PluginsPrivate.NetworkConfig.FirewallRules.2.Path
|
||||
Cthulhu.Container.Instances.{i}.Resources.Stats.DiskSpace.Free
|
||||
Cthulhu.Container.Instances.{i}.Resources.Stats.DiskSpace.Used
|
||||
Cthulhu.Container.Instances.{i}.Resources.Stats.Memory.Used
|
||||
Cthulhu.Sandbox.Instances.{i}.Pid
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.DiskSpace.Free
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.DiskSpace.Used
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.Memory.Used
|
||||
Cthulhu.Sandbox.Instances.{i}.Created
|
||||
Cthulhu.Sandbox.Instances.{i}.Pid
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.DiskSpace.Free
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.DiskSpace.Used
|
||||
Cthulhu.Sandbox.Instances.{i}.Stats.Memory.Used
|
||||
SoftwareModules.ExecEnv.{i}.AvailableDiskSpace
|
||||
SoftwareModules.ExecutionUnit.{i}.AvailableDiskSpace
|
||||
SoftwareModules.ExecutionUnit.{i}.DiskSpaceInUse
|
||||
SoftwareModules.ExecutionUnit.{i}.MemoryInUse
|
||||
SoftwareModules.ExecutionUnit.{i}.Uptime
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.Action
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.Alias
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.CurrentModuleVersion
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.Date
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.Event
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.ExecEnvName
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.FaultMessage
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.PolicyScope
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.PreviousModuleVersion
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.Status
|
||||
Cthulhu.Information.LocalPolicyManager.Action.{i}.UUID
|
||||
|
||||
@ -1198,3 +1198,74 @@ cleanup_pcm_test() {
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
cleanup_appdata() {
|
||||
umount /lcm/cthulhu/data/mounts/generic > /dev/null 2>&1
|
||||
umount /lcm/cthulhu/data/mounts/generic/applicationdata/mounts/00000000-0000-5000-b000-000000000001/Volume1 > /dev/null 2>&1
|
||||
umount /lcm/cthulhu/data/mounts/generic/applicationdata/mounts/00000000-0000-5000-b000-000000000001/Volume2 > /dev/null 2>&1
|
||||
rm -rf /lcm/cthulhu/data/mounts/generic/applicationdata
|
||||
service cthulhu stop > /dev/null 2>&1
|
||||
while [ -n "$(pidof cthulhu)" ]; do sleep 1; done; sleep 10
|
||||
rm -rf /etc/config/cthulhu/* > /dev/null 2>&1
|
||||
service cthulhu start > /dev/null
|
||||
sleep 2
|
||||
service timingila restart > /dev/null
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
## install_basic_container() - Install a container with default parameters and wait for it to become active.
|
||||
##
|
||||
## Fixed defaults applied by this function:
|
||||
## --version prplos-v1 : Container image version to install.
|
||||
## --ee : Execution environment (defaults to DEFAULT_EE = "generic" if not overridden).
|
||||
## --uuid : Deployment unit UUID (defaults to DEFAULT_UUID if not overridden).
|
||||
## --privileged true : Container is started in privileged mode.
|
||||
##
|
||||
## Parameters:
|
||||
## "$@" : Optional extra arguments forwarded verbatim to install_ctr.
|
||||
## Any supported install_ctr argument (--url, --network, --hostobject,
|
||||
## --appdata, --envvar, --retaindata, --usprequired, etc.) can be supplied
|
||||
## here to override the defaults above.
|
||||
##
|
||||
## Example:
|
||||
## install_basic_container
|
||||
## install_basic_container --envvar --network '{ShareParentNetwork = "true"}'
|
||||
##
|
||||
install_basic_container() {
|
||||
install_ctr --version prplos-v1 --ee --uuid --privileged true "$@" > /dev/null
|
||||
}
|
||||
|
||||
##
|
||||
## install_basic_container_no_wait() - Install a container with default parameters without waiting for it to become active.
|
||||
##
|
||||
## Fixed defaults applied by this function:
|
||||
## --version prplos-v1 : Container image version to install.
|
||||
## --ee : Execution environment (defaults to DEFAULT_EE = "generic" if not overridden).
|
||||
## --uuid : Deployment unit UUID (defaults to DEFAULT_UUID if not overridden).
|
||||
## --privileged true : Container is started in privileged mode.
|
||||
##
|
||||
## Parameters:
|
||||
## "$@" : Optional extra arguments forwarded verbatim to install_ctr_no_wait.
|
||||
## Any supported install_ctr argument (--url, --network, --hostobject,
|
||||
## --appdata, --envvar, --retaindata, --usprequired, etc.) can be supplied
|
||||
## here to override the defaults above.
|
||||
##
|
||||
## Example:
|
||||
## install_basic_container_no_wait
|
||||
## install_basic_container_no_wait --envvar
|
||||
##
|
||||
install_basic_container_no_wait() {
|
||||
install_ctr_no_wait --version prplos-v1 --ee --uuid --privileged true "$@"
|
||||
}
|
||||
|
||||
normalize_dump(){
|
||||
## Generic substitution of any instantionated subtree
|
||||
sed -i -e "s/\(\.Instances\)\.[[:digit:]]/\1\.{i}/g" $1
|
||||
|
||||
## Softwware modules specific cases
|
||||
sed -i -e "s/\(SoftwareModules\.ExecEnv\)\.[[:digit:]]/\1\.{i}/g" $1
|
||||
sed -i -e "s/\(SoftwareModules\.ExecutionUnit\)\.[[:digit:]]/\1\.{i}/g" $1
|
||||
|
||||
## Cthulhu LocalPolicy spacific case
|
||||
sed -i -e "s/\(\.LocalPolicyManager\.Action\)\.[[:digit:]]/\1\.{i}/g" $1
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user