Search in sources :

Example 36 with BugzillaAPIException

use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.

the class EventTests method testPoolCreated.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21848", "RHEL7-51669" }, 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 = "Tier3")
@Test(description = "subscription-manager: events: Pool Created is sent over an RSS atom feed.", groups = { "Tier3Tests", "PoolCreated_Test" }, dependsOnGroups = { "ProductCreated_Test" }, enabled = true, alwaysRun = true)
public // @ImplementsTCMS(id="")
void testPoolCreated() throws Exception {
    if (server == null)
        throw new SkipException("This test requires an SSH connection to the candlepin server.");
    if (sm_serverAdminUsername.equals("") || sm_serverAdminPassword.equals(""))
        throw new SkipException("This test requires the candlepin server admin username and password credentials.");
    // get the owner and consumer feeds before we test the firing of a new event
    SyndFeed oldFeed = CandlepinTasks.getSyndFeed(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
    /* DELETEME
		if (servertasks.branch.equals("ALPHA") || servertasks.branch.equals("BETA") || servertasks.branch.matches("^candlepin-0\\.[012]\\..*$")) {
			// candlepin branch 0.2-  (createPoolUsingCPC was deprecated in candlepin branch 0.3+)
			testJSONPool = servertasks.createPoolUsingCPC(testJSONProduct.getString("id"), testProductId+" Test Product", testJSONOwner.getString("id"), "99");
		} else {
			// candlepin branch 0.3+
			testJSONPool = servertasks.createSubscriptionUsingCPC(testOwnerKey, testJSONProduct.getString("id"));
			
			if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, "<", "2.0.0")){	// no more refresh pools in candlepin 2.0
				JSONObject jobDetail = servertasks.refreshPoolsUsingCPC(testOwnerKey,true);
				CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername,sm_serverAdminPassword,sm_serverUrl,jobDetail,"FINISHED", 10*1000, 3);
			}
		}
*/
    if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.10")) {
        // candlepin commit 50d3bdcac7c9ad7f94dfd140a6ebfccc2512ee48	 /root/candlepin/server/client/ruby/candlepin_api.rb:926:in `create_subscription': Deprecated API. Please use create_pool or HostedTest resources (RuntimeError)
        // 201602221354:11.019 - FINE: ssh root@jsefler-f22-candlepin.usersys.redhat.com cd /root/candlepin/server/client/ruby; ./cpc create_subscription "newOwner1456166653160" "newProduct1456166653160"
        // 201602221354:11.960 - FINE: Stdout:
        // 201602221354:11.960 - FINE: Stderr:
        // /root/candlepin/server/client/ruby/candlepin_api.rb:926:in `create_subscription': Deprecated API. Please use create_pool or HostedTest resources (RuntimeError)
        // from ./cpc:130:in `<main>'
        // candlepin-2.0.10+  (createSubscriptionUsingCPC deprecation was enforced in candlepin 2.0.10 commit 50d3bdcac7c9ad7f94dfd140a6ebfccc2512ee48 )
        testJSONPool = servertasks.createPoolUsingCPC(testOwnerKey, testJSONProduct.getString("id"));
    } else if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "0.3")) {
        // candlepin branch 0.3+
        testJSONPool = servertasks.createSubscriptionUsingCPC(testOwnerKey, testJSONProduct.getString("id"));
        if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, "<", "2.0.0")) {
            // no need to refresh pools in candlepin 2.0
            JSONObject jobDetail = servertasks.refreshPoolsUsingCPC(testOwnerKey, true);
            CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, jobDetail, "FINISHED", 10 * 1000, 3);
        }
    } else {
        // candlepin branch 0.2-  (createPoolUsingCPC was deprecated in candlepin branch 0.3+)
        testJSONPool = servertasks.createPoolUsingCPC(testJSONProduct.getString("id"), testProductId + " Test Product", testJSONOwner.getString("id"), "99");
    }
    String[] newEventTitles = new String[] { "POOL CREATED" };
    // TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=721136 - jsefler 07/14/2011
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "721136";
    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) {
        newEventTitles = new String[] { "System created a pool for product " + testJSONProduct.getString("name") };
    }
    // END OF WORKAROUND
    // assert the feed...
    assertTheNewFeed(oldFeed, newEventTitles);
