Skip to content

Commit

Permalink
Expand Linode backup integration test to include backup schedule sett…
Browse files Browse the repository at this point in the history
…ing test
  • Loading branch information
zliang-akamai committed Dec 15, 2023
1 parent eaee3f4 commit 67ae519
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions tests/integration/cloud/clouds/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
:codeauthor: Nicole Thomas <[email protected]>
"""

import random

# Create the cloud instance name to be used throughout the tests
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
Expand All @@ -15,7 +16,7 @@ class LinodeTest(CloudTest):
PROVIDER = "linode"
REQUIRED_PROVIDER_CONFIG_ITEMS = ("apikey", "password")

def _test_instance(self, profile):
def _test_instance(self, profile, destroy=True):
"""
Test creating an instance on Linode for a given profile.
"""
Expand All @@ -25,11 +26,56 @@ def _test_instance(self, profile):
ret_str = self.run_cloud(" ".join(args), timeout=TIMEOUT)

self.assertInstanceExists(ret_str)
self.assertDestroyInstance()
if destroy:
self.assertDestroyInstance()
return ret_str

def test_instance(self):
return self._test_instance("linode-test")

def test_instance_with_backup(self):
return self._test_instance("linode-test-with-backup")
profile = "linode-test-with-backup"

self._test_instance(profile, False)

set_backup_func = "set_backup_schedule"

available_days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
]
available_windows = [
"W0",
"W2",
"W4",
"W6",
"W8",
"W10",
"W12",
"W14",
"W16",
"W18",
"W20",
"W22",
]

args = [
"-f",
set_backup_func,
self.PROVIDER,
f"name={self.instance_name}",
f"day={random.choice(available_days)}",
f"window={random.choice(available_windows)}",
"auto_enable=True",
]
self.run_cloud(" ".join(args), timeout=TIMEOUT)

args = ["-f", set_backup_func, self.PROVIDER, f"name={self.instance_name}"]
self.run_cloud(" ".join(args), timeout=TIMEOUT)

self.assertDestroyInstance()

0 comments on commit 67ae519

Please sign in to comment.