Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-06 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-06 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 5:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-06 Thread alitke
Adam Litke has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/56936/2/tests/storage_volume_artifacts_test.py
File tests/storage_volume_artifacts_test.py:

Line 218: with self.fake_env() as env:
Line 219: artifacts = env.sd_manifest.get_volume_artifacts(
Line 220: self.img_id, self.vol_id)
Line 221: with MonkeyPatchScope([
Line 222: [artifacts, '_create_volume_file', failure]
> OK, can you add a comment about this - why we cannot monkeypatch the underl
sure.
Line 223: ]):
Line 224: self.assertRaises(ExpectedFailure, artifacts.create,
Line 225:   *BASE_RAW_PARAMS)
Line 226: self.validate_new_image_path(artifacts,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-05 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/56936/2/tests/storage_volume_artifacts_test.py
File tests/storage_volume_artifacts_test.py:

Line 218: with self.fake_env() as env:
Line 219: artifacts = env.sd_manifest.get_volume_artifacts(
Line 220: self.img_id, self.vol_id)
Line 221: with MonkeyPatchScope([
Line 222: [artifacts, '_create_volume_file', failure]
> The problem is that lease creation also uses truncateFIle and so this test 
OK, can you add a comment about this - why we cannot monkeypatch the underlying 
code?

Also if we don't need to monkey patch in only part of the test, replacing the 
method on a new object is simpler and nicer.
Line 223: ]):
Line 224: self.assertRaises(ExpectedFailure, artifacts.create,
Line 225:   *BASE_RAW_PARAMS)
Line 226: self.validate_new_image_path(artifacts,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-05 Thread alitke
Adam Litke has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/56936/2/tests/storage_volume_artifacts_test.py
File tests/storage_volume_artifacts_test.py:

Line 218: with self.fake_env() as env:
Line 219: artifacts = env.sd_manifest.get_volume_artifacts(
Line 220: self.img_id, self.vol_id)
Line 221: with MonkeyPatchScope([
Line 222: [artifacts, '_create_volume_file', failure]
> We don't need to monkeypatch this object, we are throwing it away on the en
The problem is that lease creation also uses truncateFIle and so this test will 
fail to create the lease since that is done before creating the volume.
Line 223: ]):
Line 224: self.assertRaises(ExpectedFailure, artifacts.create,
Line 225:   *BASE_RAW_PARAMS)
Line 226: self.validate_new_image_path(artifacts,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-05 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 4:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-04 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 3:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-04 Thread nsoffer
Nir Soffer has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2: Code-Review-1

(1 comment)

https://gerrit.ovirt.org/#/c/56936/2/tests/storage_volume_artifacts_test.py
File tests/storage_volume_artifacts_test.py:

Line 218: with self.fake_env() as env:
Line 219: artifacts = env.sd_manifest.get_volume_artifacts(
Line 220: self.img_id, self.vol_id)
Line 221: with MonkeyPatchScope([
Line 222: [artifacts, '_create_volume_file', failure]
We don't need to monkeypatch this object, we are throwing it away on the end of 
the test.

Can we monkey patch the object creating the file - manifest.oop.xxx?
Line 223: ]):
Line 224: self.assertRaises(ExpectedFailure, artifacts.create,
Line 225:   *BASE_RAW_PARAMS)
Line 226: self.validate_new_image_path(artifacts,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: Yes
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-04 Thread alitke
Adam Litke has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-04 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 2:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-02 Thread alitke
Adam Litke has uploaded a new change for review.

Change subject: tests: Use MonkeyPatchScope to inject failures
..

tests: Use MonkeyPatchScope to inject failures

The FileVolumeArtifactsTests checked volume creation failures by
directly replacing VolumeArtifacts methods with a boobytrapped method.
We can make these tests clearer and more resilient by using
MonkeyPatchScope.  They will also look more like the Block tests that
test similar failure scenarios.

Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Signed-off-by: Adam Litke 
---
M tests/storage_volume_artifacts_test.py
1 file changed, 16 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/56936/1

diff --git a/tests/storage_volume_artifacts_test.py 
b/tests/storage_volume_artifacts_test.py
index 2f9e9f6..e8cb229 100644
--- a/tests/storage_volume_artifacts_test.py
+++ b/tests/storage_volume_artifacts_test.py
@@ -30,7 +30,7 @@
 from vdsm.storage import exception as se
 from vdsm.storage.constants import TEMP_VOL_LVTAG
 
-from storage import image, misc, sd, blockVolume, volume
+from storage import image, misc, sd, blockVolume, fileVolume, volume
 from storage.sdm.api import create_volume
 
 
@@ -191,9 +191,11 @@
 with self.fake_env() as env:
 artifacts = env.sd_manifest.get_volume_artifacts(
 self.img_id, self.vol_id)
-artifacts._create_metadata_artifact = failure
-self.assertRaises(ExpectedFailure, artifacts.create,
-  *BASE_RAW_PARAMS)
+with MonkeyPatchScope([
+[volume.VolumeMetadata, '__init__', failure]
+]):
+self.assertRaises(ExpectedFailure, artifacts.create,
+  *BASE_RAW_PARAMS)
 self.validate_new_image_path(artifacts)
 self.validate_domain_has_garbage(env.sd_manifest)
 
@@ -203,9 +205,11 @@
 with self.fake_env() as env:
 artifacts = env.sd_manifest.get_volume_artifacts(
 self.img_id, self.vol_id)
-artifacts._create_lease_file = failure
-self.assertRaises(ExpectedFailure, artifacts.create,
-  *BASE_RAW_PARAMS)
+with MonkeyPatchScope([
+[fileVolume.FileVolumeManifest, 'newVolumeLease', failure]
+]):
+self.assertRaises(ExpectedFailure, artifacts.create,
+  *BASE_RAW_PARAMS)
 self.validate_new_image_path(artifacts, has_md=True)
 self.validate_domain_has_garbage(env.sd_manifest)
 
@@ -215,9 +219,11 @@
 with self.fake_env() as env:
 artifacts = env.sd_manifest.get_volume_artifacts(
 self.img_id, self.vol_id)
-artifacts._create_volume_file = failure
-self.assertRaises(ExpectedFailure, artifacts.create,
-  *BASE_RAW_PARAMS)
+with MonkeyPatchScope([
+[artifacts, '_create_volume_file', failure]
+]):
+self.assertRaises(ExpectedFailure, artifacts.create,
+  *BASE_RAW_PARAMS)
 self.validate_new_image_path(artifacts,
  has_md=True, has_lease=True)
 self.validate_domain_has_garbage(env.sd_manifest)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches


Change in vdsm[master]: tests: Use MonkeyPatchScope to inject failures

2016-05-02 Thread automation
gerrit-hooks has posted comments on this change.

Change subject: tests: Use MonkeyPatchScope to inject failures
..


Patch Set 1:

* Update tracker: IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' 
and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6'])

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iceed070c2da36460f6aa60a72f079d2e185da6a7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke 
Gerrit-Reviewer: gerrit-hooks 
Gerrit-HasComments: No
___
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches