use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.
the class ServiceLevelTests method testServiceLevelSetWhenNotRegistered.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21872", "RHEL7-51726" }, 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 = "Tier3")
@Test(description = "subscription-manager: service-level --set (when not registered)", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testServiceLevelSetWhenNotRegistered() {
// make sure we are not registered
clienttasks.unregister(null, null, null, null);
SSHCommandResult result;
// with credentials
result = clienttasks.service_level_(null, null, "FOO", null, sm_clientUsername, sm_clientPassword, /*sm_clientOrg*/
null, null, null, null, null, null, null);
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1")) {
// post commit df95529a5edd0be456b3528b74344be283c4d258 bug 1119688
Assert.assertEquals(result.getExitCode(), new Integer(1), "ExitCode from service-level --set without being registered");
Assert.assertEquals(result.getStderr().trim(), "This system is not yet registered. Try 'subscription-manager register --help' for more information.", "Stderr from service-level --set without being registered");
} else {
Assert.assertEquals(result.getExitCode(), new Integer(255), "ExitCode from service-level --set without being registered");
// Assert.assertEquals(result.getStdout().trim(),"Error: This system is currently not registered.", "Stdout from service-level --set without being registered");
Assert.assertEquals(result.getStdout().trim(), "This system is not yet registered. Try 'subscription-manager register --help' for more information.", "Stdout from service-level --set without being registered");
}
if (sm_clientOrg != null) {
result = clienttasks.service_level_(null, null, "FOO", null, sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null);
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1")) {
// post commit df95529a5edd0be456b3528b74344be283c4d258 bug 1119688
Assert.assertEquals(result.getExitCode(), Integer.valueOf(64), /*EX_USAGE*/
"ExitCode from service-level --set without being registered");
Assert.assertEquals(result.getStderr().trim(), "Error: --org is only supported with the --list option", "Stderr from service-level --set without being registered");
} else {
Assert.assertEquals(result.getExitCode(), Integer.valueOf(255), "ExitCode from service-level --set without being registered");
Assert.assertEquals(result.getStdout().trim(), "Error: --org is only supported with the --list option", "Stdout from service-level --set without being registered");
}
}
// without credentials
result = clienttasks.service_level_(null, null, "FOO", null, null, null, null, null, null, null, null, null, null);
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1")) {
// post commit df95529a5edd0be456b3528b74344be283c4d258 bug 1119688
Assert.assertEquals(result.getExitCode(), new Integer(1), "ExitCode from service-level --set without being registered");
Assert.assertEquals(result.getStderr().trim(), "This system is not yet registered. Try 'subscription-manager register --help' for more information.", "Stderr from service-level --set without being registered");
} else {
Assert.assertEquals(result.getExitCode(), new Integer(255), "ExitCode from service-level --set without being registered");
// Assert.assertEquals(result.getStdout().trim(),"Error: This system is currently not registered.", "Stdout from service-level --set without being registered");
Assert.assertEquals(result.getStdout().trim(), "This system is not yet registered. Try 'subscription-manager register --help' for more information.", "Stdout from service-level --set without being registered");
}
}
use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForSubscriptionManagerGui.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21784", "RHEL7-51601" }, 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 = "check the subscription-manager-gui man page for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForSubscriptionManagerGui() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "subscription-manager-gui";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
// unhyphenate all words at the ends of a line
modifiedManPage = modifiedManPage.replaceAll("(\\w+)(?:‐|-)\\n\\s+(\\w+)", "$1$2");
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manual", " bugzilla1192574comment2isNotFixed ");
modifiedManPage = modifiedManPage.replaceAll("https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Subscription_Management/1.0/html/Subscription_Management_Guide/index.html", " bugzilla1192574comment3isNotFixed ");
modifiedManPage = modifyMisspellingsInManPage(modifiedManPage);
// TEMPORARY WORKAROUND FOR BUG
for (String word : Arrays.asList(new String[] { "bugzilla1192574comment2isNotFixed", "bugzilla1192574comment3isNotFixed" })) {
if (modifiedManPage.contains(word)) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1192574 - typos and poor grammar in subscription-manager-gui man page
String bugId = "1192574";
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("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("bugzilla1192574comment3isNotFixed") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 589bf7debe8702d147f3a69f61f34c44ab47ef63
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForRct.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21778", "RHEL7-51595" }, 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 = "check the rct man page for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForRct() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "rct";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(manPageResult.getStdout());
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manual", " bugzilla1193991comment3isNotFixed ");
// TEMPORARY WORKAROUND FOR BUG
for (String word : Arrays.asList(new String[] { "certficate", "filesystem", "bugzilla1193991comment3isNotFixed" })) {
if (modifiedManPage.contains(word)) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1193991 - typos and poor grammar in rct man page
String bugId = "1193991";
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("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("certficate") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit a7a358714b66faf1ba2031f2e9918e1078756efa
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForRhnMigrateClassicToRhsm.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21779", "RHEL7-51596" }, 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 = "check the rhn-migrate-classic-to-rhsm man page for misspelled words and typos", groups = { "Tier3Tests", "blockedByBug-1390712" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForRhnMigrateClassicToRhsm() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "rhn-migrate-classic-to-rhsm";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(manPageResult.getStdout());
// rhn-migrate-classic-to-rhsm(System Manager's Manrhn-migrate-classic-to-rhsm(8)
if (modifiedManPage.contains("System Manager's Manr")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1192574 - typos and poor grammar in subscription-manager-gui man page
String bugId = "1192574";
// TODO Wrong bug 1192574
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("Ignoring poor man page title while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manr", "System Manager's Manual r");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (modifiedManPage.contains("unregister") || modifiedManPage.contains("Unregister")) /*||modifiedManPage.contains("UNREGISTER")*/
{
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1149098 - Grammar issue, "unregister" not a word.
String bugId = "1149098";
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("Ignoring unrecognized word '" + "unregister" + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("unregister", "deregister");
modifiedManPage = modifiedManPage.replaceAll("Unregister", "Deregister");
// modifiedManPage = modifiedManPage.replaceAll("UNREGISTER", "DEREGISTER");
// deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("deregister", "register");
// Deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("Deregister", "Register");
// modifiedManPage = modifiedManPage.replaceAll("DEREGISTER", "REGISTER"); // DEREGISTERING is not recognized by hunspell -d en_US
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForRhsmDebug.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21781", "RHEL7-51598" }, 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 = "check the rhsm-debug man page for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForRhsmDebug() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "rhsm-debug";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(manPageResult.getStdout());
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manual", " bugzilla1194468comment2isNotFixed ");
// TEMPORARY WORKAROUND FOR BUG
for (String word : Arrays.asList(new String[] { "intead", "bugzilla1194468comment2isNotFixed" })) {
if (modifiedManPage.contains(word)) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1194468 - typos and poor grammar in rhsm-debug man page
String bugId = "1194468";
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("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("intead") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 23e0c319ae3ed9ff2dc684b46fc1c2bf4e05f840
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
Aggregations