Nir Soffer has uploaded a new change for review.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
storageServer: Fix Mismatch initialization
Commit e57e0bdb3e was verified only with the positive flows, since it is hard to simulate connection mismatch. In case of a real mismatch, attmpting to log the mismatches would raise "TypeError: not enough arguments for format string" hiding the real error.
This patch adds some trivial tests and initialize the "args" instance variable.
Change-Id: Ic9593091c2da6c692f7fcbdd176835a1f2438417 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M tests/Makefile.am A tests/storageServerTests.py M vdsm/storage/storageServer.py 3 files changed, 35 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/36604/1
diff --git a/tests/Makefile.am b/tests/Makefile.am index f644799..564223b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -76,6 +76,7 @@ sslhelper.py \ sslTests.py \ storageMailboxTests.py \ + storageServerTests.py \ tcTests.py \ testlibTests.py \ toolTests.py \ diff --git a/tests/storageServerTests.py b/tests/storageServerTests.py new file mode 100644 index 0000000..83099f5 --- /dev/null +++ b/tests/storageServerTests.py @@ -0,0 +1,33 @@ +# +# Copyright 2014 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +from testlib import VdsmTestCase +from storage.storageServer import IscsiConnection + + +class IscsiConnectionMismatchTests(VdsmTestCase): + + def test_no_args(self): + s = str(IscsiConnection.Mismatch("error 1")) + self.assertEqual(s, "error 1") + + def test_format(self): + s = str(IscsiConnection.Mismatch("error %d with %r", 1, "text")) + self.assertEqual(s, "error 1 with 'text'") diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py index 1ca4b8f..eb38fb3 100644 --- a/vdsm/storage/storageServer.py +++ b/vdsm/storage/storageServer.py @@ -349,7 +349,7 @@
def __init__(self, fmt, *args): self.fmt = fmt - self.args + self.args = args
def __str__(self): return self.fmt % self.args
automation@ovirt.org has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
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.5', 'ovirt-3.4', 'ovirt-3.3'])
Nir Soffer has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 1: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14791/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14623/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13835/ : FAILURE
Dan Kenigsberg has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 1: Code-Review+1
(2 comments)
http://gerrit.ovirt.org/#/c/36604/1/tests/storageServerTests.py File tests/storageServerTests.py:
Line 1: # Line 2: # Copyright 2014 Red Hat, Inc. it's a new year! Line 3: # Line 4: # This program is free software; you can redistribute it and/or modify Line 5: # it under the terms of the GNU General Public License as published by Line 6: # the Free Software Foundation; either version 2 of the License, or
http://gerrit.ovirt.org/#/c/36604/1/vdsm/storage/storageServer.py File vdsm/storage/storageServer.py:
Line 348: class Mismatch(Exception): Line 349: Line 350: def __init__(self, fmt, *args): Line 351: self.fmt = fmt Line 352: self.args = args ;-) Line 353: Line 354: def __str__(self): Line 355: return self.fmt % self.args Line 356:
automation@ovirt.org has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
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.5', 'ovirt-3.4', 'ovirt-3.3'])
Nir Soffer has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 2: Verified+1
This change update copyright year
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14805/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14637/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13849/ : FAILURE
Dan Kenigsberg has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 2: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
storageServer: Fix Mismatch initialization
Commit e57e0bdb3e was verified only with the positive flows, since it is hard to simulate connection mismatch. In case of a real mismatch, attmpting to log the mismatches would raise "TypeError: not enough arguments for format string" hiding the real error.
This patch adds some trivial tests and initialize the "args" instance variable.
Change-Id: Ic9593091c2da6c692f7fcbdd176835a1f2438417 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: http://gerrit.ovirt.org/36604 Reviewed-by: Dan Kenigsberg danken@redhat.com --- M tests/Makefile.am A tests/storageServerTests.py M vdsm/storage/storageServer.py 3 files changed, 35 insertions(+), 1 deletion(-)
Approvals: Nir Soffer: Verified Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storageServer: Fix Mismatch initialization ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/6265/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_create-rpms-el7-x86_64_merged/444/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_create-rpms-el6-x86_64_merged/442/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_create-rpms-fc20-x86_64_merged/435/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_create-rpms-fc21-x86_64_merged/419/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master-libgfapi_create-rpms-el7-x86_64_mer... : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master-libgfapi_create-rpms-el6-x86_64_mer... : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master-libgfapi_create-rpms-fc20-x86_64_me... : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master-libgfapi_create-rpms-fc21-x86_64_me... : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/4430/ : FAILURE
vdsm-patches@lists.fedorahosted.org