Search in sources :

Example 11 with ImplementsNitrateTest

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

the class ServiceLevelTests method testServiceLevelShowWhenNotRegistered.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21878", "RHEL7-51717" }, 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 --show (when not registered)", groups = { "Tier3Tests", "blockedByBug-826856" /*"blockedByBug-837036"*/
}, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testServiceLevelShowWhenNotRegistered() {
    // make sure we are not registered
    clienttasks.unregister(null, null, null, null);
    SSHCommandResult result;
    // with credentials
    result = clienttasks.service_level_(true, null, null, 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(), Integer.valueOf(1), "ExitCode from service-level --show 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 --show without being registered");
    } else {
        Assert.assertEquals(result.getExitCode(), Integer.valueOf(255), "ExitCode from service-level --show without being registered");
        // Assert.assertEquals(result.getStdout().trim(),"Error: This system is currently not registered.", "Stdout from service-level --show 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 --show without being registered");
    }
    if (sm_clientOrg != null) {
        result = clienttasks.service_level_(null, null, null, 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 --show without being registered");
            Assert.assertEquals(result.getStderr().trim(), "Error: --org is only supported with the --list option", "Stderr from service-level --show without being registered");
        } else {
            Assert.assertEquals(result.getExitCode(), Integer.valueOf(255), "ExitCode from service-level --show without being registered");
            Assert.assertEquals(result.getStdout().trim(), "Error: --org is only supported with the --list option", "Stdout from service-level --show without being registered");
        }
    }
    // without credentials
    result = clienttasks.service_level_(true, null, null, 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(), Integer.valueOf(1), "ExitCode from service-level --show 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 --show without being registered");
    } else {
        Assert.assertEquals(result.getExitCode(), Integer.valueOf(255), "ExitCode from service-level --show without being registered");
        // Assert.assertEquals(result.getStdout().trim(),"Error: This system is currently not registered.", "Stdout from service-level --show 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 --show without being registered");
    }
}
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 12 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest 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");
    }
}
Also used : BigInteger(java.math.BigInteger) 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 13 with ImplementsNitrateTest

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

the class TranslationTests method testYumSearchDoesNotThrowAsciiCodecError.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-19946", "RHEL7-55158" }, 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 : Yum installation of entitled content and product certificates
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28563", role = DefTypes.Role.RELATES_TO), // RHSM-REQ : Yum installation of entitled content and product certificates
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84940", role = DefTypes.Role.RELATES_TO) }, 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 \"'ascii' codec can't decode byte\" errors do not occur with yum search", groups = { "Tier1Tests", "blockedByBug-1199597", "VerifyYumSearchDoesNotThrowAsciiCodecError_Test" }, dataProvider = "getSupportedLangsData", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testYumSearchDoesNotThrowAsciiCodecError(Object bugzilla, String lang) {
    // skip the test when we do not have access to RHEL content
    if (!isRhelProductCertSubscribedForVerifyYumSearchDoesNotThrowAsciiCodecError)
        throw new SkipException("Cannot perform this test until an available RHEL subscription has been attached.");
    // attempt to search for the zsh package using the lang
    String command = "yum search zsh";
    SSHCommandResult result = clienttasks.runCommandWithLang(lang, command);
    // 201505281651:59.086 - FINE: ssh root@jsefler-os6.usersys.redhat.com LANG=as.UTF-8 yum search zsh
    // 201505281652:05.593 - FINE: Stdout:
    // Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
    // : subscription-manager
    // =============================== N/S Matched: zsh ===============================
    // zsh.x86_64 : A powerful interactive shell
    // 
    // Name and summary matches only, use "search all" for everything.
    // 201505281652:05.599 - FINE: Stderr:
    // Failed to set locale, defaulting to C
    // This system is not registered with RHN Classic or RHN Satellite.
    // You can use rhn_register to register.
    // RHN Satellite or RHN Classic support will be disabled.
    // 201505281652:05.603 - FINE: ExitCode: 0
    String errorMsg = "Failed to set locale, defaulting to C";
    Assert.assertTrue(!result.getStdout().toLowerCase().contains(errorMsg.toLowerCase()), "Stdout from running '" + command + "' in locale '" + lang + "' does not contain error '" + errorMsg + "'.");
    Assert.assertTrue(!result.getStderr().toLowerCase().contains(errorMsg.toLowerCase()), "Stderr from running '" + command + "' in locale '" + lang + "' does not contain error '" + errorMsg + "'.");
    // 201505281705:36.206 - FINE: ssh root@jsefler-os6.usersys.redhat.com LANG=de_DE.UTF-8 yum search zsh (com.redhat.qe.tools.SSHCommandRunner.run)
    // 201505281705:42.591 - FINE: Stdout:
    // Geladene Plugins: product-id, refresh-packagekit, rhnplugin, security,
    // : subscription-manager
    // =============================== N/S Matched: zsh ===============================
    // zsh.x86_64 : A powerful interactive shell
    // 
    // Name and summary matches only, use "search all" for everything.
    // (com.redhat.qe.tools.SSHCommandRunner.runCommandAndWait)
    // 201505281705:42.592 - FINE: Stderr:
    // 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)
    // This system is not registered with RHN Classic or RHN Satellite.
    // You can use rhn_register to register.
    // RHN Satellite oder RHN Classic Unterstützung wird deaktiviert.
    // (com.redhat.qe.tools.SSHCommandRunner.runCommandAndWait)
    // 201505281705:42.592 - FINE: ExitCode: 0
    errorMsg = "'ascii' codec can't decode byte";
    Assert.assertTrue(!result.getStdout().toLowerCase().contains(errorMsg.toLowerCase()), "Stdout from running '" + command + "' in locale '" + lang + "' does not contain error '" + errorMsg + "'.");
    Assert.assertTrue(!result.getStderr().toLowerCase().contains(errorMsg.toLowerCase()), "Stderr from running '" + command + "' in locale '" + lang + "' does not contain error '" + errorMsg + "'.");
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 14 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest 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 15 with ImplementsNitrateTest

use of com.redhat.qe.auto.tcms.ImplementsNitrateTest 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)

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