forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand Linode backup integration test to include backup schedule sett…
…ing test
- Loading branch information
1 parent
17076c1
commit a87238e
Showing
1 changed file
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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. | ||
""" | ||
|
@@ -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() |