Closed Bug 1003405 Opened 6 years ago Closed 6 years ago

Mozbase unit test moznetwork/tests/test.py failures on linux slaves when run from test package.

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla32

People

(Reporter: dminor, Assigned: parkouss)

References

Details

(Whiteboard: [good first bug][mentor=dminor][lang=python])

Attachments

(1 file, 1 obsolete file)

Relevant portion of log:
13:46:58     INFO -  ======================================================================
13:46:58     INFO -  ERROR: test_get_ip (test.TestGetIP)
13:46:58     INFO -  Attempt to test the IP address returned by
13:46:58     INFO -  ----------------------------------------------------------------------
13:46:58     INFO -  Traceback (most recent call last):
13:46:58     INFO -    File "/builds/slave/test/build/tests/mozbase/moznetwork/tests/test.py", line 59, in test_get_ip
13:46:58     INFO -      self.assertTrue(verify_ip_in_list(ip))
13:46:58     INFO -    File "/builds/slave/test/build/tests/mozbase/moznetwork/tests/test.py", line 37, in verify_ip_in_list
13:46:58     INFO -      ps = subprocess.Popen(args, stdout=subprocess.PIPE)
13:46:58     INFO -    File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
13:46:58     INFO -      errread, errwrite)
13:46:58     INFO -    File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
13:46:58     INFO -      raise child_exception
13:46:58     INFO -  OSError: [Errno 2] No such file or directory

Looking at the code, it appears the test tries to call 'ifconfig' which isn't in the path on the test slaves. It appears '/sbin/ifconfig' will work.
Comment on attachment 8423834 [details] [diff] [review]
Bug 1003405 - Mozbase unit test moznetwork/tests/test.py failures on linux slaves when run from test package

Review of attachment 8423834 [details] [diff] [review]:
-----------------------------------------------------------------

A small fix and this should be good to go. Thank you!

::: testing/mozbase/moznetwork/tests/test.py
@@ +28,5 @@
>      regexip = re.compile("((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}"
>                                "(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)")
>  
> +    if mozinfo.isLinux:
> +        args = ["/sbin/ifconfig"]

Just to be safe, I think we would be better of doing something like:
if os.path.exists("/sbin/ifconfig"):
    args = ["/sbin/ifconfig"]
else:
    args = ["ifconfig"]
Just in case some linux machines have ifconfig elsewhere. Also, please add a comment mentioning this bug so people know why we have a special case here.
Attachment #8423834 - Flags: review?(dminor) → review-
Assignee: nobody → j.parkouss
Status: NEW → ASSIGNED
I corrected the patch, and just added a test for /sbin/ifconfig to be executable in order to use it.
Attachment #8423834 - Attachment is obsolete: true
Attachment #8423856 - Flags: review?(dminor)
Looks good to me, I have a try run here to catch anything unexpected: https://tbpl.mozilla.org/?tree=Try&rev=c26968ece18b
Comment on attachment 8423856 [details] [diff] [review]
Mozbase unit test moznetwork/tests/test.py failures on linux slaves when run from test package

Review of attachment 8423856 [details] [diff] [review]:
-----------------------------------------------------------------

Great, thanks!
Attachment #8423856 - Flags: review?(dminor) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/93c5eb0142de
Keywords: checkin-needed
Whiteboard: [good first bug][mentor=dminor][lang=python] → [good first bug][mentor=dminor][lang=python][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/93c5eb0142de
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=dminor][lang=python][fixed-in-fx-team] → [good first bug][mentor=dminor][lang=python]
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.