Skip to content

Commit

Permalink
tests: skip tests that require HOSTNAME != 'localhost' (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiell authored Nov 26, 2022
1 parent e341732 commit aae7bc7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/CLIClushTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,14 @@ def test_009_file_copy_tty(self):
finally:
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_010_diff(self):
"""test clush (diff)"""
self._clush_t(["-w", HOSTNAME, "--diff", "echo", "ok"], None, b"")
self._clush_t(["-w", "%s,localhost" % HOSTNAME, "--diff", "echo",
"ok"], None, b"")

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_011_diff_tty(self):
"""test clush (diff) [tty]"""
setattr(ClusterShell.CLI.Clush, '_f_user_interaction', True)
Expand All @@ -229,6 +231,7 @@ def test_011_diff_tty(self):
finally:
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_012_diff_null(self):
"""test clush (diff w/o output)"""
rxs = r"^--- %s\n\+\+\+ localhost\n@@ -1(,1)? \+[01],0 @@\n-ok\n$" % HOSTNAME
Expand Down Expand Up @@ -268,6 +271,7 @@ def test_016_stderr_tty(self):
finally:
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_017_retcodes(self):
"""test clush (retcodes)"""
s = "clush: %s: exited with exit code 1\n" % HOSTNAME
Expand Down Expand Up @@ -301,6 +305,7 @@ def test_017_retcodes(self):
s.encode())
self._clush_t(["-w", duo, "-S", "-b", "-q", "/bin/false"], None, b"", 1)

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_018_retcodes_tty(self):
"""test clush (retcodes) [tty]"""
setattr(ClusterShell.CLI.Clush, '_f_user_interaction', True)
Expand Down Expand Up @@ -468,6 +473,7 @@ def test_030_config_options(self):
"color=never", "-w", HOSTNAME, "echo", "ok"], None,
self.output_ok)

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_031_progress(self):
"""test clush -P/--progress"""
self._clush_t(["-w", HOSTNAME, "--progress", "echo", "ok"], None,
Expand Down Expand Up @@ -518,6 +524,7 @@ def test_033_worker_pdsh_tty(self):
finally:
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_034_pick(self):
"""test clush --pick"""
rxs = r"^(localhost|%s): foo\n$" % HOSTNAME
Expand Down
2 changes: 2 additions & 0 deletions tests/TaskDistantMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pwd
import shutil
import unittest
import warnings

from TLib import HOSTNAME, make_temp_filename, make_temp_dir
Expand Down Expand Up @@ -722,6 +723,7 @@ def ev_hup(self, worker, node, rc):
def ev_close(self, worker, timedout):
self.close_count += 1

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def testWorkerEventCount(self):
test_eh = self.__class__.TEventHandlerEvCountChecker()
nodes = "localhost,%s" % HOSTNAME
Expand Down
2 changes: 2 additions & 0 deletions tests/TaskDistantPdshMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ClusterShell.Worker.EngineClient import *

import socket
import unittest

# TEventHandlerChecker 'received event' flags
EV_START = 0x01
Expand Down Expand Up @@ -507,6 +508,7 @@ def ev_hup(self, worker, node, rc):
def ev_close(self, worker, timedout):
self.close_count += 1

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def testWorkerEventCount(self):
test_eh = self.__class__.TEventHandlerEvCountChecker()
nodes = "localhost,%s" % HOSTNAME
Expand Down
1 change: 1 addition & 0 deletions tests/TreeWorkerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def ev_close(self, worker, timedout):
self.ev_timedout_cnt += 1


@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
class TreeWorkerTest(unittest.TestCase):
"""
TreeWorkerTest: test TreeWorker
Expand Down
2 changes: 2 additions & 0 deletions tests/WorkerExecTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_one_node_error(self):
self.assertEqual(task_self().max_retcode(), 1)
self.assertEqual(task_self().node_buffer('localhost'), b'')

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_timeout(self):
"""test ExecWorker with a timeout"""
nodes = "localhost,%s" % HOSTNAME
Expand All @@ -67,6 +68,7 @@ def test_bad_placeholder(self):
self.assertRaises(WorkerError, self.execw,
nodes="localhost", handler=None, command="echo %")

@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
def test_rank_placeholder(self):
"""test ExecWorker with several nodes and %n (rank)"""
nodes = "localhost,%s" % HOSTNAME
Expand Down

0 comments on commit aae7bc7

Please # to comment.