use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testManualChangesToRedhatRepo.
/**
* @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-21915", "RHEL7-51776" }, 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 Manual Changes To Redhat.Repo is sticky", groups = { "Tier3Tests", "ManualChangesToRedhat_Repo", "blockedByBug-797243" }, enabled = true)
public void testManualChangesToRedhatRepo() throws Exception {
List<String[]> listOfSectionNameValues = new ArrayList<String[]>();
listOfSectionNameValues.add(new String[] { "rhsmcertd", "autoAttachInterval".toLowerCase(), "1440" });
clienttasks.config(null, null, true, listOfSectionNameValues);
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, true, false, null, null, null, null);
List<SubscriptionPool> Availablepools = clienttasks.getCurrentlyAvailableSubscriptionPools();
SubscriptionPool pool = Availablepools.get(randomGenerator.nextInt(Availablepools.size()));
clienttasks.subscribeToSubscriptionPool(pool);
for (Repo repo : clienttasks.getCurrentlySubscribedRepos()) {
if (repo.repoId.equals("always-enabled-content")) {
Assert.assertTrue(repo.enabled);
}
}
client.runCommandAndWait("sed -i \"/\\[always-enabled-content]/,/\\[/s/^enabled\\s*=.*/Enabled: false/\" /etc/yum.repos.d/redhat.repo");
for (Repo repo : clienttasks.getCurrentlySubscribedRepos()) {
if (repo.repoId.equals("always-enabled-content")) {
Assert.assertFalse(repo.enabled);
}
}
client.runCommandAndWait(" yum repolist enabled");
clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
String expected_message = "This system has no repositories available through subscriptions.";
String reposlist = clienttasks.repos(true, null, null, (String) null, null, null, null, null, null).getStdout();
Assert.assertEquals(reposlist.trim(), expected_message);
clienttasks.unregister(null, null, null, null);
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);
reposlist = clienttasks.repos(true, null, null, (String) null, null, null, null, null, null).getStdout();
Assert.assertEquals(reposlist.trim(), expected_message);
clienttasks.subscribe(true, null, (String) null, null, null, null, null, null, null, null, null, null, null);
for (Repo repo : clienttasks.getCurrentlySubscribedRepos()) {
if (repo.repoId.equals("always-enabled-content")) {
Assert.assertTrue(repo.enabled);
}
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition 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");
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition 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
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testStackingFutureSubscriptionWithCurrentSubscription.
/**
* @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-21927", "RHEL7-51788" }, 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 Stacking of a future subscription and present subsciption make the product compliant ", groups = { "Tier3Tests", "StackingFutureSubscriptionWithCurrentSubscription", "blockedByBug-966069" }, enabled = true)
public void testStackingFutureSubscriptionWithCurrentSubscription() throws 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);
clienttasks.autoheal(null, null, true, null, null, null, null);
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);
clienttasks.autoheal(null, null, true, null, null, null, null);
int sockets = 9;
int core = 2;
int ram = 10;
Map<String, String> factsMap = new HashMap<String, String>();
factsMap.put("cpu.cpu_socket(s)", String.valueOf(sockets));
factsMap.put("cpu.core(s)_per_socket", String.valueOf(core));
factsMap.put("memory.memtotal", String.valueOf(GBToKBConverter(ram)));
factsMap.put("virt.is_guest", String.valueOf(Boolean.FALSE));
clienttasks.createFactsFileWithOverridingValues(factsMap);
clienttasks.facts(null, true, null, null, null, null);
Boolean nosubscriptionsFound = true;
Calendar now = new GregorianCalendar();
DateFormat yyyy_MM_dd_DateFormat = new SimpleDateFormat("yyyy-MM-dd");
now.add(Calendar.YEAR, 1);
now.add(Calendar.DATE, 1);
String onDateToTest = yyyy_MM_dd_DateFormat.format(now.getTime());
List<String> providedProductId = new ArrayList<String>();
List<SubscriptionPool> AvailableStackableSubscription = SubscriptionPool.findAllInstancesWithMatchingFieldFromList("subscriptionType", "Stackable", clienttasks.getAvailableSubscriptionsMatchingInstalledProducts());
List<SubscriptionPool> futureStackableSubscription = SubscriptionPool.findAllInstancesWithMatchingFieldFromList("subscriptionType", "Stackable", clienttasks.getAvailableFutureSubscriptionsOndate(onDateToTest));
List<SubscriptionPool> futureSubscription = FindSubscriptionsWithSuggestedQuantityGreaterThanTwo(futureStackableSubscription);
List<SubscriptionPool> AvailableSubscriptions = FindSubscriptionsWithSuggestedQuantityGreaterThanTwo(AvailableStackableSubscription);
for (SubscriptionPool AvailableSubscriptionPools : AvailableSubscriptions) {
int quantity = AvailableSubscriptionPools.suggested;
for (SubscriptionPool FutureSubscriptionPools : futureSubscription) {
if ((AvailableSubscriptionPools.subscriptionName).equals(FutureSubscriptionPools.subscriptionName)) {
providedProductId = AvailableSubscriptionPools.provides;
clienttasks.subscribe(null, null, AvailableSubscriptionPools.poolId, null, null, Integer.toString(quantity - 1), null, null, null, null, null, null, null);
nosubscriptionsFound = false;
InstalledProduct AfterAttachingFutureSubscription = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productName", providedProductId.get(providedProductId.size() - 1), clienttasks.getCurrentlyInstalledProducts());
Assert.assertEquals(AfterAttachingFutureSubscription.status, "Partially Subscribed", "Verified that installed product is partially subscribed before attaching a future subscription");
clienttasks.subscribe(null, null, FutureSubscriptionPools.poolId, null, null, "1", null, null, null, null, null, null, null);
break;
}
}
}
if (nosubscriptionsFound)
throw new SkipException("no subscriptions found");
InstalledProduct AfterAttaching = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productName", providedProductId.get(providedProductId.size() - 1), clienttasks.getCurrentlyInstalledProducts());
Assert.assertEquals(AfterAttaching.status, "Partially Subscribed", "Verified that installed product is partially subscribed even after attaching a future subscription");
}
use of com.github.redhatqe.polarize.metadata.TestDefinition 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);
}
Aggregations