Esempio n. 1
0
 def test_three_dirs(self):
     """A directory can have three outcomes."""
     self.assertEqual(
         eap.ProcessEapHomeCat.process(
             ansible_results([
                 # dir1: cat was successful, stdout has 'Red Hat' in it.
                 {
                     'item': 'dir1',
                     'stdout': self.cat_result
                 },
                 # dir2: cat was unsuccessful. Output should be ignored.
                 {
                     'item': 'dir2',
                     'rc': 1,
                     'stdout': self.cat_result
                 },
                 # dir3: cat was successful, output does not have 'Red Hat'.
                 {
                     'item': 'dir3',
                     'stdout': 'foo'
                 }
             ])),
         {
             'dir1': True,
             'dir2': False,
             'dir3': False
         })
Esempio n. 2
0
 def test_success(self):
     """Found eap home layers conf."""
     self.assertEqual(
         eap.ProcessEapHomeLayersConf.process(
             ansible_results([{
                 'item': 'foo',
                 'stdout': 'bin/fuse'
             }])), {'foo': True})
Esempio n. 3
0
 def test_not_found(self):
     """Did not find eap home layers conf."""
     self.assertEqual(
         eap.ProcessEapHomeLayersConf.process(
             ansible_results([{
                 'item': 'foo',
                 'stdout': '',
                 'rc': 1
             }])), {'foo': False})
Esempio n. 4
0
    def test_fuse_not_found(self):
        """Test failure to find a fuse script."""
        found_files = ['foo.sh', 'README']

        processor_input = ansible_results([{
            'item': '/some/dir',
            'stdout': '\n'.join(found_files)
        }])
        expected_result = {'/some/dir': []}
        actual_result = eap.ProcessEapHomeBinForFuse.process(processor_input)
        self.assertEqual(actual_result, expected_result)
Esempio n. 5
0
 def test_with_items_result(self):
     """The result of a with_items task."""
     self.assertTrue(
         process.is_ansible_task_result(
             ansible_results([{
                 'item': 'a',
                 'stdout': 'a'
             }, {
                 'item': 'b',
                 'stdout': 'b'
             }])))
Esempio n. 6
0
 def test_fuse_is_found(self):
     """Test successfully finding a fuse script."""
     found_files = ['foo.sh', 'README'] + \
         eap.ProcessEapHomeBinForFuse.INDICATOR_FILES[:-1]
     processor_input = ansible_results([{
         'item': '/some/dir',
         'stdout': '\n'.join(found_files)
     }])
     expected_result = {
         '/some/dir': eap.ProcessEapHomeBinForFuse.INDICATOR_FILES[:-1]
     }
     actual_result = eap.ProcessEapHomeBinForFuse.process(processor_input)
     self.assertEqual(actual_result, expected_result)
Esempio n. 7
0
class TestProcessJbossBRMSManifestMF(unittest.TestCase):
    """Test ProcessJbossBRMSManifestMF."""

    good_result = {
        'item': '/tmp/good/',
        'stdout': 'This is manifest file output',
        'rc': 0
    }
    manifest_results = ansible_results([good_result])

    def test_success_case(self):
        """Return a dict of directory: manifest pairs."""
        self.assertEqual(
            brms.ProcessJbossBRMSManifestMF.process(self.manifest_results),
            {self.good_result['item']: self.good_result['stdout']})
Esempio n. 8
0
class TestProcessJbossBRMSKieBusinessCentral(unittest.TestCase):
    """Test ProcessJbossBRMSKieBusinessCentral."""

    good_result = {
        'item': '/tmp/good/',
        'stdout': '/tmp/good/file.file',
        'rc': 0
    }
    bad_result = {'item': '/tmp/bad/', 'stdout': '', 'rc': 1}
    ls_results = ansible_results([good_result, bad_result])

    def test_success_case(self):
        """Return stdout_lines in case of success."""
        self.assertEqual(
            brms.ProcessJbossBRMSKieBusinessCentral.process(self.ls_results),
            [self.good_result['stdout']])
Esempio n. 9
0
    def test_three_states(self):
        """A directory can go three ways."""
        extra_files = [
            'docs', 'installation', 'LICENSE.txt', 'welcome-content', 'bin',
            'domain', 'Uninstaller', 'bundles', 'icons', 'SHA256SUM'
        ]

        self.assertEqual(
            eap.ProcessEapHomeLs.process(
                ansible_results([
                    # dir1: ls was successful, directory has JBoss files.
                    {
                        'item':
                        'dir1',
                        'stdout':
                        '\n'.join(extra_files +
                                  eap.ProcessEapHomeLs.INDICATOR_FILES)
                    },
                    # dir2: ls was unsuccessful. Output should be ignored.
                    {
                        'item': 'dir2',
                        'rc': 1,
                        'stdout':
                        '\n'.join(eap.ProcessEapHomeLs.INDICATOR_FILES)
                    },
                    # dir3: ls was successful, directory has no JBoss files.
                    {
                        'item': 'dir3',
                        'stdout': '\n'.join(extra_files)
                    }
                ])),
            {
                'dir1': eap.ProcessEapHomeLs.INDICATOR_FILES,
                'dir2': [],
                'dir3': []
            })