Search in sources :

Example 36 with InstalledProduct

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

the class RegisterTests method testRegisterWithAutosubscribe.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-19949", "RHEL7-50999" }, 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 = "subscription-manager-cli: register to a Candlepin server using autosubscribe functionality", groups = { "Tier1Tests", "blockedByBug-602378", "blockedByBug-616137", "blockedByBug-678049", "blockedByBug-737762", "blockedByBug-743082", "blockedByBug-919700" }, enabled = true)
public void testRegisterWithAutosubscribe() throws JSONException, Exception {
    // determine all of the productIds that are provided by available subscriptions
    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);
    Set<String> providedProductIdsFromAvailableUnmappedGuestOnlyPools = new HashSet<String>();
    // but not the unmapped_guest_only pools
    Set<String> providedProductIdsFromAvailableVirtOnlyPools = new HashSet<String>();
    // all the rest of the pools
    Set<String> providedProductIdsFromAvailablePools = new HashSet<String>();
    for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
        JSONObject jsonPool = new JSONObject(CandlepinTasks.getResourceUsingRESTfulAPI(sm_clientUsername, sm_clientPassword, sm_serverUrl, "/pools/" + pool.poolId));
        JSONArray jsonProvidedProducts = jsonPool.getJSONArray("providedProducts");
        for (int k = 0; k < jsonProvidedProducts.length(); k++) {
            JSONObject jsonProvidedProduct = (JSONObject) jsonProvidedProducts.get(k);
            String providedProductName = jsonProvidedProduct.getString("productName");
            String providedProductId = jsonProvidedProduct.getString("productId");
            if (CandlepinTasks.isPoolRestrictedToUnmappedVirtualSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
                providedProductIdsFromAvailableUnmappedGuestOnlyPools.add(providedProductId);
            }
            if (CandlepinTasks.isPoolRestrictedToVirtualSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
                providedProductIdsFromAvailableVirtOnlyPools.add(providedProductId);
            } else {
                providedProductIdsFromAvailablePools.add(providedProductId);
            }
        }
    }
    // assert that all installed products are "Not Subscribed"
    List<InstalledProduct> installedProducts = clienttasks.getCurrentlyInstalledProducts();
    for (InstalledProduct installedProduct : installedProducts) {
        Assert.assertEquals(installedProduct.status, "Not Subscribed", "Installed product status for productId '" + installedProduct.productId + "' prior to registration with autosubscribe.");
    }
    // now register with --autosubscribe
    SSHCommandResult registerResult = clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, true, false, null, null, null, null);
    // 201208091741:18.316 - FINE: ssh root@pogolinux-1.rhts.eng.rdu.redhat.com subscription-manager register --username=stage_test_12 --password=redhat --autosubscribe --force (com.redhat.qe.tools.SSHCommandRunner.run)
    // 201208091741:50.504 - FINE: Stdout:
    // The system with UUID 5e88b5ef-e218-423c-8cf1-380d37476580 has been unregistered
    // The system has been registered with id: edfabea2-0bd4-4584-bb3e-f3bca9a3a442
    // Installed Product Current Status:
    // Product Name:         	Red Hat Enterprise Linux Server
    // Status:               	Subscribed
    // 
    // 201208091741:50.505 - FINE: Stderr:
    // 201208091741:50.505 - FINE: ExitCode: 0
    // IF THE INSTALLED PRODUCT ID IS PROVIDED BY AN AVAILABLE SUBSCRIPTION, THEN IT SHOULD GET AUTOSUBSCRIBED! (since no service preference level has been set)
    // assert the expected installed product status in the feedback from register with --autosubscribe
    List<InstalledProduct> autosubscribedProducts = InstalledProduct.parse(registerResult.getStdout());
    for (InstalledProduct autosubscribedProduct : autosubscribedProducts) {
        InstalledProduct installedProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productName", autosubscribedProduct.productName, installedProducts);
        if (providedProductIdsFromAvailableUnmappedGuestOnlyPools.contains(installedProduct.productId) && !providedProductIdsFromAvailableVirtOnlyPools.contains(installedProduct.productId)) {
            // must be "Subscribed"
            Assert.assertEquals(autosubscribedProduct.status, "Partially Subscribed", "Status for productName '" + autosubscribedProduct.productName + "' in feedback from registration with autosubscribe. (Partial/yellow because this productId was only provided by an available unmapped_guests_only pool.)");
        } else if (providedProductIdsFromAvailableUnmappedGuestOnlyPools.contains(installedProduct.productId) && providedProductIdsFromAvailableVirtOnlyPools.contains(installedProduct.productId)) {
            // could be either "Partially Subscribed" or "Subscribed"
            List<String> eitherPartiallySubscribedOrSubscribed = Arrays.asList("Partially Subscribed", "Subscribed");
            Assert.assertTrue(eitherPartiallySubscribedOrSubscribed.contains(autosubscribedProduct.status), "Status for productName '" + autosubscribedProduct.productName + "' in feedback from registration (actual='" + autosubscribedProduct.status + "') with autosubscribe can be either " + eitherPartiallySubscribedOrSubscribed + ". (Either because this product id was provided by both an available unmapped_guests_only pool as well as other virt_only pools.  Autosubscribe could randomly choose either.)");
        } else if (providedProductIdsFromAvailablePools.contains(installedProduct.productId)) {
            // TEMPORARY WORKAROUND FOR BUG
            if (installedProduct.arch.contains(",")) {
                boolean invokeWorkaroundWhileBugIsOpen = true;
                // Bug 951633 - installed product with comma separated arch attribute fails to go green
                String bugId = "951633";
                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("Skipping assertion for autosubscribed status of Installed Product name='" + installedProduct.productName + "' while Bugzilla '" + bugId + "' is open.");
                    continue;
                }
            }
            // END OF WORKAROUND
            // must be "Subscribed"
            Assert.assertEquals(autosubscribedProduct.status, "Subscribed", "Status for productName '" + autosubscribedProduct.productName + "' in feedback from registration with autosubscribe.");
        } else {
            // must be "Not Subscribed"
            Assert.assertEquals(autosubscribedProduct.status, "Not Subscribed", "Status for productName '" + autosubscribedProduct.productName + "' in feedback from registration with autosubscribe.");
        }
    }
    // assert the expected installed product status in the list --installed after the register with --autosubscribe
    installedProducts = clienttasks.getCurrentlyInstalledProducts();
    for (InstalledProduct installedProduct : installedProducts) {
        if (providedProductIdsFromAvailableUnmappedGuestOnlyPools.contains(installedProduct.productId) && !providedProductIdsFromAvailableVirtOnlyPools.contains(installedProduct.productId)) {
            // must be "Subscribed"
            Assert.assertEquals(installedProduct.status, "Partially Subscribed", "Status for Installed Product name='" + installedProduct.productName + "' id='" + installedProduct.productId + "' in list of installed products after registration with autosubscribe (Partial/yellow because this productId '" + installedProduct.productId + "' was only provided by an available unmapped_guests_only pool.)");
        } else if (providedProductIdsFromAvailableUnmappedGuestOnlyPools.contains(installedProduct.productId) && providedProductIdsFromAvailableVirtOnlyPools.contains(installedProduct.productId)) {
            // could be either "Partially Subscribed" or "Subscribed"
            List<String> eitherPartiallySubscribedOrSubscribed = Arrays.asList("Partially Subscribed", "Subscribed");
            Assert.assertTrue(eitherPartiallySubscribedOrSubscribed.contains(installedProduct.status), "Status for productName '" + installedProduct.productName + "' in feedback from registration (actual='" + installedProduct.status + "') with autosubscribe can be either " + eitherPartiallySubscribedOrSubscribed + ". (Either because this productId '" + installedProduct.productId + "' was provided by both an available unmapped_guests_only pool as well as other virt_only pools.  Autosubscribe could randomly choose either.)");
        } else if (providedProductIdsFromAvailablePools.contains(installedProduct.productId)) {
            // TEMPORARY WORKAROUND FOR BUG
            if (installedProduct.arch.contains(",")) {
                boolean invokeWorkaroundWhileBugIsOpen = true;
                // Bug 951633 - installed product with comma separated arch attribute fails to go green
                String bugId = "951633";
                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("Skipping assertion for autosubscribed status of Installed Product name='" + installedProduct.productName + "' while Bugzilla '" + bugId + "' is open.");
                    continue;
                }
            }
            // END OF WORKAROUND
            // must be "Subscribed"
            Assert.assertEquals(installedProduct.status, "Subscribed", "Status for Installed Product name='" + installedProduct.productName + "' id='" + installedProduct.productId + "' in list of installed products after registration with autosubscribe.");
        } else {
            // must be "Not Subscribed"
            Assert.assertEquals(installedProduct.status, "Not Subscribed", "Status for Installed Product name='" + installedProduct.productName + "' id='" + installedProduct.productId + "' in list of installed products after registration with autosubscribe.");
        }
    }
    Assert.assertEquals(autosubscribedProducts.size(), installedProducts.size(), "The 'Installed Product Current Status' reported during register --autosubscribe should contain the same number of products as reported by list --installed.");
    // assert the feedback from RFE Bug 864195 - New String: Add string to output of 'subscription-manager subscribe --auto' if can't cover all products
    if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.11.1-1")) {
        String autoAttachFeedbackResultMessage = "Unable to find available subscriptions for all your installed products.";
        if (InstalledProduct.findAllInstancesWithMatchingFieldFromList("status", "Subscribed", installedProducts).size() == installedProducts.size()) {
            Assert.assertTrue(!registerResult.getStdout().contains(autoAttachFeedbackResultMessage), "When the registration with autosubscribe succeeds in making all the installed products compliant, then feedback '" + autoAttachFeedbackResultMessage + "' is NOT reported.");
        } else {
            Assert.assertTrue(registerResult.getStdout().trim().endsWith(autoAttachFeedbackResultMessage), "When the registration with autosubscribe fails to make all the installed products compliant, then feedback '" + autoAttachFeedbackResultMessage + "' is the final report.");
        }
    }
}
Also used : JSONArray(org.json.JSONArray) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) JSONObject(org.json.JSONObject) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) InstalledProduct(rhsm.data.InstalledProduct) ArrayList(java.util.ArrayList) List(java.util.List) SubscriptionPool(rhsm.data.SubscriptionPool) HashSet(java.util.HashSet) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 37 with InstalledProduct

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

the class HighAvailabilityTests method testLocalYumInstallAndRemoveDoesNotAlterInstalledProducts.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20073", "RHEL7-55183" }, 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 = "verify that a local yum install will not delete the product database when repolist is empty", groups = { "Tier1Tests", "blockedByBug-806457" }, priority = 16, dependsOnMethods = { "testRegisterToHighAvailabilityAccount" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testLocalYumInstallAndRemoveDoesNotAlterInstalledProducts() throws JSONException {
    List<InstalledProduct> originalInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    String originalProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile).getStdout();
    // assert that there are no active repos
    Assert.assertEquals(clienttasks.getYumRepolist("enabled").size(), 0, "Expected number of enabled yum repositories.");
    // get an rpm to perform a local yum install
    String localRpmFile = String.format("/tmp/%s.rpm", haPackage1);
    RemoteFileTasks.runCommandAndAssert(client, String.format("wget -O %s %s", localRpmFile, haPackage1Fetch), new Integer(0));
    // do a yum local install and assert
    SSHCommandResult yumInstallResult = client.runCommandAndWait(String.format("yum -y --quiet --nogpgcheck localinstall %s", localRpmFile));
    Assert.assertTrue(clienttasks.isPackageInstalled(haPackage1), "Local install of package '" + haPackage1 + "' completed successfully.");
    // verify that installed products remains unchanged
    List<InstalledProduct> currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    Assert.assertTrue(currentlyInstalledProducts.containsAll(originalInstalledProducts) && originalInstalledProducts.containsAll(currentlyInstalledProducts), "The installed products remains unchanged after a yum local install of package '" + haPackage1 + "'.");
    // verify that the current product id database was unchanged
    String currentProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile).getStdout();
    Assert.assertEquals(currentProductIdJSONString, originalProductIdJSONString, "The product id to repos JSON database file remains unchanged after a yum local install of package '" + haPackage1 + "'.");
    // finally remove the locally installed rpm
    clienttasks.yumRemovePackage(haPackage1);
    // verify that installed products remains unchanged
    currentlyInstalledProducts = clienttasks.getCurrentlyInstalledProducts();
    Assert.assertTrue(currentlyInstalledProducts.containsAll(originalInstalledProducts) && originalInstalledProducts.containsAll(currentlyInstalledProducts), "The installed products remains unchanged after a yum removal of locally installed package '" + haPackage1 + "'.");
    // verify that the current product id database was unchanged
    currentProductIdJSONString = client.runCommandAndWait("cat " + clienttasks.productIdJsonFile).getStdout();
    Assert.assertEquals(currentProductIdJSONString, originalProductIdJSONString, "The product id to repos JSON database file remains unchanged after a yum removal of locally installed package '" + haPackage1 + "'.");
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) InstalledProduct(rhsm.data.InstalledProduct) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Example 38 with InstalledProduct

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

the class HighAvailabilityTests method testYumInstallFirstHighAvailabilityPackageAndAssertInstalledProductCerts.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20076", "RHEL7-55186" }, 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 = "yum install a High Availability package ccs and assert installed products", groups = { "Tier1Tests", "blockedByBug-859197", "blockedByBug-958548", "blockedByBug-1004893" }, priority = 40, // dependsOnMethods={"testHighAvailabilityPackagesAreAvailabile"},
dependsOnMethods = { "testSubscribeToHighAvailabilitySKU" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testYumInstallFirstHighAvailabilityPackageAndAssertInstalledProductCerts() {
    clienttasks.yumInstallPackage(haPackage1);
    // get the currently installed products
    List<InstalledProduct> installedProducts = clienttasks.getCurrentlyInstalledProducts();
    // verify High Availability product id is now installed and Subscribed
    InstalledProduct haInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", haProductId, installedProducts);
    Assert.assertNotNull(haInstalledProduct, "The High Availability product id '" + haProductId + "' should be installed after successful install of High Availability package '" + haPackage1 + "'.");
    Assert.assertEquals(haInstalledProduct.status, "Subscribed", "The status of the installed High Availability product cert.");
    // verify RHEL product server id 69 is installed
    InstalledProduct serverInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", serverProductId, installedProducts);
    Assert.assertNotNull(serverInstalledProduct, "The RHEL Server product id '" + serverProductId + "' should still be installed after successful install of High Availability package '" + haPackage1 + "'.");
}
Also used : InstalledProduct(rhsm.data.InstalledProduct) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Example 39 with InstalledProduct

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

the class InstanceBasedTests method testHealingOfInstanceBasedSubscriptions.

/**
 * @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-36688", "RHEL7-51533" }, 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 healing of Instance-Based subscriptions", groups = { "Tier2Tests", "HealingOfInstanceBasedSubscription", "blockedByBug-907638" }, enabled = true)
public void testHealingOfInstanceBasedSubscriptions() throws JSONException, Exception {
    clienttasks.register_(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, false, null, null, (String) null, null, null, null, true, null, null, null, null, null);
    // to avoid unmapped_guests_only pools
    if (Boolean.valueOf(clienttasks.getFactValue("virt.is_guest")))
        clienttasks.mapSystemAsAGuestOfItself();
    clienttasks.subscribe_(true, null, (String) null, null, null, null, null, null, null, null, null, null, null);
    int healFrequency = 2;
    if (clienttasks.getFactValue("virt.is_guest").equalsIgnoreCase("false")) {
        Integer sockets = 4;
        factsMap.put("cpu.cpu_socket(s)", String.valueOf(sockets));
        clienttasks.createFactsFileWithOverridingValues(factsMap);
        clienttasks.facts(null, true, null, null, null, null);
        for (SubscriptionPool availList : clienttasks.getCurrentlyAllAvailableSubscriptionPools()) {
            if (CandlepinTasks.isPoolProductInstanceBased(sm_clientUsername, sm_clientPassword, sm_serverUrl, availList.poolId)) {
                clienttasks.subscribe(null, null, availList.poolId, null, null, "2", null, null, null, null, null, null, null);
            }
        }
        String messageDetails = "Only covers 2 of " + sockets + " sockets.";
        for (InstalledProduct installed : clienttasks.getCurrentlyInstalledProducts()) {
            if (installed.productId.contains("Instance Server")) {
                Assert.assertEquals(installed.status.trim(), "Partially Subscribed");
                Assert.assertEquals(installed.statusDetails, messageDetails);
            }
        }
    }
    /* replacing call to restart_rhsmcertd with a faster call to run_rhsmcertd_worker	
		clienttasks.restart_rhsmcertd(null, healFrequency, true);
		SubscriptionManagerCLITestScript.sleep(healFrequency * 60 * 1000);
*/
    clienttasks.run_rhsmcertd_worker(true);
    for (InstalledProduct installed : clienttasks.getCurrentlyInstalledProducts()) {
        if (installed.productName.contains("Instance Server")) {
            Assert.assertEquals(installed.status.trim(), "Subscribed");
        }
    }
    if (clienttasks.getFactValue("virt.is_guest").equals("True")) {
        Integer sockets = 4;
        factsMap.put("cpu.cpu_socket(s)", String.valueOf(sockets));
        clienttasks.createFactsFileWithOverridingValues(factsMap);
        clienttasks.facts(null, true, null, null, null, null);
        /* replacing call to restart_rhsmcertd with a faster call to run_rhsmcertd_worker	
			clienttasks.restart_rhsmcertd(null, healFrequency, true);
			SubscriptionManagerCLITestScript.sleep(healFrequency * 60 * 1000);
*/
        clienttasks.run_rhsmcertd_worker(true);
        for (InstalledProduct installed : clienttasks.getCurrentlyInstalledProducts()) {
            if (installed.productName.contains("Instance Server")) {
                Assert.assertEquals(installed.status.trim(), "Subscribed");
            }
        }
        for (ProductSubscription consumed : clienttasks.getCurrentlyConsumedProductSubscriptions()) {
            if (consumed.productName.contains("Instance Based")) {
                Integer quantity = 1;
                Assert.assertEquals(consumed.quantityUsed, quantity);
            }
        }
    }
}
Also used : InstalledProduct(rhsm.data.InstalledProduct) ProductSubscription(rhsm.data.ProductSubscription) SubscriptionPool(rhsm.data.SubscriptionPool) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Example 40 with InstalledProduct

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

