Set iet_conf to nonexistent file in unit test
The Iet test in test_iscsi isn't setup to deal with an actual iet.conf file. The result is that if you happen to be on a system that has an iet.conf file the test will fail when it gets to the os.stat check. This patch just uses a tempdir with a bogus file name that is set as the iet_conf option to make sure the test never runs into a situation where the file is actually there. Change-Id: I5c8653a17250063660ca8aa369c537cc340bc4e9 Closes-Bug: #1400780
This commit is contained in:
committed by
John Griffith
parent
a20330d64f
commit
80bc025da4
@@ -174,7 +174,12 @@ class IetAdmTestCase(test.TestCase, TargetAdminTestCase):
|
||||
def setUp(self):
|
||||
super(IetAdmTestCase, self).setUp()
|
||||
TargetAdminTestCase.setUp(self)
|
||||
|
||||
self.iet_conffile = str(self.persist_tempdir) + '/bogus-file'
|
||||
|
||||
self.flags(iscsi_helper='ietadm')
|
||||
self.flags(iet_conf=self.iet_conffile)
|
||||
|
||||
self.script_template = "\n".join([
|
||||
'ietadm --op new --tid=%(tid)s --params Name=%(target_name)s',
|
||||
'ietadm --op new --tid=%(tid)s --lun=%(lun)s '
|
||||
@@ -191,8 +196,12 @@ class IetAdmBlockIOTestCase(test.TestCase, TargetAdminTestCase):
|
||||
def setUp(self):
|
||||
super(IetAdmBlockIOTestCase, self).setUp()
|
||||
TargetAdminTestCase.setUp(self)
|
||||
|
||||
self.iet_conffile = str(self.persist_tempdir) + '/bogus-file'
|
||||
|
||||
self.flags(iscsi_helper='ietadm')
|
||||
self.flags(iscsi_iotype='blockio')
|
||||
self.flags(iet_conf=self.iet_conffile)
|
||||
self.script_template = "\n".join([
|
||||
'ietadm --op new --tid=%(tid)s --params Name=%(target_name)s',
|
||||
'ietadm --op new --tid=%(tid)s --lun=%(lun)s '
|
||||
@@ -209,6 +218,10 @@ class IetAdmFileIOTestCase(test.TestCase, TargetAdminTestCase):
|
||||
def setUp(self):
|
||||
super(IetAdmFileIOTestCase, self).setUp()
|
||||
TargetAdminTestCase.setUp(self)
|
||||
|
||||
self.iet_conffile = str(self.persist_tempdir) + '/bogus-file'
|
||||
|
||||
self.flags(iet_conf=self.iet_conffile)
|
||||
self.flags(iscsi_helper='ietadm')
|
||||
self.flags(iscsi_iotype='fileio')
|
||||
self.script_template = "\n".join([
|
||||
@@ -227,9 +240,12 @@ class IetAdmAutoIOTestCase(test.TestCase, TargetAdminTestCase):
|
||||
def setUp(self):
|
||||
super(IetAdmAutoIOTestCase, self).setUp()
|
||||
TargetAdminTestCase.setUp(self)
|
||||
self.iet_conffile = 'this-bogus-conf-file-dne'
|
||||
self.stubs.Set(iscsi.IetAdm, '_is_block', lambda a, b: True)
|
||||
|
||||
self.flags(iscsi_helper='ietadm')
|
||||
self.flags(iscsi_iotype='auto')
|
||||
self.flags(iet_conf=self.iet_conffile)
|
||||
self.script_template = "\n".join([
|
||||
'ietadm --op new --tid=%(tid)s --params Name=%(target_name)s',
|
||||
'ietadm --op new --tid=%(tid)s --lun=%(lun)s '
|
||||
|
||||
Reference in New Issue
Block a user