// TODO
// <jsefler> dgoodwin: your timing for the event for POOL CREATED is perfect.  I'll automate a test for it now.  It looks like the event is working.
// dgoodwin dgregor_pto dgao
// <dgoodwin> jsefler: cool, three possible cases, creation via candlepin api (post /pools), refresh pools after creating a subscription, and creation of the rh personal "sub pool"
}
Also used : SyndFeed(com.sun.syndication.feed.synd.SyndFeed) JSONObject(org.json.JSONObject) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 37 with BugzillaAPIException

use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.

the class EventTests method testOwnerCreated.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21847", "RHEL7-51668" }, 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 = "Tier3")
@Test(description = "subscription-manager: events: Owner Created is sent over an RSS atom feed.", groups = { "Tier3Tests", "OwnerCreated_Test" }, dependsOnGroups = { "ConsumerDeleted_Test" }, enabled = true, alwaysRun = true)
public // @ImplementsTCMS(id="")
void testOwnerCreated() throws Exception {
    if (server == null)
        throw new SkipException("This test requires an SSH connection to the candlepin server.");
    if (sm_serverAdminUsername.equals("") || sm_serverAdminPassword.equals(""))
        throw new SkipException("This test requires the candlepin server admin username and password credentials.");
    // get the owner and consumer feeds before we test the firing of a new event
    SyndFeed oldFeed = CandlepinTasks.getSyndFeed(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
    // do something that will fire a create owner event
    testJSONOwner = servertasks.createOwnerUsingCPC(testOwnerKey);
    String[] newEventTitles = new String[] { "OWNER CREATED" };
    // TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=721136 - jsefler 07/14/2011
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "721136";
    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) {
        newEventTitles = new String[] { sm_serverAdminUsername + " created new owner " + testOwnerKey };
    }
    // END OF WORKAROUND
    // assert the owner feed...
    assertTheNewOwnerFeed(testJSONOwner.getString("key"), null, newEventTitles);
    // assert the feed...
    assertTheNewFeed(oldFeed, newEventTitles);
}
Also used : SyndFeed(com.sun.syndication.feed.synd.SyndFeed) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 38 with BugzillaAPIException

use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.

the class EventTests method testPoolDeleted.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21849", "RHEL7-51670" }, 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 = "Tier3")
@Test(description = "subscription-manager: events: Pool Deleted is sent over an RSS atom feed.", groups = { "Tier3Tests", "PoolDeleted_Test" }, dependsOnGroups = { "PoolCreated_Test" }, enabled = true, alwaysRun = true)
public // @ImplementsTCMS(id="")
void testPoolDeleted() throws Exception {
    if (server == null)
        throw new SkipException("This test requires an SSH connection to the candlepin server.");
    if (sm_serverAdminUsername.equals("") || sm_serverAdminPassword.equals(""))
        throw new SkipException("This test requires the candlepin server admin username and password credentials.");
    // get the owner and consumer feeds before we test the firing of a new event
    SyndFeed oldFeed = CandlepinTasks.getSyndFeed(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
    /* DELETEME
		if (servertasks.branch.equals("ALPHA") || servertasks.branch.equals("BETA") || servertasks.branch.matches("^candlepin-0\\.[012]\\..*$")) {
			// candlepin branch 0.2-  (deleteSubscriptionUsingCPC was deprecated in candlepin branch 0.3+)
			servertasks.deletePoolUsingCPC(testJSONPool.getString("id"));
		} else {
			// candlepin branch 0.3+
			servertasks.deleteSubscriptionUsingCPC(testJSONPool.getString("id"));
			if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, "<", "2.0.0")){	// no more refresh pools in candlepin 2.0
				JSONObject jobDetail = servertasks.refreshPoolsUsingCPC(testOwnerKey,true);
				CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername,sm_serverAdminPassword,sm_serverUrl,jobDetail,"FINISHED", 10*1000, 3);
			}
		}
*/
    if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.10")) {
        // candlepin commit 50d3bdcac7c9ad7f94dfd140a6ebfccc2512ee48	 /root/candlepin/server/client/ruby/candlepin_api.rb:934:in `delete_subscription': Deprecated API. Please use delete_pool or HostedTest resources (RuntimeError)
        // 201602221609:59.292 - FINE: ssh root@jsefler-f22-candlepin.usersys.redhat.com cd /root/candlepin/server/client/ruby; ./cpc delete_subscription "8a908790530a4f1801530ad04188158b" (com.redhat.qe.tools.SSHCommandRunner.run)
        // 201602221610:00.269 - FINE: Stdout:  (com.redhat.qe.tools.SSHCommandRunner.runCommandAndWait)
        // 201602221610:00.269 - FINE: Stderr:
        // /root/candlepin/server/client/ruby/candlepin_api.rb:934:in `delete_subscription': Deprecated API. Please use delete_pool or HostedTest resources (RuntimeError)
        // from ./cpc:130:in `<main>'
        // candlepin-2.0.10+  (createSubscriptionUsingCPC deprecation was enforced in candlepin 2.0.10 commit 50d3bdcac7c9ad7f94dfd140a6ebfccc2512ee48 )
        servertasks.deletePoolUsingCPC(testJSONPool.getString("id"));
    } else if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "0.3")) {
        // candlepin branch 0.3+
        servertasks.deleteSubscriptionUsingCPC(testJSONPool.getString("id"));
        if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, "<", "2.0.0")) {
            // no more refresh pools in candlepin 2.0
            JSONObject jobDetail = servertasks.refreshPoolsUsingCPC(testOwnerKey, true);
            CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, jobDetail, "FINISHED", 10 * 1000, 3);
        }
    } else {
        // candlepin branch 0.2-  (deleteSubscriptionUsingCPC was deprecated in candlepin branch 0.3+)
        servertasks.deletePoolUsingCPC(testJSONPool.getString("id"));
    }
    String[] newEventTitles = new String[] { "POOL DELETED" };
    // TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=721136 - jsefler 07/14/2011
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "721136";
    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) {
        newEventTitles = new String[] { "System deleted a pool for product " + testJSONProduct.getString("name") };
    }
    // END OF WORKAROUND
    // assert the feed...
    assertTheNewFeed(oldFeed, newEventTitles);
}
Also used : SyndFeed(com.sun.syndication.feed.synd.SyndFeed) JSONObject(org.json.JSONObject) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 39 with BugzillaAPIException