the class HighAvailabilityTests method testYumInstallSecondHighAvailabilityPackageAndAssertInstalledProductCerts.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20077", "RHEL7-55184" }, 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 = "yum install a second High Availability package cman and assert installed products", groups = { "Tier1Tests", "blockedByBug-859197", "blockedByBug-958548", "blockedByBug-1004893" }, priority = 50, // dependsOnMethods={"testYumInstallFirstHighAvailabilityPackageAndAssertInstalledProductCerts"},
dependsOnMethods = { "testSubscribeToHighAvailabilitySKU" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testYumInstallSecondHighAvailabilityPackageAndAssertInstalledProductCerts() {
    clienttasks.yumInstallPackage(haPackage2);
    // get the currently installed products
    List<InstalledProduct> installedProducts = clienttasks.getCurrentlyInstalledProducts();
    // verify High Availability product id is now installed and Subscribed
    InstalledProduct haInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", haProductId, installedProducts);
    Assert.assertNotNull(haInstalledProduct, "The High Availability product id '" + haProductId + "' should be installed after successful install of High Availability package '" + haPackage2 + "'.");
    Assert.assertEquals(haInstalledProduct.status, "Subscribed", "The status of the installed High Availability product cert.");
    // verify RHEL product server id 69 is installed
    InstalledProduct serverInstalledProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", serverProductId, installedProducts);
    Assert.assertNotNull(serverInstalledProduct, "The RHEL Server product id '" + serverProductId + "' should still be installed after successful install of High Availability package '" + haPackage2 + "'.");
}
Also used : InstalledProduct(rhsm.data.InstalledProduct) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test)

Aggregations

InstalledProduct (rhsm.data.InstalledProduct)77 Test (org.testng.annotations.Test)71 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)66 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)33 SkipException (org.testng.SkipException)27 SubscriptionPool (rhsm.data.SubscriptionPool)25 ArrayList (java.util.ArrayList)22 ProductCert (rhsm.data.ProductCert)21 ProductSubscription (rhsm.data.ProductSubscription)16 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)15 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)14 HashMap (java.util.HashMap)13 BigInteger (java.math.BigInteger)12 JSONObject (org.json.JSONObject)10 File (java.io.File)9 Calendar (java.util.Calendar)7 HashSet (java.util.HashSet)7 EntitlementCert (rhsm.data.EntitlementCert)6 GregorianCalendar (java.util.GregorianCalendar)5 JSONArray (org.json.JSONArray)5