test_linode.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """
  2. :codeauthor: Nicole Thomas <nicole@saltstack.com>
  3. """
  4. # Import Python Libs
  5. # Create the cloud instance name to be used throughout the tests
  6. from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
  7. class LinodeTest(CloudTest):
  8. """
  9. Integration tests for the Linode cloud provider in Salt-Cloud
  10. """
  11. PROVIDER = "linode"
  12. REQUIRED_PROVIDER_CONFIG_ITEMS = ("apikey", "password")
  13. def setUp(self):
  14. """
  15. Sets up the test requirements
  16. """
  17. super().setUp()
  18. # check if the Linode APIv4 cloud provider
  19. if self.profile_str + "-v4:" not in self.providers:
  20. self.skipTest(
  21. "Configuration file for Linode using api_version ``v4`` was not found "
  22. "but is required to run all tests. Check linode.conf files in "
  23. "tests/integration/files/conf/cloud.*.d/ to run these tests."
  24. )
  25. def _test_instance(self, profile):
  26. """
  27. Test creating an instance on Linode for a given profile.
  28. """
  29. # create the instance
  30. args = ["-p", profile, self.instance_name]
  31. ret_str = self.run_cloud(" ".join(args), timeout=TIMEOUT)
  32. self.assertInstanceExists(ret_str)
  33. self.assertDestroyInstance()
  34. return ret_str
  35. def test_instance(self):
  36. return self._test_instance("linode-test")
  37. def test_instance_v4(self):
  38. return self._test_instance("linode-test-v4")