Adds basic compute burn in tests

* Adds burn in tests for primary server actions

Change-Id: I9e6cbd1fd168d22d91b30024f44c91d616967843
This commit is contained in:
Daryl Walleck
2013-11-10 14:57:52 -06:00
parent 01744b0ed5
commit b711453637
9 changed files with 313 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

View File

@@ -0,0 +1,47 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest2 as unittest
from cloudcafe.compute.common.types import ComputeHypervisors
from cloudcafe.compute.common.types import NovaServerStatusTypes as \
ServerStates
from cloudcafe.compute.config import ComputeConfig
from cloudroast.compute.fixtures import ComputeFixture
compute_config = ComputeConfig()
hypervisor = compute_config.hypervisor.lower()
@unittest.skipIf(
hypervisor in [ComputeHypervisors.KVM, ComputeHypervisors.QEMU],
'Change password not supported in current configuration.')
class ChangePasswordBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(ChangePasswordBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_change_password(self):
new_password = "p@ssw0Rd"
self.servers_client.change_password(self.server.id, new_password)
self.server_behaviors.wait_for_server_status(self.server.id,
ServerStates.ACTIVE)

View File

@@ -0,0 +1,24 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cloudroast.compute.fixtures import ComputeFixture
class CreateServerBurnIn(ComputeFixture):
def test_create_server(self):
server = self.server_behaviors.create_active_server().entity
self.resources.add(server.id, self.servers_client.delete_server)

View File

@@ -0,0 +1,30 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cloudroast.compute.fixtures import ComputeFixture
class DeleteServerBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(DeleteServerBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
def test_delete_server(self):
self.servers_client.delete_server(self.server.id)
self.server_behaviors.wait_for_server_to_be_deleted(self.server.id)

View File

@@ -0,0 +1,32 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cloudroast.compute.fixtures import ComputeFixture
from cloudcafe.compute.common.types import NovaServerRebootTypes
class RebootServerHardBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(RebootServerHardBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_reboot_server_hard(self):
self.server_behaviors.reboot_and_await(
self.server.id, NovaServerRebootTypes.HARD)

View File

@@ -0,0 +1,32 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cloudroast.compute.fixtures import ComputeFixture
from cloudcafe.compute.common.types import NovaServerRebootTypes
class RebootServerSoftBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(RebootServerSoftBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_reboot_server_soft(self):
self.server_behaviors.reboot_and_await(
self.server.id, NovaServerRebootTypes.SOFT)

View File

@@ -0,0 +1,36 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cloudcafe.compute.common.types import NovaServerStatusTypes
from cloudcafe.common.tools.datagen import rand_name
from cloudroast.compute.fixtures import ComputeFixture
class RebuildServerBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(RebuildServerBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.name = rand_name("server")
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_rebuild_server(self):
self.servers_client.rebuild(self.server.id,
self.image_ref_alt, name=self.name)
self.server_behaviors.wait_for_server_status(
self.server.id, NovaServerStatusTypes.ACTIVE)

View File

@@ -0,0 +1,46 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from unittest2.suite import TestSuite
from cloudroast.compute.fixtures import ComputeFixture
def load_tests(loader, standard_tests, pattern):
suite = TestSuite()
suite.addTest(RescueServerBurnIn("test_rescue_server"))
suite.addTest(RescueServerBurnIn("test_unrescue_server"))
return suite
class RescueServerBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(RescueServerBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_rescue_server(self):
self.rescue_client.rescue(self.server.id)
self.server_behaviors.wait_for_server_status(
self.server.id, 'RESCUE')
def test_unrescue_server(self):
self.rescue_client.unrescue(self.server.id)
self.server_behaviors.wait_for_server_status(
self.server.id, 'ACTIVE')

View File

@@ -0,0 +1,51 @@
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest2 as unittest
from unittest2.suite import TestSuite
from cloudcafe.compute.flavors_api.config import FlavorsConfig
from cloudroast.compute.fixtures import ComputeFixture
flavors_config = FlavorsConfig()
resize_enabled = flavors_config.resize_enabled
def load_tests(loader, standard_tests, pattern):
suite = TestSuite()
suite.addTest(ResizeServerBurnIn("test_resize_server"))
suite.addTest(ResizeServerBurnIn("test_resize_server_confirm"))
return suite
@unittest.skipUnless(
resize_enabled, 'Resize not enabled for this flavor class.')
class ResizeServerBurnIn(ComputeFixture):
@classmethod
def setUpClass(cls):
super(ResizeServerBurnIn, cls).setUpClass()
resp = cls.server_behaviors.create_active_server()
cls.server = resp.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server)
def test_resize_server(self):
self.server_behaviors.resize_and_await(
self.server.id, self.flavor_ref_alt)
def test_resize_server_confirm(self):
self.servers_client.confirm_resize(self.server.id)
self.server_behaviors.wait_for_server_status(self.server.id, 'ACTIVE')