Skip to content

Commit bda69c5

Browse files
committed
minor check
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 4ba339f commit bda69c5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public class VirtualMachineManagerImplTest {
225225
protected StateMachine2<State, VirtualMachine.Event, VirtualMachine> _stateMachine;
226226

227227
private ConfigDepotImpl configDepotImpl;
228+
private boolean updatedConfigKeyDepot = false;
228229

229230
@Before
230231
public void setup() {
@@ -260,7 +261,9 @@ public void setup() {
260261

261262
@After
262263
public void cleanup() {
263-
ReflectionTestUtils.setField(VirtualMachineManager.VmMetadataManufacturer, "s_depot", configDepotImpl);
264+
if (updatedConfigKeyDepot) {
265+
ReflectionTestUtils.setField(VirtualMachineManager.VmMetadataManufacturer, "s_depot", configDepotImpl);
266+
}
264267
}
265268

266269
@Test
@@ -1260,10 +1263,7 @@ private void overrideVmMetadataConfigValue(final String manufacturer, final Stri
12601263
Mockito.when(configDepot.findScopedConfigStorage(configKey)).thenReturn(storage);
12611264
Mockito.when(configDepot.findScopedConfigStorage(VirtualMachineManager.VmMetadataProductName)).thenReturn(storage);
12621265
ReflectionTestUtils.setField(configKey, "s_depot", configDepot);
1263-
}
1264-
1265-
private void restoreConfigDepot() {
1266-
ReflectionTestUtils.setField(VirtualMachineManager.VmMetadataManufacturer, "s_depot", this.configDepotImpl);
1266+
updatedConfigKeyDepot = true;
12671267
}
12681268

12691269
private Pair<VirtualMachineTO, VMInstanceVO> getDummyVmTOAndVm() {

0 commit comments

Comments
 (0)