Search in sources :

Example 26 with TestDefinition

use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.

the class TranslationTests method testRegisterWithFallbackCLocale.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21765", "RHEL7-32170" }, 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.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier2")
@Test(description = "verify subscription-manager register will succeed with fallback locale LANG=C; also verify the system.default_locale fact", groups = { "Tier2Tests", "blockedByBug-729988" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testRegisterWithFallbackCLocale() {
    // Bug 729988
    // [root@rhsm-compat-rhel61 ~]# LANG=C subscription-manager register --username stage_test_12 --password redhat 1>/tmp/stdout 2>/tmp/stderr
    // [root@rhsm-compat-rhel61 ~]# echo $?
    // 255
    // [root@rhsm-compat-rhel61 ~]# cat /tmp/stdout
    // [root@rhsm-compat-rhel61 ~]# cat /tmp/stderr
    // 'NoneType' object has no attribute 'lower'
    // [root@rhsm-compat-rhel61 ~]#
    String lang = "C";
    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 = clienttasks.runCommandWithLang(lang,clienttasks.command+" register --username "+sm_clientUsername+" --password "+sm_clientPassword+" "+(sm_clientOrg!=null?"--org "+sm_clientOrg:""));
    SSHCommandResult sshCommandResult = client.runCommandAndWait("LANG=" + lang + " " + clienttasks.command + " register --username " + sm_clientUsername + " --password " + sm_clientPassword + " " + (sm_clientOrg != null ? "--org " + sm_clientOrg : ""));
    Assert.assertEquals(sshCommandResult.getExitCode(), Integer.valueOf(0), "ExitCode after register 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 systemDefaultLocaleFactValue = clienttasks.getFactValue(systemDefaultLocaleFact);
        String localeLANG = client.runCommandAndWait("locale | grep LANG").getStdout().trim().split("=")[1];
        // UTF-8 and UTF8 are interchangeable (UTF8 appears as the fact value on RHEL6)
        Assert.assertEquals(systemDefaultLocaleFactValue.replace("UTF8", "UTF-8"), localeLANG.replace("UTF8", "UTF-8"), "The system's value for fact '" + systemDefaultLocaleFact + "' matches the locale LANG. (Note: UTF-8 and UTF8 are interchangeable)");
    }
}
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 27 with TestDefinition

use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.

the class TranslationTests method testTranslationsDoNotEndInUnwantedColon.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "", "" }, 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 a colon character has not been appended to the end of the translated msgstr unless msgid also ends in a colon", groups = { "Tier2Tests" }, dataProvider = "getTranslationFileDataToTestTranslationsDoNotEndInUnwantedColon", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotEndInUnwantedColon(Object bugzilla, File translationFile) {
    boolean warningsFound = false;
    List<String> colonChars = Arrays.asList(":", ":");
    for (String colonChar : colonChars) {
        for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
            if (translation.msgstr.trim().endsWith(colonChar) && !translation.msgid.trim().endsWith(":")) {
                log.warning("Colon character \"" + colonChar + "\" should not be randomly appended to the end of " + translationFile + " translation: " + translation);
                warningsFound = true;
            }
        }
    }
    Assert.assertTrue(!warningsFound, "No translations found containing unexpected trailing colon characters.  (Details for failed translations are listed in the WARNING messages above.)");
}
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 28 with TestDefinition

use of com.github.redhatqe.polarize.metadata.TestDefinition 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 29 with TestDefinition

use of com.github.redhatqe.polarize.metadata.TestDefinition 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 30 with TestDefinition

use of com.github.redhatqe.polarize.metadata.TestDefinition 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)

Aggregations

TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)687 Test (org.testng.annotations.Test)687 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)401 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)366 SkipException (org.testng.SkipException)328 ArrayList (java.util.ArrayList)144 SubscriptionPool (rhsm.data.SubscriptionPool)137 JSONObject (org.json.JSONObject)95 BigInteger (java.math.BigInteger)90 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)88 HashMap (java.util.HashMap)78 File (java.io.File)74 ProductSubscription (rhsm.data.ProductSubscription)72 InstalledProduct (rhsm.data.InstalledProduct)66 EntitlementCert (rhsm.data.EntitlementCert)58 ProductCert (rhsm.data.ProductCert)54 YumRepo (rhsm.data.YumRepo)34 Repo (rhsm.data.Repo)26 Calendar (java.util.Calendar)25 List (java.util.List)24