Search in sources :

Example 51 with SubscriptionPool

use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.

the class FlexibleBrandingTests method testBrandNameFileCreationWithActivationKeys.

/**
 * @author skallesh
 * @throws Exception
 * @throws JSONException
 */
@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36694", "RHEL7-51540" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier2")
@Test(description = "verify if brandname file is created when registering with an activation key", groups = { "Tier2Tests", "CreationWithTActivationKey" }, enabled = true)
public void testBrandNameFileCreationWithActivationKeys() throws Exception {
    // reset the installed product cert to productCert32060 and reset the brand file
    clienttasks.removeAllCerts(false, false, true);
    RemoteFileTasks.runCommandAndAssert(client, "cp " + productCert32060.file + " " + tmpProductCertDir, Integer.valueOf(0));
    RemoteFileTasks.runCommandAndWait(client, "rm -f " + Brand_Name, TestRecords.action());
    Integer addQuantity = null;
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, false, null, null, null, null);
    if (clienttasks.getFactValue("virt.is_guest").equals("True")) {
        addQuantity = 1;
    } else {
        addQuantity = 2;
    }
    String name = String.format("%s_%s-ActivationKey%s", sm_clientUsername, sm_clientOrg, System.currentTimeMillis());
    Map<String, String> mapActivationKeyRequest = new HashMap<String, String>();
    mapActivationKeyRequest.put("name", name);
    JSONObject jsonActivationKeyRequest = new JSONObject(mapActivationKeyRequest);
    JSONObject jsonActivationKey = new JSONObject(CandlepinTasks.postResourceUsingRESTfulAPI(sm_clientUsername, sm_clientPassword, sm_serverUrl, "/owners/" + sm_clientOrg + "/activation_keys", jsonActivationKeyRequest.toString()));
    String poolId = null;
    for (SubscriptionPool availList : clienttasks.getCurrentlyAllAvailableSubscriptionPools()) {
        if (availList.subscriptionName.contains("Instance")) {
            poolId = availList.poolId;
        }
    }
    new JSONObject(CandlepinTasks.postResourceUsingRESTfulAPI(sm_clientUsername, sm_clientPassword, sm_serverUrl, "/activation_keys/" + jsonActivationKey.getString("id") + "/pools/" + poolId + (addQuantity == null ? "" : "?quantity=" + addQuantity), null));
    clienttasks.register(null, null, sm_clientOrg, null, null, null, null, null, null, null, name, null, null, null, true, null, null, null, null, null);
    List<ProductSubscription> consumed = clienttasks.getCurrentlyConsumedProductSubscriptions();
    String productname = "Branded " + consumed.get(randomGenerator.nextInt(consumed.size())).productName;
    String result = client.runCommandAndWait("cat " + Brand_Name).getStdout();
    Assert.assertEquals(result.trim(), productname.trim());
}
Also used : BigInteger(java.math.BigInteger) JSONObject(org.json.JSONObject) HashMap(java.util.HashMap) ProductSubscription(rhsm.data.ProductSubscription) SubscriptionPool(rhsm.data.SubscriptionPool) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Example 52 with SubscriptionPool

use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.

the class FlexibleBrandingTests method testBrandNameFileShouldNotBeCreatedWithoutProduct.

/**
 * @author skallesh
 * @throws Exception
 * @throws JSONException
 */
@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36699", "RHEL7-51545" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.NEGATIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier2")
@Test(description = "verify if brandname file is created without product cert", groups = { "Tier2Tests", "verifyFile" }, enabled = true)
public void testBrandNameFileShouldNotBeCreatedWithoutProduct() throws Exception {
    // reset the installed product certs and reset the brand file
    clienttasks.removeAllCerts(false, false, true);
    RemoteFileTasks.runCommandAndWait(client, "rm -f " + Brand_Name, TestRecords.action());
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
    clienttasks.unsubscribe(true, (BigInteger) null, null, null, null, null, null);
    for (SubscriptionPool pool : clienttasks.getCurrentlyAllAvailableSubscriptionPools()) {
        if (pool.subscriptionName.contains("Instance")) {
            clienttasks.subscribeToSubscriptionPool(pool, /*sm_serverAdminUsername*/
            sm_clientUsername, /*sm_serverAdminPassword*/
            sm_clientPassword, sm_serverUrl);
        }
    }
    String result = client.runCommandAndWait("cat " + Brand_Name).getStderr();
    String expectedMessage = "cat: /var/lib/rhsm/branded_name: No such file or directory";
    Assert.assertEquals(result.trim(), expectedMessage);
}
Also used : SubscriptionPool(rhsm.data.SubscriptionPool) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Example 53 with SubscriptionPool

