1
0

test_gce.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 = ('project', 'service_account_email_address', 'service_account_private_key')
  16. def test_instance(self):
  17. '''
  18. Tests creating and deleting an instance on GCE
  19. '''
  20. # create the instance
  21. ret_str = self.run_cloud('-p gce-test {0}'.format(self.instance_name), timeout=TIMEOUT)
  22. # check if instance returned with salt installed
  23. self.assertInstanceExists(ret_str)
  24. self.assertDestroyInstance()
  25. def test_instance_extra(self):
  26. '''
  27. Tests creating and deleting an instance on GCE
  28. '''
  29. # create the instance
  30. ret_str = self.run_cloud('-p gce-test-extra {0}'.format(self.instance_name), timeout=TIMEOUT)
  31. # check if instance returned with salt installed
  32. self.assertInstanceExists(ret_str)
  33. self.assertDestroyInstance()