use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.

the class EventTests method testOwnerDeleted.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21852", "RHEL7-51673" }, 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 = "Tier3")
@Test(description = "subscription-manager: events: Owner Deleted is sent over an RSS atom feed.", groups = { "Tier3Tests", "OwnerDeleted_Test" }, dependsOnGroups = { "ImportCreated_Test" }, enabled = true, alwaysRun = true)
public // @ImplementsTCMS(id="")
void testOwnerDeleted() throws IllegalArgumentException, IOException, FeedException, JSONException {
    if (server == null)
        throw new SkipException("This test requires an SSH connection to the candlepin server.");
    if (sm_serverAdminUsername.equals("") || sm_serverAdminPassword.equals(""))
        throw new SkipException("This test requires the candlepin server admin username and password credentials.");
    String ownerKey = sm_clientOrg;
    // get the owner and consumer feeds before we test the firing of a new event
    SyndFeed oldFeed = CandlepinTasks.getSyndFeed(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
    // do something that will fire a delete owner event
    servertasks.deleteOwnerUsingCPC(testOwnerKey);
    String[] newEventTitles = new String[] { "OWNER DELETED" };
    // TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=721136 - jsefler 07/14/2011
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "721136";
    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) {
        newEventTitles = new String[] { ownerKey + " deleted the owner " + testOwnerKey };
    }
    // END OF WORKAROUND
    // assert the feed...
    // assertTheNewFeed(oldFeed, newEventTitles);
    // TODO 10/24/2013 don't yet understand why "POOL DELETED" sometimes occurs on script re-runs
    assertTheNewFeedIgnoringEventTitles(oldFeed, newEventTitles, new HashSet<String>() {

        {
            add("POOL DELETED");
        }
    });
}
Also used : SyndFeed(com.sun.syndication.feed.synd.SyndFeed) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 40 with BugzillaAPIException

use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.

the class FactsTests method testProcCpuInfoCollection.

