Skip to content

(CNTR-3)TestContainerPersistenceAfterColdReboot should start container with non default restart policy for the container to be persistent after reboot #5268

@prathapcv

Description

@prathapcv

Describe the bug
CNTR-3 test 'TestContainerPersistenceAfterColdReboot' is starting the container with default restart policy(none) because of which the container is not persistent after reboot.

To Reproduce
Steps to reproduce the behavior:

  1. Setup device for CNTR-3 featureprofile test
  2. Run the test TestContainerPersistenceAfterColdReboot in failover_test.go
  3. Test will fail with current code

Expected behavior
As per the test, the container is expected to be in RUNNING state after cold reboot of the device. But the container is not in RUNNING state as it was not started with restart policy set to 'always' or 'on-failure' before reboot.

Logs
=== RUN TestContainerPersistenceAfterColdReboot/VerifyPersistence
failover_test.go:485: Waiting for DUT to reboot and reconnect...
failover_test.go:490:
*** Fetching gNOI clients for scapa-ptx10008-a...

failover_test.go:495: Container persistence failed: timed out after 5m0s waiting for container cntrsrv to be in state RUNNING

=== NAME TestContainerPersistenceAfterColdReboot
failover_test.go:415: Starting cleanup...
failover_test.go:417:
*** Fetching gNOI clients for scapa-ptx10008-a...

failover_test.go:427: Cleanup finished.

Network device platform (please complete the following information):

Additional context

The issue is not seen when I make following changes to line number 445-448 of failover_test.go to include restart-policy while starting container:

Original code:

            startOpts := []client.StartOption{
                    client.WithPorts([]string{"60061:60061"}),
                    client.WithVolumes([]string{fmt.Sprintf("%s:%s", volName, "/data")}),
            }

Modified code:

            startOpts := []client.StartOption{
                    client.WithPorts([]string{"60061:60061"}),
                    client.WithVolumes([]string{fmt.Sprintf("%s:%s", volName, "/data")}),
                    client.WithRestartPolicy("always"),
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions