test_gce.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # -*- coding: utf-8 -*-
  2. """
  3. :codeauthor: Nicole Thomas <nicole@saltstack.com>
  4. :codeauthor: Tomas Sirny <tsirny@gmail.com>
  5. """
  6. # Import Python Libs
  7. from __future__ import absolute_import, print_function, unicode_literals
  8. # Import Salt Testing Libs
  9. from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
  10. class GCETest(CloudTest):
  11. """
  12. Integration tests for the GCE cloud provider in Salt-Cloud
  13. """
  14. PROVIDER = "gce"
  15. REQUIRED_PROVIDER_CONFIG_ITEMS = (
  16. "project",
  17. "service_account_email_address",
  18. "service_account_private_key",
  19. )
  20. def test_instance(self):
  21. """
  22. Tests creating and deleting an instance on GCE
  23. """
  24. # create the instance
  25. ret_str = self.run_cloud(
  26. "-p gce-test {0}".format(self.instance_name), timeout=TIMEOUT
  27. )
  28. # check if instance returned with salt installed
  29. self.assertInstanceExists(ret_str)
  30. self.assertDestroyInstance()
  31. def test_instance_extra(self):
  32. """
  33. Tests creating and deleting an instance on GCE
  34. """
  35. # create the instance
  36. ret_str = self.run_cloud(
  37. "-p gce-test-extra {0}".format(self.instance_name), timeout=TIMEOUT
  38. )
  39. # check if instance returned with salt installed
  40. self.assertInstanceExists(ret_str)
  41. self.assertDestroyInstance()