Search in sources :

Example 86 with BugzillaAPIException

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

the class ComplianceTests method configureProductCertDirForAllProductsSubscribableInTheFuture.

@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForAllProductsSubscribableInTheFuture")
public void configureProductCertDirForAllProductsSubscribableInTheFuture() {
    clienttasks.unregister(null, null, null, null);
    // TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "1183175";
    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) {
        throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
    }
    // END OF WORKAROUND
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForAllProductsSubscribableInTheFuture);
    SSHCommandResult r = client.runCommandAndWait("ls -1 " + productCertDirForAllProductsSubscribableInTheFuture + " | wc -l");
    if (Integer.valueOf(r.getStdout().trim()) == 0)
        throw new SkipException("Could not find any installed product certs that are subscribable to future available subscriptions.");
    Assert.assertTrue(Integer.valueOf(r.getStdout().trim()) > 0, "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains all subscribable products based on future available subscriptions.");
    configureProductCertDirForAllProductsSubscribableInTheFutureCompleted = true;
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 87 with BugzillaAPIException

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

the class ComplianceTests method configureProductCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevel.

@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevel")
public void configureProductCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevel() {
    clienttasks.unregister(null, null, null, null);
    // TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "1183175";
    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) {
        throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
    }
    // END OF WORKAROUND
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevel);
    SSHCommandResult r = client.runCommandAndWait("ls -1 " + productCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevel + " | wc -l");
    if (Integer.valueOf(r.getStdout().trim()) == 0)
        throw new SkipException("Could not find any installed product certs that are autosubscribable via more than one common service level.");
    Assert.assertTrue(Integer.valueOf(r.getStdout().trim()) > 0, "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains all autosubscribable products via more than one common service level.");
    configureProductCertDirForAllProductsSubscribableByMoreThanOneCommonServiceLevelCompleted = true;
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 88 with BugzillaAPIException

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

the class ComplianceTests method configureProductCertDirForSomeProductsSubscribable.

@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForSomeProductsSubscribable")
public void configureProductCertDirForSomeProductsSubscribable() {
    clienttasks.unregister(null, null, null, null);
    // TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "1183175";
    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) {
        throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
    }
    // END OF WORKAROUND
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForSomeProductsSubscribable);
    SSHCommandResult r0 = client.runCommandAndWait("ls -1 " + productCertDirForSomeProductsSubscribable + " | wc -l");
    SSHCommandResult r1 = client.runCommandAndWait("ls -1 " + productCertDirForAllProductsSubscribable + " | wc -l");
    SSHCommandResult r2 = client.runCommandAndWait("ls -1 " + productCertDirForNoProductsSubscribable + " | wc -l");
    if (Integer.valueOf(r1.getStdout().trim()) == 0)
        throw new SkipException("Could not find any installed product certs that are subscribable based on the currently available subscriptions.");
    if (Integer.valueOf(r2.getStdout().trim()) == 0)
        throw new SkipException("Could not find any installed product certs that are non-subscribable based on the currently available subscriptions.");
    Assert.assertTrue(Integer.valueOf(r0.getStdout().trim()) > 0 && Integer.valueOf(r1.getStdout().trim()) > 0 && Integer.valueOf(r2.getStdout().trim()) > 0, "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains some subscribable products based on the currently available subscriptions.");
    configureProductCertDirForSomeProductsSubscribableCompleted = true;
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 89 with BugzillaAPIException

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

the class ComplianceTests method configureProductCertDirForNoProductsInstalled.

@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForNoProductsInstalled")
public void configureProductCertDirForNoProductsInstalled() {
    clienttasks.unregister(null, null, null, null);
    // TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "1183175";
    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) {
        throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
    }
    // END OF WORKAROUND
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForNoProductsinstalled);
    SSHCommandResult r = client.runCommandAndWait("ls -1 " + productCertDirForNoProductsinstalled + " | wc -l");
    Assert.assertEquals(Integer.valueOf(r.getStdout().trim()), Integer.valueOf(0), "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains no products.");
    configureProductCertDirForNoProductsInstalledCompleted = true;
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) BeforeGroups(org.testng.annotations.BeforeGroups)

Example 90 with BugzillaAPIException

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

the class ComplianceTests method configureProductCertDirForAllProductsSubscribable.

@BeforeGroups(groups = { "setup" }, value = "configureProductCertDirForAllProductsSubscribable")
public void configureProductCertDirForAllProductsSubscribable() {
    clienttasks.unregister(null, null, null, null);
    // TEMPORARY WORKAROUND FOR BUG: Bug 1183175 - changing to a different rhsm.productcertdir configuration throws OSError: [Errno 17] File exists
    boolean invokeWorkaroundWhileBugIsOpen = true;
    String bugId = "1183175";
    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) {
        throw new SkipException("Cannot configure a different productCertDir while bug '" + bugId + "' is open.");
    }
    // END OF WORKAROUND
    clienttasks.updateConfFileParameter(clienttasks.rhsmConfFile, "productCertDir", productCertDirForAllProductsSubscribable);
    SSHCommandResult r = client.runCommandAndWait("ls -1 " + productCertDirForAllProductsSubscribable + " | wc -l");
    if (Integer.valueOf(r.getStdout().trim()) == 0)
        throw new SkipException("Could not find any installed product certs that are subscribable based on the currently available subscriptions.");
    Assert.assertTrue(Integer.valueOf(r.getStdout().trim()) > 0, "The " + clienttasks.rhsmConfFile + " file is currently configured with a productCertDir that contains all subscribable products based on the currently available subscriptions.");
    configureProductCertDirForAllProductsSubscribableCompleted = true;
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) BeforeGroups(org.testng.annotations.BeforeGroups)

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