Skip to content

Commit

Permalink
fix ping test
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfleischer committed Nov 26, 2023
1 parent 20199fc commit f149d25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cloudmesh/common/Host.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,15 @@ def _ping(args):
count = str(args['count'])

count_flag = '-n' if os_is_windows() else '-c'
# if os_is_windows():
if os_is_windows():
# adding ipv4 enforce for windows
# for some reason -4 is required or hosts
# fail. we need ipv4
# command = ['ping', '-4', ip, count_flag, count]
# else:
# command = ['ping', count_flag, count, ip]
command = ['ping', '-4', ip, count_flag, count]
command = ['ping', '-4', ip, count_flag, count]
else:
command = ['ping', count_flag, count, ip]
# command = ['ping', '-4', ip, count_flag, count]
result = subprocess.run(command, capture_output=True)
print(result)
print('THAT WAS RESULT!!!')
try:
timers = result.stdout \
.decode("utf-8", "ignore") \
Expand Down
5 changes: 5 additions & 0 deletions tests/test_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

cloud = "local"

# https://github.com/actions/runner-images/issues/1519 ping does not work in github runner so we skip it.
import os
github_action = os.getenv('GITHUB_ACTIONS')

# multiping only works if you have root, so we can not use it
# from multiping import MultiPing

Expand All @@ -33,6 +37,7 @@


@pytest.mark.incremental
@pytest.mark.skipif(github_action, reason='GitHub Runner uses Azure and Azure disables ping. :( Too bad!')
class Test_ping:

def ping(self, processors=1):
Expand Down

0 comments on commit f149d25

Please sign in to comment.