use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testStartEndDateOfSubscription.
/**
* @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-21970", "RHEL7-51832" }, 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 End date and start date of the subscription is appropriate one when you attach a future subscription and then heal after 1 min", groups = { "Tier3Tests", "VerifyStartEndDateOfSubscription", "blockedByBug-994853", "blockedByBug-1440934" }, enabled = true)
public void testStartEndDateOfSubscription() throws Exception {
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, true, null, null, null, null, null);
Map<String, String> factsMap = new HashMap<String, String>();
factsMap.put("cpu.cpu_socket(s)", String.valueOf(4));
clienttasks.createFactsFileWithOverridingValues(factsMap);
// [jsefler] I believe
clienttasks.facts(null, true, null, null, null, null);
// facts --update
// should be called
// after overriding
// facts
clienttasks.autoheal(null, null, true, null, null, null, null);
for (SubscriptionPool AvailablePools : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
if (AvailablePools.productId.equals("awesomeos-x86_64")) {
clienttasks.subscribe(null, null, AvailablePools.poolId, null, null, "1", null, null, null, null, null, null, null);
}
}
InstalledProduct installedProduct = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", "100000000000002", clienttasks.getCurrentlyInstalledProducts());
for (ProductSubscription consumedProductSubscription : clienttasks.getCurrentlyConsumedProductSubscriptions()) {
if (consumedProductSubscription.provides.contains(installedProduct.productName)) {
Assert.assertTrue(!installedProduct.startDate.after(consumedProductSubscription.startDate), "Comparing Start Date '" + InstalledProduct.formatDateString(installedProduct.startDate) + "' of Installed Product '" + installedProduct.productName + "' to Start Date '" + InstalledProduct.formatDateString(consumedProductSubscription.startDate) + "' of Consumed Subscription '" + consumedProductSubscription.productName + "'. (Installed Product startDate should be <= Consumed Subscription startDate)");
}
}
clienttasks.autoheal(null, true, null, null, null, null, null);
clienttasks.restart_rhsmcertd(null, null, true);
InstalledProduct installedProductAfterRHSM = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", "100000000000002", clienttasks.getCurrentlyInstalledProducts());
for (ProductSubscription consumedProductSubscription : clienttasks.getCurrentlyConsumedProductSubscriptions()) {
if (consumedProductSubscription.provides.contains(installedProductAfterRHSM.productName)) {
Assert.assertTrue(!installedProductAfterRHSM.startDate.after(consumedProductSubscription.startDate), "Comparing Start Date '" + InstalledProduct.formatDateString(installedProductAfterRHSM.startDate) + "' of Installed Product '" + installedProductAfterRHSM.productName + "' to Start Date '" + InstalledProduct.formatDateString(consumedProductSubscription.startDate) + "' of Consumed Subscription '" + consumedProductSubscription.productName + "'. (Installed Product startDate should be <= Consumed Subscription startDate)");
if (!consumedProductSubscription.isActive) {
Assert.assertEquals(installedProductAfterRHSM.endDate, consumedProductSubscription.endDate);
}
}
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testConsumeVirtOnlyPool.
/**
* @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-21986", "RHEL7-51848" }, 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 if able to entitle consumer to the pool virt_only,pool_derived,bonus pool ", groups = { "Tier3Tests", "consumeVirtOnlyPool", "blockedByBug-756628" }, enabled = true)
public void testConsumeVirtOnlyPool() throws JSONException, Exception {
String isPool_derived = null;
Boolean virtonly = false;
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, (String) null, null, null, true, null, null, null, null, null);
String isGuest = clienttasks.getFactValue("virt.is_guest");
if (isGuest.equalsIgnoreCase("true")) {
Map<String, String> factsMap = new HashMap<String, String>();
factsMap.put("virt.is_guest", "False");
clienttasks.facts(null, true, null, null, null, null);
clienttasks.createFactsFileWithOverridingValues(factsMap);
for (SubscriptionPool availList : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
isPool_derived = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, availList.poolId, "pool_derived");
virtonly = CandlepinTasks.isPoolVirtOnly(sm_clientUsername, sm_clientPassword, availList.poolId, sm_serverUrl);
if (!(isPool_derived == null) || virtonly) {
String result = clienttasks.subscribe_(null, null, availList.poolId, null, null, null, null, null, null, null, null, null, null).getStdout();
String Expected = "Pool is restricted to virtual guests: " + availList.subscriptionName;
Assert.assertEquals(result.trim(), Expected);
}
}
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testSubscribeWithInvalidFileFromStdin.
/**
* @author redakkan
* @throws Exception
* JSON Exception
*/
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-47892", "RHEL7-96016" }, 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.NEGATIVE, importance = DefTypes.Importance.LOW, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "subscription-manager: verify subscribe with --file=invalid file from stdin is handled properly", groups = { "Tier3Tests", "blockedByBug-1350402", "testSubscribeWithInvalidFileFromStdin" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribeWithInvalidFileFromStdin() throws JSONException, Exception {
// commit 3167333fc3a261de939f4aa0799b4283f2b9f4d2 bug 1159974
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.13.8-1"))
throw new SkipException("The attach --file function was not implemented in this version of subscription-manager.");
// commit cda076cce4ac66d09eba31b64454d2780a6d1312 bug 1350402
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.20.1-1"))
throw new SkipException("The currently installed version (" + clienttasks.installedPackageVersionMap.get("subscription-manager") + ") is blocked by bug 1350402 which is fixed in subscription-manager-1.20.1-1 and newer.");
if (clienttasks.getCurrentlyRegisteredOwnerKey() == 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);
} else
clienttasks.unsubscribe_(true, (BigInteger) null, null, null, null, null, null);
String InvalidFile = "/tmp/invalid.txt";
/*About the bug : When stdout/stderr output of subscription-manager is redirected using pipe to some other process ... e.g. subscription-manager list --all --available --pool-only | subscription-manager subscribe --file=/tmp/invalid
and the second process does not read anything from stdout like in this case, then subscription-manager cannot write the buffer anywhere hence the command was terminated with some errors
The bug is reproducible only with stdin , hence passing the poolOnlyListCommand to pipe the out put
[root@ibm-x3250m3-01 ~]# subscription-manager list --all --available --pool-only | subscription-manager subscribe --file=/tmp/invalid
Error: The file "/tmp/invalid" does not exist or cannot be read.
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
*/
String poolOnlyListCommand = clienttasks.listCommand(true, true, null, null, null, null, null, null, null, true, null, null, null, null);
String stdinFileSubscribeCommand = clienttasks.subscribeCommand(null, null, (List<String>) null, (List<String>) null, null, null, null, null, InvalidFile, null, null, null, null);
SSHCommandResult stdinFileSubscribeCommandResult = client.runCommandAndWait(poolOnlyListCommand + "|" + stdinFileSubscribeCommand, (long) (3 * /*min*/
60 * 1000));
// Assert the additional error messages no longer appear
Assert.assertEquals(stdinFileSubscribeCommandResult.getStderr().trim(), "Error: The file \"/tmp/invalid.txt\" does not exist or cannot be read.");
if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.20.1-1")) {
// commit 79f86e4c043ee751677131ed4e3cf00affd13087
Assert.assertEquals(stdinFileSubscribeCommandResult.getExitCode(), Integer.valueOf(65), "Exit Code comparison between the expected result of subscribing using a list of poolids from stdin along with a invalid file.");
} else {
Assert.assertEquals(stdinFileSubscribeCommandResult.getExitCode(), Integer.valueOf(64), "Exit Code comparison between the expected result of subscribing using a list of poolids from stdin along with a invalid file.");
}
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testDeleteContentSourceFromProduct.
/**
* @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-21906", "RHEL7-51767" }, 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 that a content set can be deleted after being added to a product.", groups = { "Tier3Tests", "DeleteContentSourceFromProduct", "blockedByBug-687970", "blockedByBug-834125" }, enabled = true)
public void testDeleteContentSourceFromProduct() 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);
List<String> modifiedProductIds = null;
String contentId = "99999";
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("sockets", "8");
attributes.put("arch", "ALL");
JSONObject jsonContentResource;
String requestBody = CandlepinTasks.createContentRequestBody("fooname", contentId, "foolabel", "yum", "Foo Vendor", "/foo/path", "/foo/path/gpg", null, null, null, modifiedProductIds).toString();
String resourcePath = "/content/";
resourcePath = "/content/" + contentId;
String contentWithIdMessage = "Content with id " + contentId + " could not be found.";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.7"))
// commit
contentWithIdMessage = "Content with ID \"" + contentId + "\" could not be found.";
// 6b63e346c61789837211828043ad9576a756d0e8
resourcePath = "/content/" + contentId;
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
resourcePath = "/content/" + contentId;
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
jsonContentResource = new JSONObject(CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath));
Assert.assertEquals(jsonContentResource.getString("displayMessage"), contentWithIdMessage);
requestBody = CandlepinTasks.createContentRequestBody("fooname", contentId, "foolabel", "yum", "Foo Vendor", "/foo/path", "/foo/path/gpg", null, null, null, modifiedProductIds).toString();
resourcePath = "/content";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.postResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath, requestBody);
resourcePath = "/products/fooproduct";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, // in case it already exists from prior run
resourcePath);
CandlepinTasks.createProductUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, sm_clientOrg, "fooname", "fooproduct", null, attributes, null);
resourcePath = "/products/fooproduct/content/" + contentId;
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.postResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath + "?enabled=false", null);
resourcePath = "/products/" + "fooproduct";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
String jsonProduct = CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
Assert.assertContainsMatch(jsonProduct, contentId, "Added content set '" + contentId + "' to product " + "fooproduct");
resourcePath = "/content/" + contentId;
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
resourcePath = "/content/" + contentId;
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
jsonContentResource = new JSONObject(CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath));
/*
* This assertion is reinforcing a bug in candlepin. The prior call to
* delete content 99999 should always pass even when it has been added
* to a product. This was fixed by
* https://bugzilla.redhat.com/show_bug.cgi?id=834125#c17 Changing the
* assertion to Assert.assertContainsMatch
* Assert.assertContainsNoMatch(jsonActivationKey.toString(),
* contentWithIdMessage);
*/
Assert.assertEquals(jsonContentResource.getString("displayMessage"), contentWithIdMessage);
resourcePath = "/products/" + "fooproduct";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
jsonProduct = CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
Assert.assertContainsNoMatch(jsonProduct, contentId, "After deleting content set '" + contentId + "', it was removed from the product " + "fooproduct");
resourcePath = "/products/fooproduct";
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.0.0"))
resourcePath = "/owners/" + sm_clientOrg + resourcePath;
CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, resourcePath);
}
use of com.github.redhatqe.polarize.metadata.TestDefinition in project rhsm-qe by RedHatQE.
the class BugzillaTests method testRHELWorkstationSubscription.
/**
* @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 }, testCaseID = { "RHEL6-26777" }, 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 = /*TODO */
"please provide a description", groups = { "Tier3Tests", "VerifyRHELWorkstationSubscription", "blockedByBug-739790" }, enabled = true)
public void testRHELWorkstationSubscription() throws JSONException, Exception {
InstalledProduct workstation = InstalledProduct.findFirstInstanceWithMatchingFieldFromList("productId", "71", clienttasks.getCurrentlyInstalledProducts());
if (workstation == null)
throw new SkipException("This test is only applicable on a RHEL Workstation where product 71 is installed.");
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (List<String>) null, (String) null, null, null, true, false, null, null, null, null);
/*
* too time consuming; replace with
* subscribeToTheCurrentlyAvailableSubscriptionPoolsCollectively(); for
* (SubscriptionPool availList : clienttasks
* .getCurrentlyAvailableSubscriptionPools()) {
* clienttasks.subscribe_(null, null, availList.poolId, null, null,
* null, null, null, null, null, null); }
*/
clienttasks.subscribeToTheCurrentlyAvailableSubscriptionPoolsCollectively();
boolean assertedWorkstationProduct = false;
for (InstalledProduct installed : clienttasks.getCurrentlyInstalledProducts()) {
if (installed.productId.contains("Workstation")) {
Assert.assertEquals(installed.status, "subscribed");
assertedWorkstationProduct = true;
}
}
if (!assertedWorkstationProduct)
throw new SkipException("Installed product to be tested is not available");
}
Aggregations