"Fossies" - the Fresh Open Source Software Archive

Member "salt-3002.2/tests/integration/ssh/test_deploy.py" (18 Nov 2020, 1739 Bytes) of package /linux/misc/salt-3002.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test_deploy.py": 3002.1_vs_3002.2.

    1 """
    2 salt-ssh testing
    3 """
    4 
    5 import os
    6 import shutil
    7 
    8 from tests.support.case import SSHCase
    9 from tests.support.helpers import slowTest
   10 from tests.support.runtests import RUNTIME_VARS
   11 
   12 
   13 class SSHTest(SSHCase):
   14     """
   15     Test general salt-ssh functionality
   16     """
   17 
   18     def setUp(self):
   19         thin_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
   20         self.addCleanup(shutil.rmtree, thin_dir, ignore_errors=True)
   21 
   22     @slowTest
   23     def test_ping(self):
   24         """
   25         Test a simple ping
   26         """
   27         ret = self.run_function("test.ping")
   28         self.assertTrue(ret, "Ping did not return true")
   29 
   30     @slowTest
   31     def test_thin_dir(self):
   32         """
   33         test to make sure thin_dir is created
   34         and salt-call file is included
   35         """
   36         thin_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
   37         os.path.isdir(thin_dir)
   38         os.path.exists(os.path.join(thin_dir, "salt-call"))
   39         os.path.exists(os.path.join(thin_dir, "running_data"))
   40 
   41     @slowTest
   42     def test_set_path(self):
   43         """
   44         test setting the path env variable
   45         """
   46         path = "/pathdoesnotexist/"
   47         roster = os.path.join(RUNTIME_VARS.TMP, "roster-set-path")
   48         self.custom_roster(
   49             roster, data={"set_path": "$PATH:/usr/local/bin/:{}".format(path)}
   50         )
   51         ret = self.run_function("environ.get", ["PATH"], roster_file=roster)
   52         assert path in ret
   53 
   54     @slowTest
   55     def test_tty(self):
   56         """
   57         test using tty
   58         """
   59         roster = os.path.join(RUNTIME_VARS.TMP, "roster-tty")
   60         self.custom_roster(roster, data={"tty": True})
   61         ret = self.run_function("test.ping", roster_file=roster)
   62         assert ret is True