use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.

the class GuestLimitingTests method getGuestlimitPool.

protected String getGuestlimitPool(String guestLimit) throws JSONException, Exception {
    String poolId = null;
    providedProductIds.clear();
    for (SubscriptionPool pool : clienttasks.getAvailableSubscriptionsMatchingInstalledProducts()) {
        String GuestLimitAttribute = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId, "guest_limit");
        System.out.println(GuestLimitAttribute + "   " + guestLimit);
        if ((!(GuestLimitAttribute == null)) && (GuestLimitAttribute.equals(guestLimit))) {
            poolId = pool.poolId;
            providedProductIds = (CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId));
            log.info("Found the following subscription pool with guest_limit '" + guestLimit + "' that provides at least one product: " + pool);
            if (!providedProductIds.isEmpty())
                return poolId;
        }
    }
    if (providedProductIds.isEmpty()) {
        poolId = createTestPool(-60 * 24, 60 * 24, guestLimit);
        providedProductIds = (CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, poolId));
    }
    return poolId;
}
Also used : SubscriptionPool(rhsm.data.SubscriptionPool)

Example 54 with SubscriptionPool

use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.

the class CertificateTests method testRctCatCertReportsOrdersWithQuantityUnlimited.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20032", "RHEL7-33086" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier1")
@Test(description = "assert that the rct cat-cert tool reports orders as Unlimited instead of -1", groups = { "Tier1Tests", "blockedByBug-1011961" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testRctCatCertReportsOrdersWithQuantityUnlimited() throws JSONException, Exception {
    int numberOfUnlimitedPools = 0;
    boolean isSystemVirtual = Boolean.valueOf(clienttasks.getFactValue("virt.is_guest"));
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
    clienttasks.autoheal(null, null, true, null, null, null, null);
    for (SubscriptionPool pool : clienttasks.getCurrentlyAllAvailableSubscriptionPools()) {
        if (pool.quantity.equalsIgnoreCase("Unlimited")) {
            // skip physical_only subscriptions when run on a virtual system (not necessary if getCurrentlyAllAvailableSubscriptionPools() was changed to getCurrentlyAvailableSubscriptionPools())
            if (CandlepinTasks.isPoolRestrictedToPhysicalSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId) && isSystemVirtual)
                continue;
            // skip virt_only subscriptions when run on a physical system (not necessary if getCurrentlyAllAvailableSubscriptionPools() was changed to getCurrentlyAvailableSubscriptionPools())
            if (CandlepinTasks.isPoolRestrictedToVirtualSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId) && !isSystemVirtual)
                continue;
            numberOfUnlimitedPools++;
            File entitlementCertFile = clienttasks.subscribeToSubscriptionPool(pool, /*sm_serverAdminUsername*/
            sm_clientUsername, /*sm_serverAdminPassword*/
            sm_clientPassword, sm_serverUrl);
            EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
            Assert.assertEquals(entitlementCert.orderNamespace.quantity, pool.quantity, "The Order:Quantity from the granted entitlement should match the Quantity from the available Subscription Pool: " + pool);
        } else if (pool.quantity.equals("-1")) {
            Assert.fail("Available SubscriptionPools should NOT report a quantity of '" + pool.quantity + "': " + pool);
        }
    }
    if (numberOfUnlimitedPools == 0)
        throw new SkipException("Could not find any available pools with an unlimited quantity for this test.");
}
Also used : EntitlementCert(rhsm.data.EntitlementCert) SkipException(org.testng.SkipException) SubscriptionPool(rhsm.data.SubscriptionPool) File(java.io.File) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 55 with SubscriptionPool

use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.

