Search in sources :

Example 16 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.

the class TranslationTests method testRegisterWithUnknownLocale.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-47920", "RHEL7-97321" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", role = DefTypes.Role.VERIFIES), // RHSM-REQ : subscription-manager cli registration and deregistration
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28485", role = DefTypes.Role.VERIFIES), // RHSM-REQ : subscription-manager cli registration and deregistration
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84906", 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 = "verify subscription-manager register will succeed with an unknown locale LANG=foo; also verify the system.default_locale fact reports Unknown", groups = { "Tier2Tests", "blockedByBug-729988", "blockedByBug-1449824" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testRegisterWithUnknownLocale() {
    String lang = "foo";
    clienttasks.unregister(null, null, null, null);
    String command = String.format("%s register --username %s --password %s", clienttasks.command, sm_clientUsername, sm_clientPassword);
    if (sm_clientOrg != null)
        command += String.format(" --org %s", sm_clientOrg);
    SSHCommandResult sshCommandResult = client.runCommandAndWait("LANG=" + lang + " " + clienttasks.registerCommand(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, null, null, null, null, null, null));
    Assert.assertEquals(sshCommandResult.getExitCode(), Integer.valueOf(0), "ExitCode after register with LANG=" + lang + " fallback locale.");
    Assert.assertEquals(clienttasks.getCurrentConsumerId(sshCommandResult), clienttasks.getCurrentConsumerId(), "The registered consumer's identity should be interpreted correctly from the stdout when registering with LANG=" + lang + " fallback locale.");
    // also test the system.default_locale fact for an unknown locale
    if (clienttasks.isPackageVersion("python-rhsm", ">=", "1.19.3-1")) {
        // commit 0670d70540a24a8e173d347e2240dcfb7535608a Bug 1425922: System locale in facts
        String systemDefaultLocaleFact = "system.default_locale";
        String systemDefaultLocale = "Unknown";
        sshCommandResult = client.runCommandAndWait("LANG=" + lang + " " + clienttasks.factsCommand(true, null, null, null, null, null) + " | grep " + systemDefaultLocaleFact);
        Assert.assertEquals(sshCommandResult.getStdout().trim(), String.format("%s: %s", systemDefaultLocaleFact, systemDefaultLocale), "The system's fact for the default locale when run with locale LANG=" + lang + ".");
    }
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 17 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.

the class TranslationTests method testTranslationsDoNotUseParagraphCharacter.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36513", "RHEL7-32165" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", 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 that translation msgstr does NOT contain paragraph character ¶ unless also in msgid", groups = { "Tier2Tests" }, dataProvider = "getTranslationFileDataForVerifyTranslationsDoNotUseParagraphCharacter_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotUseParagraphCharacter(Object bugzilla, File translationFile) {
    boolean warningsFound = false;
    String paragraphChar = "¶";
    // for (File translationFile: translationFileMapForSubscriptionManager.keySet()) {	// use dataProvider="getTranslationFileData",
    for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
        if (translation.msgstr.contains(paragraphChar) && !translation.msgid.contains(paragraphChar)) {
            log.warning("Paragraph character \"" + paragraphChar + "\" should not be used in the " + translationFile + " translation: " + translation);
            warningsFound = true;
        }
    }
    // }
    Assert.assertTrue(!warningsFound, "No translations found containing unexpected paragraph character \"" + paragraphChar + "\".");
}
Also used : Translation(rhsm.data.Translation) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 18 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.

the class TranslationTests method testOnlyExpectedTranslationFilesAreInstalled.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-19945", "RHEL7-68144" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", 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 = "Tier1")
@Test(description = "verify that only the expected rhsm.mo tranlation files are installed for each of the supported locales", groups = { "Tier1Tests", "blockedByBug-824100" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testOnlyExpectedTranslationFilesAreInstalled() {
    List<File> supportedTranslationFiles = new ArrayList<File>();
    for (String supportedLocale : supportedLocales) supportedTranslationFiles.add(localeFile(supportedLocale));
    log.info("Expected locales include: " + supportedLocales);
    // assert no unexpected translation files are installed
    boolean unexpectedTranslationFilesFound = false;
    for (File translationFile : translationFileMapForSubscriptionManager.keySet()) {
        if (!supportedTranslationFiles.contains(translationFile)) {
            unexpectedTranslationFilesFound = true;
            log.warning("Unexpected translation file '" + translationFile + "' is installed.");
        }
    }
    // assert that all expected translation files are installed
    boolean allExpectedTranslationFilesFound = true;
    for (File translationFile : supportedTranslationFiles) {
        if (!translationFileMapForSubscriptionManager.keySet().contains(translationFile)) {
            log.warning("Expected translation file '" + translationFile + "' is NOT installed.");
            allExpectedTranslationFilesFound = false;
        } else {
            log.info("Expected translation file '" + translationFile + "' is installed.");
        }
    }
    Assert.assertTrue(!unexpectedTranslationFilesFound, "No unexpected translation files were found installed.");
    Assert.assertTrue(allExpectedTranslationFilesFound, "All expected translation files were found installed.");
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 19 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest 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.");
}
Also used : Translation(rhsm.data.Translation) 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 20 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest 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.");
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) BigInteger(java.math.BigInteger) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Aggregations

ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)267 Test (org.testng.annotations.Test)267 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)244 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)146 SkipException (org.testng.SkipException)125 SubscriptionPool (rhsm.data.SubscriptionPool)71 ArrayList (java.util.ArrayList)62 BigInteger (java.math.BigInteger)53 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)42 ProductSubscription (rhsm.data.ProductSubscription)42 File (java.io.File)36 JSONObject (org.json.JSONObject)33 EntitlementCert (rhsm.data.EntitlementCert)32 ProductCert (rhsm.data.ProductCert)32 InstalledProduct (rhsm.data.InstalledProduct)15 ConsumerCert (rhsm.data.ConsumerCert)14 HashMap (java.util.HashMap)11 Calendar (java.util.Calendar)10 List (java.util.List)10 JSONArray (org.json.JSONArray)8