Skip to content

Commit 5577e75

Browse files
committed
test: refactor setupDummyOOBM into parent class to resolve DRY violation
1 parent 5c37fa3 commit 5577e75

3 files changed

Lines changed: 15 additions & 29 deletions

File tree

test/integration/smoke/test_hostha_kvm.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,6 @@ def configureAndEnableHostHa(self):
156156
response = self.apiclient.enableHAForHost(self.getHostHaEnableCmd())
157157
self.assertEqual(response.haenable, True)
158158

159-
def setupDummyOOBM(self):
160-
from apache.cloudstack.api.command.admin.outOfBandManagement import configureOutOfBandManagementForHost, enableOutOfBandManagementForHost
161-
oobm_cmd = configureOutOfBandManagementForHost.configureOutOfBandManagementForHostCmd()
162-
oobm_cmd.hostid = self.host.id
163-
oobm_cmd.address = "10.1.1.1"
164-
oobm_cmd.driver = "ipmitool"
165-
oobm_cmd.username = "admin"
166-
oobm_cmd.password = "password"
167-
self.apiclient.configureOutOfBandManagementForHost(oobm_cmd)
168-
169-
enable_oobm_cmd = enableOutOfBandManagementForHost.enableOutOfBandManagementForHostCmd()
170-
enable_oobm_cmd.hostid = self.host.id
171-
self.apiclient.enableOutOfBandManagementForHost(enable_oobm_cmd)
172-
173159
def configureAndDisableHostHa(self):
174160
self.setupDummyOOBM()
175161
self.apiclient.configureHAForHost(self.getHostHaConfigCmd())

test/integration/smoke/test_hostha_simulator.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,6 @@ def getListHostHAResources(self):
126126
cmd = listHostHAResources.listHostHAResourcesCmd()
127127
cmd.hostid = self.getHost().id
128128
return cmd
129-
130-
def setupDummyOOBM(self):
131-
from apache.cloudstack.api.command.admin.outOfBandManagement import configureOutOfBandManagementForHost, enableOutOfBandManagementForHost
132-
133-
oobm_cmd = configureOutOfBandManagementForHost.configureOutOfBandManagementForHostCmd()
134-
oobm_cmd.hostid = self.host.id
135-
oobm_cmd.address = "10.1.1.1"
136-
oobm_cmd.driver = "ipmitool"
137-
oobm_cmd.username = "admin"
138-
oobm_cmd.password = "password"
139-
self.apiclient.configureOutOfBandManagementForHost(oobm_cmd)
140-
141-
enable_oobm_cmd = enableOutOfBandManagementForHost.enableOutOfBandManagementForHostCmd()
142-
enable_oobm_cmd.hostid = self.host.id
143-
self.apiclient.enableOutOfBandManagementForHost(enable_oobm_cmd)
144129

145130
def configureAndEnableHostHa(self, initialize=True):
146131
self.setupDummyOOBM()

tools/marvin/marvin/cloudstackTestCase.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ def tearDownClass(cls):
7777
except Exception as e:
7878
raise Exception("Warning: Exception during cleanup : %s" % e)
7979

80+
def setupDummyOOBM(self):
81+
from apache.cloudstack.api.command.admin.outOfBandManagement import configureOutOfBandManagementForHost, enableOutOfBandManagementForHost
82+
83+
oobm_cmd = configureOutOfBandManagementForHost.configureOutOfBandManagementForHostCmd()
84+
oobm_cmd.hostid = self.host.id
85+
oobm_cmd.address = "10.1.1.1"
86+
oobm_cmd.driver = "ipmitool"
87+
oobm_cmd.username = "admin"
88+
oobm_cmd.password = "password"
89+
self.apiclient.configureOutOfBandManagementForHost(oobm_cmd)
90+
91+
enable_oobm_cmd = enableOutOfBandManagementForHost.enableOutOfBandManagementForHostCmd()
92+
enable_oobm_cmd.hostid = self.host.id
93+
self.apiclient.enableOutOfBandManagementForHost(enable_oobm_cmd)
94+
8095
def tearDown(self):
8196
self.debug("Cleaning up the resources")
8297
try:

0 commit comments

Comments
 (0)