use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class TranslationTests method testCandlepinTranslationsDoNotContainUnescapedSingleQuotes.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21767", "RHEL7-51283" }, 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.LOW, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "verify that candlepin translation msgstr does NOT contain unescaped single quotes in the msgid", groups = { "Tier3Tests" }, dataProvider = "getTranslationFileDataForVerifyCandlepinTranslationsDoNotContainUnescapedSingleQuotes_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testCandlepinTranslationsDoNotContainUnescapedSingleQuotes(Object bugzilla, File translationFile) {
boolean warningsFound = false;
// for (File translationFile: translationFileMapForCandlepin.keySet()) { // use dataProvider="getTranslationFileData",
for (Translation translation : translationFileMapForCandlepin.get(translationFile)) {
// TEMPORARY WORKAROUND FOR BUG:
if (translation.msgid.trim().equals("Cannot add pools that are restricted to unit type 'person' to activation keys.") || translation.msgid.trim().equals("A unit type of 'person' cannot be used with activation keys") || translation.msgid.trim().equals("Unit type with id '") || translation.msgid.trim().equals("The activation key name ''{0}'' must be alphanumeric or include the characters '-' or '_'") || translation.msgid.trim().equals("couldn't read rules file") || translation.msgid.trim().equals("couldn't generate statistics") || translation.msgid.trim().equals("the order parameter must be either 'ascending' or 'descending'")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1167856 - candlepin msgids with unescaped single quotes will not print the single quotes
String bugId = "1167856";
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 test for unescaped single quotes on this translation while bug '" + bugId + "' is open. Translation: " + translation);
continue;
}
}
if (doesStringContainMatches(translation.msgstr, "(^|[^'])'([^']|$)")) {
// this regex is used to find solo single quotes in the translated msgstr
log.warning("Found a translation containing an unescaped single quote in the " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
// }
Assert.assertTrue(!warningsFound, "No candlepin translations found containing unescaped single quotes.");
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class UnsubscribeTests method testUnsubscribeFromAll.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36597", "RHEL7-51402" }, linkedWorkItems = { @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL6-28489", project = Project.RHEL6, role = DefTypes.Role.VERIFIES), @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL7-84911", project = Project.RedHatEnterpriseLinux7, role = DefTypes.Role.VERIFIES) }, 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 the feedback after unsubscribing from all consumed subscriptions using unsubscribe --all", groups = { "Tier2Tests", "blockedByBug-812388", "blockedByBug-844455" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testUnsubscribeFromAll() {
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, null, null, null, true, null, null, null, null, null);
clienttasks.subscribeToTheCurrentlyAllAvailableSubscriptionPoolsCollectively();
int numberSubscriptionsConsumed = clienttasks.getCurrentEntitlementCertFiles().size();
// unsubscribe from all and assert # subscriptions are unsubscribed
SSHCommandResult result = clienttasks.unsubscribe(true, (BigInteger) null, null, null, null, null, null);
// String expectedStdoutRegex = String.format("This machine has been unsubscribed from %s subscriptions",pools.size()); // 10/18/2013 NOT SURE WHAT COMMIT/BUG CAUSED THIS CHANGE TO THE FOLLOWING...
String expectedStdoutRegex = String.format("%s subscriptions removed at the server." + "\n" + "%s local certificates have been deleted.", numberSubscriptionsConsumed, numberSubscriptionsConsumed);
// commit d88d09c7060a17fba34a138313e7efd21cc79d02 D-Bus service for removing entitlements (all/ID/serial num.)
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.20.2-1"))
expectedStdoutRegex = String.format("%s local certificates have been deleted." + "\n" + "%s subscriptions removed at the server.", numberSubscriptionsConsumed, numberSubscriptionsConsumed);
Assert.assertEquals(result.getStdout().trim(), expectedStdoutRegex, "Expected feedback when unsubscribing from all the currently consumed subscriptions.");
// now attempt to unsubscribe from all again and assert 0 subscriptions are unsubscribed
result = clienttasks.unsubscribe(true, (BigInteger) null, null, null, null, null, null);
// Assert.assertEquals(result.getStdout().trim(), String.format("This machine has been unsubscribed from %s subscriptions",0),"Expected feedback when unsubscribing from all when no subscriptions are currently consumed."); // 10/18/2013 NOT SURE WHAT COMMIT/BUG CAUSED THIS CHANGE TO THE FOLLOWING...
Assert.assertEquals(result.getStdout().trim(), String.format("%s subscriptions removed at the server.", 0), "Expected feedback when unsubscribing from all when no subscriptions are currently consumed.");
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class UnsubscribeTests method testUnsubscribeFromAllSerials.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36596", "RHEL7-51401" }, linkedWorkItems = { @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL6-28489", project = Project.RHEL6, role = DefTypes.Role.VERIFIES), @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL7-84911", project = Project.RedHatEnterpriseLinux7, role = DefTypes.Role.VERIFIES) }, 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 the feedback after unsubscribing from all consumed subscriptions using unsubscribe --serial SERIAL1 --serial SERIAL2 --serial SERIAL3 etc.", groups = { "Tier2Tests", "blockedByBug-867766" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testUnsubscribeFromAllSerials() throws Exception {
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, null, null, null, true, false, null, null, null, null);
List<SubscriptionPool> pools = clienttasks.subscribeToTheCurrentlyAllAvailableSubscriptionPoolsCollectively();
if (pools.isEmpty())
throw new SkipException("This test requires multiple available pools.");
// unsubscribe from all serials in one call and assert the feedback
List<ProductSubscription> productSubscriptions = clienttasks.getCurrentlyConsumedProductSubscriptions();
String expectedStdoutMsgLabel;
expectedStdoutMsgLabel = "Successfully unsubscribed serial numbers:";
// changed by bug 874749
expectedStdoutMsgLabel = "Successfully removed serial numbers:";
// changed by bug 895447 subscription-manager commit 8e10e76fb5951e0b5d6c867c6c7209d8ec80dead
expectedStdoutMsgLabel = "Serial numbers successfully removed at the server:";
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.17.8-1")) {
// commit f64d5a6b012f49bb4d6d6653441d4de9bf373660 1319678: Alter the return message for removing entitlements at server
expectedStdoutMsgLabel = "The entitlement server successfully removed these serial numbers:";
}
String expectedStdoutMsg = expectedStdoutMsgLabel;
for (ProductSubscription productSubscription : productSubscriptions) expectedStdoutMsg += "\n " + productSubscription.serialNumber;
SSHCommandResult result = clienttasks.unsubscribeFromTheCurrentlyConsumedProductSubscriptionSerialsCollectively();
// 201512041150:31.105 - FINE: ssh root@jsefler-6.usersys.redhat.com subscription-manager unsubscribe --serial=4651043328648416651 --serial=2129955862705896392 --serial=6036987963107037829 --serial=6517055606227995394 --serial=2413511261042915625 --serial=926011418395876185 --serial=8453228344236558779 --serial=5066796542261309304 --serial=3293732479098570905 --serial=5415112579595928189 --serial=9157726701938581232 --serial=6182970514936389843 --serial=2260599158127862401 --serial=4271127926386632804 --serial=5634936969630756863 --serial=7207476634289399667 --serial=2228491462979865207 --serial=2386453852224823924 --serial=7223061298534444815 --serial=5297175478219818300 --serial=3982095574288257352 --serial=5040485111524274578 --serial=3366381999267298553 --serial=2205964533240272738 --serial=2009203577428614683 --serial=2151906114081820015 --serial=3936210531886609574 --serial=4672997312714367813 --serial=7537851805340427070 --serial=4060809784799304042 --serial=3484999197148046565 --serial=803523513343380611 --serial=7191534188916803249 --serial=1978078461069342056 --serial=3112667572957043871 --serial=8477444878208748895 --serial=4389608640436010689 --serial=2216833362015010963 --serial=1813156641027923146 --serial=6235363562528759967 --serial=8254500161982005905 --serial=8635854683836611062 --serial=2837535867304046524 --serial=6672137066369518129 --serial=6702191060241838270 --serial=695479724906271580 (com.redhat.qe.tools.SSHCommandRunner.run)
// 201512041151:20.262 - FINE: Stdout:
// Serial numbers successfully removed at the server:
// 4651043328648416651
// 2129955862705896392
// 6036987963107037829
// 6517055606227995394
// 2413511261042915625
// 926011418395876185
// 8453228344236558779
// 5066796542261309304
// 3293732479098570905
// 5415112579595928189
// 9157726701938581232
// 6182970514936389843
// 2260599158127862401
// 4271127926386632804
// 5634936969630756863
// 7207476634289399667
// 2228491462979865207
// 2386453852224823924
// 7223061298534444815
// 5297175478219818300
// 3982095574288257352
// 5040485111524274578
// 3366381999267298553
// 2205964533240272738
// 2009203577428614683
// 2151906114081820015
// 3936210531886609574
// 4672997312714367813
// 7537851805340427070
// 4060809784799304042
// 3484999197148046565
// 803523513343380611
// 7191534188916803249
// 1978078461069342056
// 3112667572957043871
// 8477444878208748895
// 4389608640436010689
// 2216833362015010963
// 1813156641027923146
// 6235363562528759967
// 8254500161982005905
// 8635854683836611062
// 2837535867304046524
// 6672137066369518129
// 6702191060241838270
// 695479724906271580
// 46 local certificates have been deleted.
// 201512041151:20.283 - FINE: Stderr:
String actualStdoutMsg = result.getStdout().trim();
actualStdoutMsg = clienttasks.workaroundForBug906550(actualStdoutMsg);
// NOTE: This expectedStdoutMsg makes a huge assumption about the order of the unsubscribed serial numbers printed to stdout
// NOTE: TIME TO FIX THIS ASSERTION... Assert.assertEquals(result.getStdout().trim(), expectedStdoutMsg, "Stdout feedback when unsubscribing from all the currently consumed subscriptions.");
List<String> expectedStdoutMsgAsList = new ArrayList<String>(Arrays.asList(expectedStdoutMsg.split("\n")));
expectedStdoutMsgAsList.remove(expectedStdoutMsgLabel);
List<String> actualStdoutMsgAsList = new ArrayList<String>(Arrays.asList(actualStdoutMsg.split("\n")));
actualStdoutMsgAsList.remove(expectedStdoutMsgLabel);
Assert.assertTrue(expectedStdoutMsgAsList.containsAll(actualStdoutMsgAsList) && actualStdoutMsgAsList.containsAll(expectedStdoutMsgAsList), "Stdout feedback when unsubscribing from all the currently consumed subscriptions contains all the expected serial numbers:" + expectedStdoutMsg.replace(expectedStdoutMsgLabel, ""));
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class UnsubscribeTests method testUnsubscribeFromAnUnknownPoolId.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36363", "RHEL7-51405" }, linkedWorkItems = { @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL6-28489", project = Project.RHEL6, role = DefTypes.Role.VERIFIES), @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL7-84911", project = Project.RedHatEnterpriseLinux7, role = DefTypes.Role.VERIFIES) }, 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 = "Tier1")
@Test(description = "Attempt to unsubscribe from an unknown pool id", groups = { "Tier1Tests", "blockedByBug-1198178", "blockedByBug-1298586" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testUnsubscribeFromAnUnknownPoolId() {
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.16.5-1"))
throw new SkipException("The unsubscribe --pool function was not implemented in this version of subscription-manager. See RFE Bug 1198178");
// register
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, null, null, null, true, false, null, null, null, null);
String poolId = "1234567890abcdef1234567890abcdef";
SSHCommandResult result = clienttasks.unsubscribe_(null, null, poolId, null, null, null, null);
if (servertasks.statusCapabilities.contains("remove_by_pool_id")) {
Integer expectedExitCode = new Integer(1);
String expectedStdout = "";
// commit e418b77ce2a7389e310ac341a6beb46cb7eb3d0f // Bug 1298586: Message needed for remove only invalid pool
expectedStdout = String.format("Pools unsuccessfully removed at the server:\n %s", poolId);
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.17.8-1")) {
// commit f64d5a6b012f49bb4d6d6653441d4de9bf373660 1319678: Alter the return message for removing entitlements at server
expectedStdout = String.format("The entitlement server failed to remove these pools:\n %s", poolId);
}
Assert.assertEquals(result.getExitCode(), expectedExitCode, "Asserting exit code when attempting to unsubscribe from an unknown pool id.");
Assert.assertEquals(result.getStdout().trim(), expectedStdout, "Stdout");
Assert.assertEquals(result.getStderr().trim(), "", "Stderr");
} else {
// coverage for Bug 1285004 - subscription-manager remove --pool throws: Runtime Error Could not find resource for relative of full path
Integer expectedExitCode = new Integer(69);
Assert.assertEquals(result.getExitCode(), expectedExitCode, "Asserting exit code when attempting to unsubscribe from an invalid pool id (from an incapable server).");
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.16.7-1")) {
// d9a82d3135a1770f794c2c8181f44e7e4628e0b6 Output of errors now goes to stderr
Assert.assertEquals(result.getStderr().trim(), "Error: The registered entitlement server does not support remove --pool.\nInstead, use the remove --serial option.", "Stderr");
Assert.assertEquals(result.getStdout().trim(), "", "Stdout");
} else {
Assert.assertEquals(result.getStdout().trim(), "Error: The registered entitlement server does not support remove --pool.\nInstead, use the remove --serial option.", "Stdout");
Assert.assertEquals(result.getStderr().trim(), "", "Stderr");
}
throw new SkipException("The registered entitlement server does not support remove --pool");
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class UnsubscribeTests method testUnsubscribeFromSerialWhenNotRegistered.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36600", "RHEL7-51408" }, linkedWorkItems = { @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL6-28489", project = Project.RHEL6, role = DefTypes.Role.VERIFIES), @LinkedItem(// RHSM-REQ : subscription-manager cli attaching and removing subscriptions
workitemId = "RHEL7-84911", project = Project.RedHatEnterpriseLinux7, role = DefTypes.Role.VERIFIES) }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.NEGATIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier2")
@Test(description = "Attempt to unsubscribe from a serial when not registered", groups = { "Tier2Tests", "blockedByBug-735338", "blockedByBug-838146", "blockedByBug-865590", "blockedByBug-873791" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testUnsubscribeFromSerialWhenNotRegistered() {
// first make sure we are subscribed to a pool
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, null, null, null, true, false, null, null, null, null);
List<SubscriptionPool> pools = clienttasks.getCurrentlyAvailableSubscriptionPools();
// random available pool
SubscriptionPool pool = pools.get(randomGenerator.nextInt(pools.size()));
EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(clienttasks.subscribeToSubscriptionPool(pool, /*sm_serverAdminUsername*/
sm_clientUsername, /*sm_serverAdminPassword*/
sm_clientPassword, sm_serverUrl));
// now remove the consumer cert to simulate an unregister
clienttasks.removeAllCerts(true, false, false);
SSHCommandResult identityResult = clienttasks.identity_(null, null, null, null, null, null, null, null);
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1")) {
// post commit 5697e3af094be921ade01e19e1dfe7b548fb7d5b bug 1119688
Assert.assertEquals(identityResult.getStderr().trim(), clienttasks.msg_ConsumerNotRegistered, "stderr");
} else {
Assert.assertEquals(identityResult.getStdout().trim(), clienttasks.msg_ConsumerNotRegistered, "stdout");
}
// now unsubscribe from the serial number (while not registered)
Assert.assertTrue(clienttasks.getCurrentlyConsumedProductSubscriptions().size() > 0, "We should be consuming an entitlement (even while not registered)");
// clienttasks.unsubscribeFromSerialNumber(entitlementCert.serialNumber); // this will assert a different stdout message, instead call unsubscribe manually and assert results
SSHCommandResult result = clienttasks.unsubscribe(null, entitlementCert.serialNumber, null, null, null, null, null);
Assert.assertEquals(result.getStdout().trim(), "Subscription with serial number " + entitlementCert.serialNumber + " removed from this system", "We should always be able to remove a subscription (even while not registered).");
Assert.assertEquals(clienttasks.getCurrentlyConsumedProductSubscriptions().size(), 0, "We should not be consuming any entitlements after unsubscribing (while not registered).");
}
Aggregations