Test CronJob For Volumes That Are Detached For A Long Time

https://github.com/longhorn/longhorn/issues/2513

Steps

  1. Make sure the setting Allow Recurring Job While Volume Is Detached is disabled
  2. Create a volume. Attach to a node. Create a recurring backup job that run every minute.
  3. Wait for the cronjob to be scheduled a few times.
  4. Detach the volume.
  5. Verify that the CronJob get deleted.
  6. Wait 2 hours (> 100 mins).
  7. Attach the volume to a node.
  8. Verify that the CronJob get created.
  9. Verify that Kubernetes schedules a run for the CronJob at the beginning of the next minute.
  10. Make sure the setting Allow Recurring Job While Volume Is Detached is enabled.
  11. Detach the volume.
  12. Verify that the CronJob is not deleted.
  13. Wait for Kubernetes to schedule a run for the CronJob at the beginning of the next minute. Verify that the volume is attached, CronJob runs, then volume is detached.
[Edit]