Skip failing execute tests when using /tmp noexec
test_retry_on_failure and test_no_retry_on_success from ExecuteTestCase are failing when running system with /tmp noexec. These tests should be skipped in this case. Related-bug: #1359463 Change-Id: I32fa8f90a6292229bd23eec6d648fab617e59ec3
This commit is contained in:
parent
3dda038707
commit
fa0e710a40
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import errno
|
||||
import os
|
||||
import tempfile
|
||||
import testtools
|
||||
@ -52,11 +53,18 @@ exit 1
|
||||
''')
|
||||
fp.close()
|
||||
os.chmod(tmpfilename, 0o755)
|
||||
self.assertRaises(processutils.ProcessExecutionError,
|
||||
utils.execute,
|
||||
tmpfilename, tmpfilename2, attempts=10,
|
||||
process_input='foo',
|
||||
delay_on_retry=False)
|
||||
try:
|
||||
self.assertRaises(processutils.ProcessExecutionError,
|
||||
utils.execute,
|
||||
tmpfilename, tmpfilename2, attempts=10,
|
||||
process_input='foo',
|
||||
delay_on_retry=False)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
self.skipTest("Permissions error detected. "
|
||||
"Are you running with a noexec /tmp?")
|
||||
else:
|
||||
raise
|
||||
fp = open(tmpfilename2, 'r')
|
||||
runs = fp.read()
|
||||
fp.close()
|
||||
@ -97,10 +105,17 @@ grep foo
|
||||
''')
|
||||
fp.close()
|
||||
os.chmod(tmpfilename, 0o755)
|
||||
utils.execute(tmpfilename,
|
||||
tmpfilename2,
|
||||
process_input='foo',
|
||||
attempts=2)
|
||||
try:
|
||||
utils.execute(tmpfilename,
|
||||
tmpfilename2,
|
||||
process_input='foo',
|
||||
attempts=2)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
self.skipTest("Permissions error detected. "
|
||||
"Are you running with a noexec /tmp?")
|
||||
else:
|
||||
raise
|
||||
finally:
|
||||
os.unlink(tmpfilename)
|
||||
os.unlink(tmpfilename2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user