Laszlo Hornyak has uploaded a new change for review. Change subject: engine: fix RunVmCommandTest ......................................................................
engine: fix RunVmCommandTest OsRepository mocking was missing from the test, while the code was built on the assumption that it is created and configured already. This test failed in unlucky (but not impossible) situations when it ran before any other tests that could have initialized the OsRepository. Change-Id: I6c7b8935273b91da8d1c06eb9c9867212ca022c1 Signed-off-by: Laszlo Hornyak <lhorn...@redhat.com> --- M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java 1 file changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/18608/1 diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java index 0c8559e..e8c95f4 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java @@ -24,6 +24,7 @@ import org.junit.runner.RunWith; import org.mockito.Matchers; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; @@ -43,6 +44,8 @@ import org.ovirt.engine.core.common.businessentities.VmPayload; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend; +import org.ovirt.engine.core.common.osinfo.OsRepository; +import org.ovirt.engine.core.common.utils.SimpleDependecyInjector; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSParametersBase; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; @@ -82,6 +85,9 @@ @Mock private IsoDomainListSyncronizer isoDomainListSyncronizer; + @Mock + OsRepository osRepository; + private static final String ACTIVE_ISO_PREFIX = "/rhev/data-center/mnt/some_computer/f6bccab4-e2f5-4e02-bba0-5748a7bc07b6/images/11111111-1111-1111-1111-111111111111"; private static final String INACTIVE_ISO_PREFIX = ""; @@ -296,6 +302,9 @@ @Before public void createCommand() { + when(osRepository.isWindows(Mockito.anyInt())).thenReturn(false); + SimpleDependecyInjector.getInstance().bind(OsRepository.class, osRepository); + RunVmParams param = new RunVmParams(Guid.newGuid()); command = spy(new RunVmCommand<RunVmParams>(param)); mockIsoDomainListSyncronizer(); -- To view, visit http://gerrit.ovirt.org/18608 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6c7b8935273b91da8d1c06eb9c9867212ca022c1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Laszlo Hornyak <lhorn...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches