Search in sources :

Example 66 with SSHCommandResult

use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.

the class BugzillaTests method testCorruptIdentityCert.

/**
 * @author skallesh
 * @throws Exception
 * @throws JSONException
 */
@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21979", "RHEL7-51841" }, 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 = "verify if corrupt identity cert displays a trace back for list command", groups = { "Tier3Tests", "VerifyCorruptIdentityCert", "blockedByBug-607162" }, enabled = true)
public void testCorruptIdentityCert() throws JSONException, Exception {
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
    client.runCommandAndWait("cp /etc/pki/consumer/cert.pem /etc/pki/consumer/cert.pem.save");
    RemoteFileTasks.runCommandAndAssert(client, "openssl x509 -noout -text -in " + clienttasks.consumerCertFile() + " > /tmp/stdout; mv /tmp/stdout -f " + clienttasks.consumerCertFile(), 0);
    SSHCommandResult result = clienttasks.list_(null, true, null, null, null, null, null, null, null, null, null, null, null, null);
    if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.20.1-1")) {
        // commit 79f86e4c043ee751677131ed4e3cf00affd13087
        Assert.assertEquals(result.getStderr().trim(), "Consumer identity either does not exist or is corrupted. Try register --help", "stdout");
    } else if ((clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1"))) {
        // post
        // commit
        // df95529a5edd0be456b3528b74344be283c4d258
        Assert.assertEquals(result.getStderr().trim(), clienttasks.msg_ConsumerNotRegistered, "stderr");
    } else {
        Assert.assertEquals(result.getStdout().trim(), clienttasks.msg_ConsumerNotRegistered, "stdout");
    }
}
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 67 with SSHCommandResult

use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.

the class BugzillaTests method testCacheAndFactsFilePermissions.

/*
	 * @author redakkan
	 *
	 * @throws exception
	 *
	 * @throws JSONException *
	 */
@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL7-55664" }, 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 = "Verify the file permissions on /var/lib/rhsm/cache and facts files", groups = { "Tier3Tests", "blockedByBug-1297485", "blockedByBug-1297493", "blockedByBug-1340525", "blockedByBug-1389449" }, enabled = true)
public void testCacheAndFactsFilePermissions() throws JSONException, Exception {
    if (clienttasks.isPackageVersion("subscription-manager", "<", "1.17.7-1")) {
        // caches.
        throw new SkipException("This test applies a newer version of subscription manager that includes fixes for bugs 1297493 and 1297485.");
    }
    String command = clienttasks.rhsmCacheDir;
    // gets
    SSHCommandResult result = client.runCommandAndWait("stat -c '%a' " + command);
    // the File /var/lib/rhsm/cache access rights in octal
    // post
    Assert.assertEquals(result.getStdout().trim(), "750", "Expected permission on /var/lib/rhsm/cache is 750");
    // commit
    // 9dec31c377b57b4c98f845c018a5372d6f650d88
    // gets
    SSHCommandResult result1 = client.runCommandAndWait("stat -c '%a' /var/lib/rhsm/facts");
    // the File /var/lib/rhsm/facts access rights in octal
    // post
    Assert.assertEquals(result1.getStdout().trim(), "750", "Expected permission on /var/lib/rhsm/facts is 750");
// commit
// 9dec31c377b57b4c98f845c018a5372d6f650d88
}
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 68 with SSHCommandResult

use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.

the class BugzillaTests method testFunctionalityAccessAfterUnregister.

/**
 * @author skallesh
 * @throws Exception
 * @throws JSONException
 */
@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21952", "RHEL7-51814" }, 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 = "Verify Functionality Access After Unregister", groups = { "Tier3Tests", "VerifyFunctionalityAccessAfterUnregister" }, enabled = true)
@ImplementsNitrateTest(caseId = 50215)
public void testFunctionalityAccessAfterUnregister() throws JSONException, Exception {
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg);
    String availList = clienttasks.listAllAvailableSubscriptionPools().getStdout();
    Assert.assertNotNull(availList);
    clienttasks.unregister(null, null, null, null);
    SSHCommandResult listResult = clienttasks.list_(true, true, null, null, null, null, null, null, null, null, null, null, null, null);
    String expected = "This system is not yet registered. Try 'subscription-manager register --help' for more information.";
    if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.8-1")) {
        // post
        // commit
        // df95529a5edd0be456b3528b74344be283c4d258
        Assert.assertEquals(listResult.getStderr().trim(), expected, "stderr");
    } else {
        Assert.assertEquals(listResult.getStdout().trim(), expected, "stdout");
    }
    ConsumerCert consumercert = clienttasks.getCurrentConsumerCert();
    Assert.assertNull(consumercert);
}
Also used : SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) ConsumerCert(rhsm.data.ConsumerCert) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 69 with SSHCommandResult

use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.

the class BugzillaTests method testServiceLevelWithOrgWithoutList.

/**
 * @author skallesh
 */
@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21926", "RHEL7-51787" }, 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 = "subscription-manager: service-level --org (without --list option)", groups = { "Tier3Tests", "ServicelevelTest", "blockedByBug-826856" }, enabled = true)
public void testServiceLevelWithOrgWithoutList() {
    SSHCommandResult result;
    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);
    result = clienttasks.service_level_(null, false, null, null, sm_clientUsername, sm_clientPassword, "MyOrg", null, null, null, null, null, null);
    if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.13.9-1")) {
        // post
        // commit
        // a695ef2d1da882c5f851fde90a24f957b70a63ad
        Assert.assertEquals(result.getStderr().trim(), "Error: --org is only supported with the --list option", "stderr");
    } else {
        Assert.assertEquals(result.getStdout().trim(), "Error: --org is only supported with the --list option", "stdout");
    }
}
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 70 with SSHCommandResult

use of com.redhat.qe.tools.SSHCommandResult in project rhsm-qe by RedHatQE.

the class BugzillaTests method testAttemptRegisterWithWhiteSpacesInUsername.

/**
 * @author skallesh
 */
@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21900", "RHEL7-51761" }, 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: attempt register to with white space in the user name should fail", groups = { "Tier3Tests", "registeredTests", "blockedByBug-719378" }, enabled = true)
public void testAttemptRegisterWithWhiteSpacesInUsername() {
    SSHCommandResult result = clienttasks.register_("user name", "password", sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, null, null, null, null, null);
    Assert.assertEquals(result.getStderr().trim(), servertasks.invalidCredentialsMsg(), "The expected stdout result when attempting to register with a username containing whitespace.");
}
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)

Aggregations

SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)553 Test (org.testng.annotations.Test)416 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)401 SkipException (org.testng.SkipException)219 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)201 ArrayList (java.util.ArrayList)101 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)79 BigInteger (java.math.BigInteger)68 File (java.io.File)58 SubscriptionPool (rhsm.data.SubscriptionPool)53 JSONObject (org.json.JSONObject)47 HashMap (java.util.HashMap)42 ProductSubscription (rhsm.data.ProductSubscription)31 EntitlementCert (rhsm.data.EntitlementCert)30 List (java.util.List)21 YumRepo (rhsm.data.YumRepo)18 ProductCert (rhsm.data.ProductCert)17 Repo (rhsm.data.Repo)16 InstalledProduct (rhsm.data.InstalledProduct)15 Calendar (java.util.Calendar)13