use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.
the class BugzillaTests method listFutureSubscription_OnDate.
protected List<String> listFutureSubscription_OnDate(Boolean available, String ondate) {
List<String> PoolId = new ArrayList<String>();
SSHCommandResult result = clienttasks.list_(true, true, null, null, null, ondate, null, null, null, null, null, null, null, null);
List<SubscriptionPool> Pool = SubscriptionPool.parse(result.getStdout());
for (SubscriptionPool availablePool : Pool) {
if (availablePool.multiEntitlement) {
PoolId.add(availablePool.poolId);
}
}
return PoolId;
}
use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.
the class BugzillaTests method testEntitlementStartDate.
/**
* @author skallesh
* @throws Exception
*/
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21946", "RHEL7-51808" }, 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 Entitlement Start Dates is the Subscription Start Date", groups = { "Tier3Tests", "VerifyEntitlementStartDate_Test", "blockedByBug-670831" }, enabled = true)
public void testEntitlementStartDate() throws JSONException, Exception {
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);
for (SubscriptionPool pool : getRandomSubsetOfList(clienttasks.getCurrentlyAvailableSubscriptionPools(), 5)) {
JSONObject jsonPool = new JSONObject(CandlepinTasks.getResourceUsingRESTfulAPI(sm_clientUsername, sm_clientPassword, sm_serverUrl, "/pools/" + pool.poolId));
Calendar subStartDate = parseISO8601DateString(jsonPool.getString("startDate"), "GMT");
EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(clienttasks.subscribeToSubscriptionPool_(pool));
Calendar entStartDate = entitlementCert.validityNotBefore;
Assert.assertTrue(entStartDate.compareTo(subStartDate) == 0, "" + "The entitlement start date granted from pool '" + pool.poolId + "' (" + pool.productId + ") in '" + entitlementCert.file + "', '" + OrderNamespace.formatDateString(entStartDate) + "', " + "should match json start date '" + jsonPool.getString("startDate") + "' of the subscription pool it came from.");
}
}
use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.
the class BugzillaTests method testAutohealForPartialSubscription.
/**
* @author skallesh
* @throws JSONException
* @throws Exception
*/
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21936", "RHEL7-51798" }, 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 = "Auto-heal for partial subscription", groups = { "Tier3Tests", "autohealPartial", "blockedByBug-746218", "blockedByBug-907638", "blockedByBug-907400" }, enabled = true)
public void testAutohealForPartialSubscription() throws Exception {
Integer moreSockets = 0;
List<String> productIds = new ArrayList<String>();
List<String> poolId = new ArrayList<String>();
Map<String, String> factsMap = new HashMap<String, String>();
factsMap.put("virt.is_guest", Boolean.FALSE.toString());
clienttasks.createFactsFileWithOverridingValues(factsMap);
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);
// disable
clienttasks.autoheal(null, null, true, null, null, null, null);
// autoheal
for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
if (CandlepinTasks.isPoolProductMultiEntitlement(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
String poolProductSocketsAttribute = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId, "stacking_id");
if ((!(poolProductSocketsAttribute == null)) && (poolProductSocketsAttribute.equals("1"))) {
String SocketsCount = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId, "sockets");
poolId.add(pool.poolId);
moreSockets += Integer.valueOf(SocketsCount);
productIds.addAll(CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId));
}
}
}
if (moreSockets == 0)
throw new SkipException("Expected to find a sockets based multi-entitlement pool with stacking_id 1 for this test.");
factsMap.put("cpu.cpu_socket(s)", String.valueOf((++moreSockets) + Integer.valueOf(clienttasks.sockets)));
clienttasks.createFactsFileWithOverridingValues(factsMap);
clienttasks.facts(null, true, null, null, null, null);
for (InstalledProduct installedProduct : clienttasks.getCurrentlyInstalledProducts()) {
if (productIds.contains(installedProduct.productId)) {
Assert.assertEquals(installedProduct.status, "Partially Subscribed");
}
}
Assert.assertTrue(!productIds.isEmpty(), "Found installed products that are partially subscribed after adding " + moreSockets + " more cpu.cpu_socket(s).");
// enable
clienttasks.autoheal(null, true, null, null, null, null, null);
// autoheal
// trigger autoheal
clienttasks.run_rhsmcertd_worker(true);
for (InstalledProduct installedProduct : clienttasks.getCurrentlyInstalledProducts()) {
for (String productId : productIds) {
if (productId.equals(installedProduct.productId))
Assert.assertEquals(installedProduct.status, "Subscribed", "Status of installed product '" + installedProduct.productName + "' after auto-healing.");
}
}
}
use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.
the class BugzillaTests method getPackageFromEnabledRepoAndSubscriptionPoolDataAsListOfLists.
protected List<List<Object>> getPackageFromEnabledRepoAndSubscriptionPoolDataAsListOfLists() throws JSONException, Exception {
List<List<Object>> ll = new ArrayList<List<Object>>();
if (!isSetupBeforeSuiteComplete)
return ll;
if (clienttasks == null)
return ll;
if (sm_clientUsername == null)
return ll;
if (sm_clientPassword == null)
return ll;
// get the currently installed product certs to be used when checking
// for conditional content tagging
List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
// assure we are freshly registered and process all available
// subscription pools
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, ConsumerType.system, null, null, null, null, null, (String) null, null, null, null, Boolean.TRUE, false, null, null, null, null);
for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
File entitlementCertFile = clienttasks.subscribeToSubscriptionPool(pool, sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
Assert.assertNotNull(entitlementCertFile, "Found the entitlement cert file that was granted after subscribing to pool: " + pool);
EntitlementCert entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
if (!contentNamespace.type.equalsIgnoreCase("yum"))
continue;
if (contentNamespace.enabled && clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts)) {
String repoLabel = contentNamespace.label;
// find an available package that is uniquely provided by
// repo
String pkg = clienttasks.findUniqueAvailablePackageFromRepo(repoLabel);
if (pkg == null) {
log.warning("Could NOT find a unique available package from repo '" + repoLabel + "' after subscribing to SubscriptionPool: " + pool);
}
ll.add(Arrays.asList(new Object[] { pkg, repoLabel, pool }));
}
}
clienttasks.unsubscribeFromSerialNumber(clienttasks.getSerialNumberFromEntitlementCertFile(entitlementCertFile));
// testcase development)
if (Boolean.valueOf(getProperty("sm.debug.dataProviders.minimize", "false")))
break;
}
return ll;
}
use of rhsm.data.SubscriptionPool in project rhsm-qe by RedHatQE.
the class BugzillaTests method testSubscribingToBogusPoolID.
/**
* @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-21973", "RHEL7-51835" }, 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 entitlement certs are downloaded if subscribed using bogus poolid", groups = { "Tier3Tests", "VerifySubscribingTobogusPoolID" }, enabled = true)
@ImplementsNitrateTest(caseId = 50223)
public void testSubscribingToBogusPoolID() throws JSONException, Exception {
String poolId = 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);
List<String[]> listOfSectionNameValues = new ArrayList<String[]>();
listOfSectionNameValues.add(new String[] { "rhsmcertd", "autoAttachInterval".toLowerCase(), "1440" });
clienttasks.config(null, null, true, listOfSectionNameValues);
clienttasks.unsubscribe(true, (BigInteger) null, null, null, null, null, null);
for (SubscriptionPool availList : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
poolId = availList.poolId;
}
String pool = randomizeCaseOfCharactersInString(poolId);
clienttasks.subscribe_(null, null, pool, null, null, null, null, null, null, null, null, null, null);
List<File> Cert = clienttasks.getCurrentEntitlementCertFiles();
Assert.assertEquals(Cert.size(), 0);
}
Aggregations