def test_no_package_manager(self):
        self.c.add('which dpkg', returncode=1)
        self.c.add('which yum', returncode=1)
        self.c.add('which up2date', returncode=1)

        compare(check(self.c.config_folder, 'os_packages'),
                'Could not find package manager!')
        compare(listall(self.c.dir), ['os_packages'])
        compare(self.c.dir.read('os_packages'), '')
        compare(self.c.called, ['which dpkg', 'which yum', 'which up2date'])
Beispiel #2
0
 def test_no_package_manager(self):
     self.c.add('which dpkg', returncode=1)
     self.c.add('which yum', returncode=1)
     self.c.add('which up2date', returncode=1)
     
     compare(check(self.c.config_folder, 'os_packages'),
             'Could not find package manager!')
     compare(listall(self.c.dir), ['os_packages'])
     compare(self.c.dir.read('os_packages'), '')
     compare(self.c.called, [
         'which dpkg', 'which yum', 'which up2date'
         ])
Beispiel #3
0
    def test_storage_path_already_exists(self):
        # This is the key element of this test:
        self.c.dir.makedir('init')

        # These rest is just to make sure nothing blows up:
        compare(check(self.c.config_folder, 'mysql'), '')
        compare(listall(self.c.dir), [
                'init',
                'init/mysql',
                ])
        compare(self.c.called, [
                "/usr/sbin/update-rc.d -n -f mysql remove",
                ])
Beispiel #4
0
    def test_selinux_entries(self):
        # selinux in the 2.6 kernel introduces a new column
        # in the permissions block, which we ignore for now
        checker_txt = "path:/some/folder\n"
        
        with CommandContext() as c:
            # pretend we're not on windows
            c.r.replace('subprocess.mswindows',False)
            # pretend the paths exist
            c.existing_paths.add('/some/folder')
            # stub out the cp and ls calls
            c.add("cp -R '/some/folder' '<config>/some'",files=(
                ('some/folder/afile.cfg','content'),
                ('some/folder/bfile.cfg','content'),
                ('some/folder/cfile.cfg','content'),
                ))
            c.add("LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/folder'",
                  output="""/some/folder:
total 36
drwxr-xr-x.  2 root root 4096  .
drwxr-xr-x+ 46 root root 4096  ..
-rw-r--r--.  1 root root 2425  afile.cfg
-rw-r--r--+  1 root root 1421  bfile.cfg
-rw-r--r--   1 root root 1421  cfile.cfg
""")
            # now run the config
            c.run_with_config(checker_txt)
            # check the calls
            compare(c.called,[
                "cp -R '/some/folder' '<config>/some'",
                "LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/folder'",
                'svn up -q <config>',
                'svn status <config>'
                ])
            # check the files are as expected
            compare([
                'checker.txt',
                'some/folder.listing',
                'some/folder/afile.cfg',
                'some/folder/bfile.cfg',
                'some/folder/cfile.cfg',
                ], listall(c.dir,dir=False))
            compare("""/some/folder:
drwxr-xr-x root root .
-rw-r--r-- root root afile.cfg
-rw-r--r-- root root bfile.cfg
-rw-r--r-- root root cfile.cfg
""", c.dir.read(('some', 'folder.listing')))
Beispiel #5
0
    def test_selinux_entries(self):
        # selinux in the 2.6 kernel introduces a new column
        # in the permissions block, which we ignore for now
        checker_txt = "path:/some/folder\n"
        
        with CommandContext() as c:
            # pretend we're not on windows
            c.r.replace('subprocess.mswindows',False)
            # pretend the paths exist
            c.existing_paths.add('/some/folder')
            # stub out the cp and ls calls
            c.add("cp -R '/some/folder' '<config>/some'",files=(
                ('some/folder/afile.cfg','content'),
                ('some/folder/bfile.cfg','content'),
                ('some/folder/cfile.cfg','content'),
                ))
            c.add("LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/folder'",
                  output="""/some/folder:
total 36
drwxr-xr-x.  2 root root 4096  .
drwxr-xr-x+ 46 root root 4096  ..
-rw-r--r--.  1 root root 2425  afile.cfg
-rw-r--r--+  1 root root 1421  bfile.cfg
-rw-r--r--   1 root root 1421  cfile.cfg
""")
            # now run the config
            c.run_with_config(checker_txt)
            # check the calls
            compare(c.called,[
                "cp -R '/some/folder' '<config>/some'",
                "LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/folder'",
                'svn up -q <config>',
                'svn status <config>'
                ])
            # check the files are as expected
            compare([
                'checker.txt',
                'some/folder.listing',
                'some/folder/afile.cfg',
                'some/folder/bfile.cfg',
                'some/folder/cfile.cfg',
                ], listall(c.dir,dir=False))
            compare("""/some/folder:
drwxr-xr-x root root .
-rw-r--r-- root root afile.cfg
-rw-r--r-- root root bfile.cfg
-rw-r--r-- root root cfile.cfg
""", c.dir.read(('some', 'folder.listing')))
Beispiel #6
0
 def test_make_target_dir(self):
     # make us not-windows
     self.c.r.replace('subprocess.mswindows',False)
     # pretend only our path exists
     path = '/some/deep/path'
     self.c.existing_paths.add(path)
     compare(check(self.c.config_folder,path),'')
     compare(listall(self.c.dir),[
             'some',
             'some/deep',
             'some/deep/path.listing',
             ])
     compare(self.c.called,[
             "cp -R '/some/deep/path' '<config>/some/deep'",
             "LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/deep/path'",
             ])
Beispiel #7
0
 def test_make_target_dir(self):
     # make us not-windows
     self.c.r.replace('subprocess.mswindows',False)
     # pretend only our path exists
     path = '/some/deep/path'
     self.c.existing_paths.add(path)
     compare(check(self.c.config_folder,path),'')
     compare(listall(self.c.dir),[
             'some',
             'some/deep',
             'some/deep/path.listing',
             ])
     compare(self.c.called,[
             "cp -R '/some/deep/path' '<config>/some/deep'",
             "LC_COLLATE=\"C\" ls -laR --time-style=+ '/some/deep/path'",
             ])
Beispiel #8
0
    def test_storage_path_already_exists(self):
        # This is the key element of this test:
        self.c.dir.makedir('something')
        
        self.c.r.replace('subprocess.mswindows',False)
        # pretend only our path exists
        path = '/something'
        self.c.existing_paths.add(path)

        compare(check(self.c.config_folder, path), '')
        compare(listall(self.c.dir),[
                'something.listing',
                'something',
                ])
        compare(self.c.called,[
                "cp -R '/something' '<config>'",
                "LC_COLLATE=\"C\" ls -laR --time-style=+ '/something'",
                ])
Beispiel #9
0
    def test_storage_path_already_exists(self):
        # This is the key element of this test:
        self.c.dir.makedir('something')
        
        self.c.r.replace('subprocess.mswindows',False)
        # pretend only our path exists
        path = '/something'
        self.c.existing_paths.add(path)

        compare(check(self.c.config_folder, path), '')
        compare(listall(self.c.dir),[
                'something.listing',
                'something',
                ])
        compare(self.c.called,[
                "cp -R '/something' '<config>'",
                "LC_COLLATE=\"C\" ls -laR --time-style=+ '/something'",
                ])