def test03_query_list(self):
        expected_list_result = self.get_file_list(self.alpha_spec.get_filename())

        results = run_command("gppkg -q --list %s" % self.alpha_spec.get_filename())
        self.check_list_results(results, expected_list_result)

        results = run_command("gppkg --list -q %s" % self.alpha_spec.get_filename())
        self.check_list_results(results, expected_list_result)
    def test02_query_info(self):
        # Normal order of the options
        results = run_command("gppkg -q --info %s" % self.alpha_spec.get_filename())
        self.check_info_results(results, self.alpha_info)

        # Reverse order of the options
        results = run_command("gppkg --info -q %s" % self.alpha_spec.get_filename())
        self.check_info_results(results, self.alpha_info)
    def test04_query_info_expanded(self):
        results = run_command("gppkg --query --info %s" % self.alpha_spec.get_filename())
        self.check_info_results(results, self.alpha_info)

        results = run_command("gppkg --info --query %s" % self.alpha_spec.get_filename())
        self.check_info_results(results, self.alpha_info)

        with self.assertRaises(ExecutionError):
            results = run_command("gppkg --query --info abcde")
    def test01_query_all(self):
        
        results = run_command("gppkg -q --all")
        self.assertTrue(results.split('\n')[self.start_output:self.end_output].sort() == [self.alpha_spec.get_package_name(), self.beta_spec.get_package_name()].sort())

        results = run_command("gppkg --all -q")
        self.assertTrue(results.split('\n')[self.start_output:self.end_output].sort() == [self.alpha_spec.get_package_name(), self.beta_spec.get_package_name()].sort())

        self.assertRaises(ExecutionError, run_command, "gppkg -qall")
    def test05_query_list_expanded(self):
        expected_list_result = self.get_file_list(self.alpha_spec.get_filename())

        results = run_command("gppkg --query --list %s" % self.alpha_spec.get_filename())
        self.check_list_results(results, expected_list_result)

        results = run_command("gppkg --list --query %s" % self.alpha_spec.get_filename())
        self.check_list_results(results, expected_list_result)

        with self.assertRaises(ExecutionError):
            run_command("gppkg --query --list abcde")
    def test02_no_packages_on_cluster(self):
        """
        This test covers the case when we run clean 
        with no packages installed on the cluster
        """
        run_command(self.clean_command) 
        standby, segment_host_list = get_host_list()
        cluster_host_list = [standby] + [host for host in segment_host_list]        

        for host in cluster_host_list:
            if host is not None:
                self.check_remote_rpm_uninstall(self.A_spec.get_package_name(), host)
                self.assertFalse(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())
    def test06_query_package(self):
        results = run_command("gppkg -q %s" % self.alpha_spec.get_filename())
        self.assertTrue("%s is installed" % self.alpha_spec.get_filename().split("-")[0] in results)

        results = run_command("gppkg --query %s" % self.alpha_spec.get_filename())
        self.assertTrue("%s is installed" % self.alpha_spec.get_filename().split("-")[0] in results)

        self.remove(self.alpha_spec.get_filename())
        results = run_command("gppkg --query %s" % self.alpha_spec.get_filename())
        self.assertTrue("%s is not installed" % self.alpha_spec.get_filename().split("-")[0] in results)

        with self.assertRaises(ExecutionError):
            run_command("gppkg --query abcde")
    def test05_no_rpm_on_master(self):
        """
        This test covers the case when the rpm has been 
        uninstalled on the master and the gppkg is in the archive, 
        and the rpms/gppkgs are intstalled on the segments.   
        JIRA - MPP-15968
        """
        self.install(self.alpha_spec.get_filename())
        
        self.uninstall_rpm(self.A_spec.get_filename())
        run_command(self.clean_command)

        self.check_rpm_install(self.A_spec.get_package_name())
        self.assertTrue(os.path.exists(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename())))
    def test08_no_rpm_on_standby(self):
        """
        Covers the case when there is no rpm installed on the standby
        but the gppkg is present in the archive and the package has 
        been installed across other hosts in the cluster.
        JIRA - MPP-15968, MPP-15969
        """ 
        self.install(self.alpha_spec.get_filename())
        
        standby = get_host_list()[0]
    
        self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)
        run_command(self.clean_command)

        self.check_remote_rpm_install(self.A_spec.get_package_name(), standby)
        self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())
    def test07_MPP_15789(self):
        """
        This test covers the case of obsolete dependencies.
        When we update a gppkg and the new gppkg has different
        dependencies from the original gppkg, the dependencies 
        of the original gppkg will get left behind. When we 
        remove the gppkg, only the newer dependencies will be removed
        and the old ones will still remain on the system. 
        """

        update_gppkg_spec = GppkgSpec("alpha", "1.1")
        A_spec = RPMSpec("A", "2", "1", ["B = 1-1"])
        B_spec = self.B_spec
        
        self.build(update_gppkg_spec, A_spec, [B_spec])
        
        self.install(self.alpha_spec.get_filename())
       
        self.update(update_gppkg_spec.get_filename())

        self.remove(update_gppkg_spec.get_filename()) 

        results = run_command("rpm -qa --dbpath %s" % RPM_DATABASE)

        self.assertEqual(results, "")
 def test05_install_rpm_and_uninstall(self):
     """
     Install the main comprising rpm on the master and 
     try to uninstall a gppkg.
     """
     with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:
         tf.extract(self.A_spec.get_filename())
       
     self.install_rpm(self.A_spec.get_filename())
     gppkg_file = self.alpha_spec.get_filename()
   
     try: 
         self.remove(gppkg_file)
     except ExecutionError, e:
         run_command("rpm -e %s --dbpath %s" % (self.A_spec.get_package_name(), RPM_DATABASE))
         os.remove(self.A_spec.get_filename())
         self.fail("ExecutionError %s" % e)