@// update=true	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-22221", "RHEL7-51427" }, 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 proc_cpuinfo facts are now collected on subscription-manager-1.16.8-2+.  On ppc64 systems, also verify that a virt.uuid is collected on a pSeries platform.", groups = { "Tier1Tests", "blockedByBug-1300805", "blockedByBug-1300816" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testProcCpuInfoCollection() {
    if (clienttasks.isPackageVersion("subscription-manager", "<", "1.16.8-2")) {
        // subscription-manager commit f8416137a3b426aa54608116e005df7273abfada 1300805: Add support for ppc64 virt.uuid
        throw new SkipException("Collection of proc_cpuinfo facts was not available in this version of subscription-manager '" + clienttasks.installedPackageVersionMap.get("subscription-manager") + "'.");
    }
    // log info about virt-what
    client.runCommandAndWait("rpm -q virt-what");
    SSHCommandResult virtWhatResult = client.runCommandAndWait("virt-what");
    // this is the list of base facts in English
    Map<String, String> procCpuInfoFacts = clienttasks.getFacts("proc_cpuinfo.common");
    // assert proc_cpuinfo.common facts are now collected on x86_64/ppc64/ppc64le/aarch64
    ArrayList<String> procCpuInfoArches = new ArrayList<String>(Arrays.asList("x86_64", "ppc64", "ppc64le", "aarch64"));
    if (procCpuInfoArches.contains(clienttasks.arch)) {
        Assert.assertTrue(!procCpuInfoFacts.isEmpty(), "proc_cpuinfo.common facts are now collected on '" + clienttasks.arch + "'.");
    } else {
        Assert.assertTrue(procCpuInfoFacts.isEmpty(), "Not expecting proc_cpuinfo.common facts to be collected on '" + clienttasks.arch + "'.  (Current list of expected arches is " + procCpuInfoArches + ")");
    }
    // assert specific proc_cpuinfo.common facts are now collected on ppc64*
    if (clienttasks.arch.startsWith("ppc64")) {
        for (String fact : new String[] { "proc_cpuinfo.common.machine", "proc_cpuinfo.common.model", "proc_cpuinfo.common.platform" }) {
            Assert.assertNotNull(procCpuInfoFacts.get(fact), "Expected fact '" + fact + "' was collected on '" + clienttasks.arch + "'.");
        }
        // HAVING SECOND THOUGTS ON THE VALIDITY OF THIS ASSERTION BLOCK
        if (false) {
            // assert that virt.uuid is set on a pSeries ppc64 System
            if (procCpuInfoFacts.get("proc_cpuinfo.common.platform").toLowerCase().contains("pSeries".toLowerCase())) {
                String virtUuid = clienttasks.getFactValue("virt.uuid");
                Assert.assertNotNull(virtUuid, "The virt.uuid fact is set on a pSeries '" + clienttasks.arch + "' platform.");
                // assert virt.uuid not Unknown
                // TEMPORARY WORKAROUND FOR BUG
                // Bug 1310846 - The virt.uuid fact value 'Unknown' is not Unknown on a pSeries 'ppc64' platform. expected:<true> but was:<false>
                String bugId = "1310846";
                // Bug 1310846 - The virt.uuid fact value 'Unknown' is not Unknown on a pSeries 'ppc64' platform. expected:<true> but was:<false>
                boolean invokeWorkaroundWhileBugIsOpen = true;
                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 the assertion of fact virt.uuid is not Unknown on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform.");
                } else
                    // END OF WORKAROUND
                    Assert.assertTrue(!virtUuid.toLowerCase().equalsIgnoreCase("Unknown"), "The virt.uuid fact value '" + virtUuid + "' is not Unknown on a pSeries '" + clienttasks.arch + "' platform. ");
                // assert virt.is_guest is True
                // TEMPORARY WORKAROUND FOR BUG
                /*String*/
                // Bug 1072524 - Add support for detecting ppc64 LPAR as virt guests
                bugId = "1072524";
                // Bug 1072524 - Add support for detecting ppc64 LPAR as virt guests
                invokeWorkaroundWhileBugIsOpen = true;
                /*boolean*/
                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 the assertion of fact virt.is_guest:True on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform.");
                } else
                    // END OF WORKAROUND
                    Assert.assertTrue(Boolean.valueOf(clienttasks.getFactValue("virt.is_guest")), "The virt.is_guest fact value is true on a pSeries '" + clienttasks.arch + "' platform. ");
            }
        }
        // I THINK THE FOLLOWING IS BETTER
        // assert that virt.uuid is populated when /proc/device-tree/vm,uuid is known	// Bug 1300805 - ppc64 kvm guests do not collect a virt.uuid fact.
        String procDeviceTreeVmUuidFile = "/proc/device-tree/vm,uuid";
        Boolean virtIsGuest = Boolean.valueOf(clienttasks.getFactValue("virt.is_guest"));
        String virtUuid = clienttasks.getFactValue("virt.uuid");
        if (RemoteFileTasks.testExists(client, procDeviceTreeVmUuidFile)) {
            String expectedVirtUuid = client.runCommandAndWait("cat " + procDeviceTreeVmUuidFile).getStdout().trim();
            if (virtWhatResult.getStdout().isEmpty()) {
                // when virt-what reports nothing, then this system is physical!
                Assert.assertNull(virtUuid, "The virt.uuid fact is NOT set on a '" + clienttasks.arch + "' platform when virt-what reports nothing despite the fact that " + procDeviceTreeVmUuidFile + " is defined.");
            } else {
                Assert.assertNotNull(virtUuid, "The virt.uuid fact is set on a '" + clienttasks.arch + "' platform when " + procDeviceTreeVmUuidFile + " is defined.");
                Assert.assertEquals(virtUuid, expectedVirtUuid, "The virt.uuid fact on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform should match the contents of " + procDeviceTreeVmUuidFile);
            }
            // assert virt.is_guest is True
            // // TEMPORARY WORKAROUND FOR BUG
            // // Bug 1072524 has been VERIFIED
            // String bugId = "1072524"; boolean invokeWorkaroundWhileBugIsOpen = true;	// Bug 1072524 - Add support for detecting ppc64 LPAR as virt guests
            // 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 the assertion for fact virt.is_guest:True on a '"+clienttasks.arch+"' '"+procCpuInfoFacts.get("proc_cpuinfo.common.model")+"' '"+procCpuInfoFacts.get("proc_cpuinfo.common.platform")+"' platform.");
            // } else
            // // END OF WORKAROUND
            // TEMPORARY WORKAROUND FOR BUG
            // Bug 1372108 - facts related to the identification of a virtual/physical system on ppc64/ppc64le are conflicting
            String bugId = "1372108";
            // Bug 1372108 - facts related to the identification of a virtual/physical system on ppc64/ppc64le are conflicting
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 (virtIsGuest == false && invokeWorkaroundWhileBugIsOpen) {
                log.warning("Skipping the assertion for fact virt.is_guest:True on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform.");
            } else
                // END OF WORKAROUND
                Assert.assertTrue(virtIsGuest, "The virt.is_guest fact value is true on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform because file '" + procDeviceTreeVmUuidFile + "' exists.");
        } else {
            // TEMPORARY WORKAROUND FOR BUG
            // Bug 1372108 - facts related to the identification of a virtual/physical system on ppc64/ppc64le are conflicting
            String bugId = "1372108";
            // Bug 1372108 - facts related to the identification of a virtual/physical system on ppc64/ppc64le are conflicting
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 (virtIsGuest == true && invokeWorkaroundWhileBugIsOpen) {
                log.warning("Skipping the assertion for fact virt.is_guest:False on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform.");
            } else
                // END OF WORKAROUND
                // assert virt.is_guest is False
                Assert.assertEquals(virtIsGuest, Boolean.FALSE, "The virt.is_guest fact value is false on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform because file '" + procDeviceTreeVmUuidFile + "' does not exist.");
            // assert virt.uuid is null
            Assert.assertNull(virtUuid, "The virt.uuid fact is null on a '" + clienttasks.arch + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.model") + "' '" + procCpuInfoFacts.get("proc_cpuinfo.common.platform") + "' platform.");
        }
    }
// TODO assert specific proc_cpuinfo.common facts are now collected on x86_64
// TODO assert specific proc_cpuinfo.common facts are now collected on aarch64
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) ArrayList(java.util.ArrayList) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Aggregations

BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)134 Test (org.testng.annotations.Test)91 SkipException (org.testng.SkipException)89 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)88 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)77 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)55 ArrayList (java.util.ArrayList)44 SubscriptionPool (rhsm.data.SubscriptionPool)28 File (java.io.File)23 ProductSubscription (rhsm.data.ProductSubscription)23 ProductCert (rhsm.data.ProductCert)22 JSONObject (org.json.JSONObject)20 EntitlementCert (rhsm.data.EntitlementCert)16 InstalledProduct (rhsm.data.InstalledProduct)14 BigInteger (java.math.BigInteger)13 List (java.util.List)12 ConsumerCert (rhsm.data.ConsumerCert)11 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)10 Calendar (java.util.Calendar)10 HashMap (java.util.HashMap)10