the class CertificateTests method testYumUpdateWithDisabledRepoWillNotDeleteJBossProductId.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20034", "RHEL7-55176" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier1")
@Test(description = "When updating a RHEL package on a system with JBoss, verify that the JBoss productId is not deleted when calling yum update with --disablerepo=jb-eap-6-for-rhel-6-server-rpms", groups = { "Tier1Tests", "VerifyYumUpdateWithDisabledRepoWillNotDeleteJBossProductId_Test", "blockedByBug-1159163", "blockedByBug-1512948" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testYumUpdateWithDisabledRepoWillNotDeleteJBossProductId() throws JSONException, Exception {
    // fixed in https://bugzilla.redhat.com/show_bug.cgi?id=1159163#c12  subscription-manager commit 68d210bb9145e7ea65aea979fde694436e3e0373 subscription-manager-1.14.6-1
    clienttasks.unregister(null, null, null, null);
    restoreOriginalRhsmProductCertDirAndProductIdJsonFile();
    // hard data for this test...
    String rhelPackage = "zsh";
    // Required Tags: rhel-6-server Arches: x86_64, x86
    String rhelRepo = "rhel-6-server-rpms";
    rhelRepo = String.format("rhel-%s-server-rpms", clienttasks.redhatReleaseX);
    // Red Hat Enterprise Linux Server	// Tags: rhel-6,rhel-6-server Arch: x86_64
    String rhelProductId = "69";
    // rpm -q jline-eap6.noarch --requires  => rpmlib
    String jbossPackage = "jline-eap6";
    // Required Tags: rhel-6-server Arches: x86_64, x86
    String jbossRepo = "jb-eap-6-for-rhel-6-server-rpms";
    jbossRepo = String.format("jb-eap-6-for-rhel-%s-server-rpms", clienttasks.redhatReleaseX);
    // JBoss Enterprise Application Platform
    String jbossProductId = "183";
    if (clienttasks.arch.equals("ppc64")) {
        // Required Tags: rhel-6-ibm-power Arches: ppc64
        rhelRepo = "rhel-6-for-power-rpms";
        rhelRepo = String.format("rhel-%s-for-power-rpms", clienttasks.redhatReleaseX);
        // Red Hat Enterprise Linux for Power, big endian	// Tags: rhel-6,rhel-6-ibm-power Arch: ppc64
        rhelProductId = "74";
        // Required Tags: rhel-6-ibm-power Arches: ppc64
        jbossRepo = "jb-eap-6-for-rhel-6-for-power-rpms";
        jbossRepo = String.format("jb-eap-6-for-rhel-%s-for-power-rpms", clienttasks.redhatReleaseX);
        // JBoss Enterprise Application Platform
        jbossProductId = "183";
    }
    // need to disable the beaker repos (actually all repos that contain a productid in the metadata would be best) to prevent the yum product-id plugin from considering it for an update to the installed RHEL product cert
    if (clienttasks.isPackageInstalled(rhelPackage))
        clienttasks.yumRemovePackage(rhelPackage, "--disablerepo=beaker-*");
    // need to disable the beaker repos (actually all repos that contain a productid in the metadata would be best) to prevent the yum product-id plugin from considering it for an update to the installed RHEL product cert
    if (clienttasks.isPackageInstalled(jbossPackage))
        clienttasks.yumRemovePackage(jbossPackage, "--disablerepo=beaker-*");
    // determine the currently installed product certs
    List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
    ProductCert rhelProductCert = ProductCert.findFirstInstanceWithMatchingFieldFromList("productId", rhelProductId, currentProductCerts);
    if (rhelProductCert == null)
        throw new SkipException("JBoss Enterprise Application Platform is not offered on this variant '" + clienttasks.variant + "' of RHEL.");
    ProductCert jbossProductCert = ProductCert.findFirstInstanceWithMatchingFieldFromList("productId", jbossProductId, currentProductCerts);
    Assert.assertNull(jbossProductCert, "Do not expect the JBoss product to be installed at the beginning of this test.");
    // configure a temporary productCertDir and backup the productid json database file
    log.info("Configuring a temporary product cert directory...");
    // remember the original so it can be restored later
    if (rhsmProductCertDir == null) {
        rhsmProductCertDir = clienttasks.getConfFileParameter(clienttasks.rhsmConfFile, "rhsm", "productCertDir");
        Assert.assertNotNull(rhsmProductCertDir);
    }
    RemoteFileTasks.runCommandAndAssert(client, "mkdir -p " + tmpProductCertDir, Integer.valueOf(0));
    RemoteFileTasks.runCommandAndAssert(client, "rm -f " + tmpProductCertDir + "/*.pem", Integer.valueOf(0));
    // due to /etc/pki/product-default/ certs, this assert will fail when /etc/pki/product/ is empty  RemoteFileTasks.runCommandAndAssert(client,"cp "+rhsmProductCertDir+"/*.pem "+tmpProductCertDir, Integer.valueOf(0));
    RemoteFileTasks.runCommandAndWait(client, "cp " + rhsmProductCertDir + "/*.pem " + tmpProductCertDir, TestRecords.action());
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", tmpProductCertDir);
    // remember the original so it can be restored later
    if (productIdJsonFile == null) {
        productIdJsonFile = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile).getStdout().replaceAll("\\s*\n\\s*", "");
        Assert.assertTrue(productIdJsonFile != null && !productIdJsonFile.isEmpty());
    }
    // register with autosubscribe for rhel content
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, null, null, null, null, null, null);
    List<InstalledProduct> currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    InstalledProduct rhelInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", rhelProductId, currentlyInstalledProducts);
    Assert.assertNotNull(rhelInstalledProduct, "Expecting the installed RHEL Server product '" + rhelProductId + "' to be installed.");
    if (!rhelInstalledProduct.status.equals("Subscribed") && CandlepinType.standalone.equals(sm_serverType))
        throw new SkipException("This test is designed for execution against a non-standalone candlepin server where available RHEL subscriptions are expected.");
    Assert.assertEquals(rhelInstalledProduct.status, "Subscribed", "Expecting the RHEL Server product to have been auto-subscribed during registration.");
    // subscribe to JBoss Enterprise Application Platform - Example SKU MW0167254 Red Hat JBoss Enterprise Application Platform with Management, 16 Core Standard, L3 Support Partner)
    String jbossPoolId = null;
    List<SubscriptionPool> jbossSubscriptionPools = clienttasks.getCurrentlyAvailableSubscriptionPools(jbossProductId, sm_serverUrl);
    if (jbossSubscriptionPools.isEmpty() && !CandlepinType.standalone.equals(sm_serverType))
        Assert.fail("Expected to find an available subscription pool for Red Hat JBoss Enterprise Application Platform.");
    if (jbossSubscriptionPools.isEmpty())
        throw new SkipException("Cannot run this test when there is no available subscription for Red Hat JBoss Enterprise Application Platform.");
    // too many asserts... clienttasks.subscribeToSubscriptionPool(jbossSubscriptionPools.get(0));
    clienttasks.subscribe_(null, null, jbossSubscriptionPools.get(0).poolId, null, null, null, null, null, null, null, null, null, null);
    // enable the jb-eap-6-for-rhel-6-server-rpms repo
    // Note: This is necessary. If only enabled during yum install --enablerepo=jb-eap-6-for-rhel-6-server-rpms then the jboss product id will install, but it will also be deleted during the yum install of a rhel package.
    clienttasks.repos(null, null, null, jbossRepo, null, null, null, null, null);
    // yum install jline-eap6 from repo jb-eap-6-for-rhel-6-server-rpms
    // clienttasks.yumInstallPackageFromRepo(jbossPackage, jbossRepo, null);
    clienttasks.yumInstallPackage(jbossPackage);
    // assert that the jboss product id 183 has been newly installed
    currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    InstalledProduct jbossInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", jbossProductId, currentlyInstalledProducts);
    Assert.assertNotNull(jbossInstalledProduct, "After installing jboss package '" + jbossPackage + "' from enabled jboss repo '" + jbossRepo + "', the jboss product id '" + jbossProductId + "' is installed.");
    // now for the real test...  install a rhel package with yum --disablerepo and then verify that the jboss product cert remains installed...
    // clienttasks.repos(null, null, null, rhelRepo, null, null, null, null); // is already enabled by default
    clienttasks.yumInstallPackage(rhelPackage, "--disablerepo=" + jbossRepo);
    // verify that the jboss product cert remains installed - Bug 1159163 - RHSM product certificate gets deleted by product-id plugin on running 'yum update --disablerepo
    currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    jbossInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", jbossProductId, currentlyInstalledProducts);
    Assert.assertNotNull(jbossInstalledProduct, "After installing rhel package '" + rhelPackage + "' while disabling the jboss repo '" + jbossRepo + "' in-line, the jboss product id '" + jbossProductId + "' remains installed.");
    // remove the only installed jboss package while disabling the rhel repo and verify the jboss product id has been removed, but the rhel product id remains
    // TEMPORARY WORKAROUND
    boolean invokeWorkaroundWhileBugIsOpen = true;
    // Bug 1222627 - deletion of JBOSS product certificate is neglected by product-id plugin on running 'yum remove JBOSS-PKG --disablerepo=RHEL-REPO'
    String bugId = "1222627";
    try {
        if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
            log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ".  (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
            SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
        } else {
            invokeWorkaroundWhileBugIsOpen = false;
        }
    } catch (BugzillaAPIException be) {
    /* ignore exception */
    } catch (RuntimeException re) {
    /* ignore exception */
    }
    if (invokeWorkaroundWhileBugIsOpen) {
        log.warning("While bug '" + bugId + "' is open, we will exclude the --disablerepo=" + rhelRepo + " option from the yum removal of the jboss package.");
        // THIS PASSES THE FOLLOWING Assert.assertNull(jbossInstalledProduct,...
        clienttasks.yumRemovePackage(jbossPackage);
    } else
        // END OF WORKAROUND
        // THIS FAILS THE FOLLOWING Assert.assertNull(jbossInstalledProduct,...  due to Bug 1222627
        clienttasks.yumRemovePackage(jbossPackage, "--disablerepo=" + rhelRepo);
    // verify that the jboss product cert is removed
    currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    jbossInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", jbossProductId, currentlyInstalledProducts);
    Assert.assertNull(jbossInstalledProduct, "After removing jboss package '" + jbossPackage + "' while disabling rhel repo '" + rhelRepo + "', the jboss product id '" + jbossProductId + "' is removed (because it is the final remaining package installed from jboss repo '" + jbossRepo + "').");
    // verify that the rhel product cert remains installed
    rhelInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", rhelProductId, currentlyInstalledProducts);
    Assert.assertNotNull(rhelInstalledProduct, "After removing jboss package '" + jbossPackage + "' while disabling rhel repo '" + rhelRepo + "', the rhel product id '" + rhelProductId + "' remains installed (because there are many other rhel packages from rhel repo '" + rhelRepo + "' still installed).");
    // remove the rhel package
    clienttasks.yumRemovePackage(rhelPackage);
    // verify that the jboss product cert remains uninstalled
    currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    jbossInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", jbossProductId, currentlyInstalledProducts);
    Assert.assertNull(jbossInstalledProduct, "After removing rhel package '" + rhelPackage + "', the jboss product id '" + jbossProductId + "' from enabled repo '" + jbossRepo + "' remains uninstalled.");
    // verify that the rhel product cert remains installed
    rhelInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", rhelProductId, currentlyInstalledProducts);
    Assert.assertNotNull(rhelInstalledProduct, "After removing rhel package '" + rhelPackage + "' the rhel product id '" + rhelProductId + "' remains installed (because there are many other rhel packages from rhel repo '" + rhelRepo + "' still installed).");
}
Also used : InstalledProduct(rhsm.data.InstalledProduct) ProductCert(rhsm.data.ProductCert) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) SubscriptionPool(rhsm.data.SubscriptionPool) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Aggregations

SubscriptionPool (rhsm.data.SubscriptionPool)195 Test (org.testng.annotations.Test)155 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)137 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)112 SkipException (org.testng.SkipException)90 ArrayList (java.util.ArrayList)87 JSONObject (org.json.JSONObject)66 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)53 ProductSubscription (rhsm.data.ProductSubscription)38 BigInteger (java.math.BigInteger)37 File (java.io.File)34 List (java.util.List)33 EntitlementCert (rhsm.data.EntitlementCert)33 HashMap (java.util.HashMap)32 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)28 InstalledProduct (rhsm.data.InstalledProduct)25 ProductCert (rhsm.data.ProductCert)24 JSONArray (org.json.JSONArray)22 Calendar (java.util.Calendar)12 GregorianCalendar (java.util.GregorianCalendar)11