Change in vdsm[master]: migration: Add DynamicThrottling semaphores

fromani at redhat.com fromani at redhat.com
Wed Feb 17 14:00:12 UTC 2016


Francesco Romani has posted comments on this change.

Change subject: migration: Add DynamicThrottling semaphores
......................................................................


Patch Set 3:

(1 comment)

https://gerrit.ovirt.org/#/c/53304/3/tests/vmUtilsTests.py
File tests/vmUtilsTests.py:

Line 209: self.sem._value
> I agree that this should not be exposed at all, but then I think for *test*
It could be appropriate, sure. We are not talking about mistakes, but rather about improvements.

So, here it is the improvement idea:
what we need to check here is if the semaphore is free (actually, if it is *completely free* aka back to pristine state, but one step at time).

But we can check if this is true using the very API:

  is_free = self.sem.acquire(blocking=False)

So we don't need to access internal details, we use only the API in the test code, and the test is less fragile.

I fully concur that sometimes out of convenience we test internal details. I do this myself!
But most often than not, this is actually a code smell that tells us that the API is not good enough.

This may be indeed not sufficient for this case, but I think is quite fitting for the test below (line 215).


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I67376d0bd990f89e0a013887cef1a0cb05fb855d
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list