Nir Soffer has posted comments on this change.

Change subject: v2v: add fake virt-v2v process for testing without virt-v2v
......................................................................


Patch Set 10:

(1 comment)

https://gerrit.ovirt.org/#/c/47738/10/tests/v2vTests.py
File tests/v2vTests.py:

Line 316:         self.assertEquals(network['bridge'], 'VM Network')
Line 317: 
Line 318:     @MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
Line 319:     def testSuccessfulImport(self):
Line 320:         self.ivm._import()
You should run this job using the job interface:

    self.ivm.start()

Then wait until the job is complete and test that it succeeded

This will allow testing the entire class, which is needed for example for 
testing this change: https://gerrit.ovirt.org/45616

The ImportVm class does not make it easy to wait for the thread. To make it 
easier to test, we can keep the thread instance and do:

    self.ivm._thread.join()

Or poll on self.ivm.status until the job is done.

Or, do something like this:

    done = threading.Event()

    def run():
        self.ivm._run()
        done.set()

    self.ivm._run = run
    self.ivm.start()
    done.wait()

It would be nicer if the standard job interface would allow to wait until a job 
finish, even if this is needed only for testing now.
Line 321:         self.assertEqual(self.ivm.status, v2v.STATUS.DONE)
Line 322: 
Line 323:     @MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
Line 324:     def testV2VOutput(self):


-- 
To view, visit https://gerrit.ovirt.org/47738
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If062a1136921af19a2ffcb4d147611bbc9cf5464
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to