Exemple #12
0
    def test07_no_package_on_standby(self):
        """
        This test covers the case when there is no package
        installed on the standby, but the package is installed
        across the other hosts in the cluster.
        JIRA - MPP-15969
        """ 
        self.install(self.alpha_spec.get_filename())

        standby = get_host_list()[0]
        
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run()
        self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)
        run_command(self.clean_command)
    
        self.check_remote_rpm_install(self.A_spec.get_package_name(), standby)
        self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())
Exemple #13
0
    def test06_no_rpm_on_segment(self):
        """
        This test covers the case when the gppkg has been installed
        on the cluster and the rpm has not been installed properly on
        one of the segments. The gppkg however exists in the archive on
        the segment. 
        """
        self.install(self.alpha_spec.get_filename())
        
        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]

        self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)
        run_command(self.clean_command)

        self.check_remote_rpm_install(self.A_spec.get_package_name(), host)
        self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())
    def test03_simple_uninstall(self):
        gppkg_file = self.alpha_spec.get_filename()

        self.install(gppkg_file)
        self.remove(gppkg_file)

        results = run_command("gppkg -q --all")
        results = results.split('\n')[self.start_output:self.end_output]
        
        self.assertEqual(results, [])
Exemple #15
0
    def test04_no_package_on_segment(self):
        """
        This test covers the case when there is no
        package installed on one of the segment, but
        it is installed on the master and everywhere else 
        """
        self.install(self.alpha_spec.get_filename())
       
        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]       
 
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run()

        self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)

        run_command(self.clean_command)

        self.check_remote_rpm_install(self.A_spec.get_package_name(), host)
        self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())
Exemple #16
0
    def test03_no_package_on_master(self):
        """
        This test covers the case when there is no
        package installed on the master, but some
        package is installed on the rest of the cluster
        """
        self.install(self.alpha_spec.get_filename())
        
        os.remove(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()))
     
        self.uninstall_rpm(self.A_spec.get_filename())

        run_command(self.clean_command) 
        standby, segment_host_list = get_host_list()
        cluster_host_list = [standby] + [host for host in segment_host_list]
       
        for host in cluster_host_list:
            if host is not None:
                self.check_remote_rpm_uninstall(self.A_spec.get_package_name(), host)
                self.assertFalse(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), host).run())
    def test00_MPP_14671(self):
        """
        This test ensures that gppkg does not use the package name
        to discern information about the package. 
        """
        gppkg_file = self.build(self.alpha_spec, self.A_spec)

        dummy_file = "dummy-x.y.z-abcd-efgh.gppkg"
        shutil.copy(gppkg_file, dummy_file)
        self.extra_clean.add(dummy_file)

        self.install(dummy_file)
        self.assertTrue(os.path.exists(os.path.join(GPHOME, 'share', 'packages', 'archive', dummy_file)))

        self.check_rpm_install(self.A_spec.get_package_name())

        self.assertTrue(self.check_install(gppkg_file))

        results = run_command("gppkg -q --all")
        self.assertTrue(''.join(gppkg_file.split('-')[:1]) in results)
 def tearDown(self):
     self.cleanup()
     results = run_command('rpm -qa --dbpath %s' % RPM_DATABASE)
     rpms = results.split()
     for rpm in rpms:
         run_command('rpm -e %s --dbpath %s' % (rpm, RPM_DATABASE))
 def test05_version(self):
     results = run_command("gppkg --version")
     self.assertNotEqual(results, "")
    def test04_help(self):
        help_options = ["--help", "-h", "-?"] 

        for opt in help_options:
            results = run_command("gppkg " + opt)
            self.assertNotEqual(results, "")
    def test04_help(self):
        help_options = ["--help", "-h", "-?"] 

        for opt in help_options:
            results = run_command("gppkg " + opt)
            self.assertNotEqual(results, "")
 def test05_version(self):
     results = run_command("gppkg --version")
     self.assertNotEqual(results, "")
Exemple #23
0
 def tearDown(self):
     self.cleanup()
     results = run_command('rpm -qa --dbpath %s' % RPM_DATABASE)
     rpms = results.split()
     for rpm in rpms:
         run_command('rpm -e %s --dbpath %s' % (rpm, RPM_DATABASE))