use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class SubscribeTests method testMultiConsumerSubscribeWithQuantity.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36578", "RHEL7-51379" }, 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 = "subscription-manager: subscribe using --quantity option and assert the available quantity is properly decremented/incremeneted as multiple consumers subscribe/unsubscribe.", groups = { "Tier2Tests", "blockedByBug-979492" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testMultiConsumerSubscribeWithQuantity() throws NumberFormatException, JSONException, Exception {
// start by calling SubscribeWithQuantity_Test with the row from the dataProvider where quantity=2
SubscriptionPool consumer1Pool = null;
int consumer1Quantity = 0;
int totalPoolQuantity = 0;
for (List<Object> row : getSubscribeWithQuantityDataAsListOfLists()) {
// find the row where quantity.equals("2")
if (((String) (row.get(2)) != null) && ((String) (row.get(4)) != null)) {
if (((String) (row.get(2))).equals("2") && ((String) (row.get(4))).startsWith("^Successful")) {
consumer1Pool = (SubscriptionPool) row.get(1);
totalPoolQuantity = Integer.valueOf(consumer1Pool.quantity);
consumer1Quantity = Integer.valueOf((String) row.get(2));
testSubscribeWithQuantity(row.get(0), (SubscriptionPool) row.get(1), (String) row.get(2), (Integer) row.get(3), (String) row.get(4), (String) row.get(5));
break;
}
}
}
if (consumer1Pool == null)
Assert.fail("Failed to initiate the first consumer for this test.");
// remember the current consumerId
String consumer1Id = clienttasks.getCurrentConsumerId();
systemConsumerIds.add(consumer1Id);
// clean the client and register a second consumer
clienttasks.clean();
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, "SubscriptionQuantityConsumer2", null, null, null, null, (String) null, null, null, null, false, false, null, null, null, null);
// remember the second consumerId
String consumer2Id = clienttasks.getCurrentConsumerId();
systemConsumerIds.add(consumer2Id);
// find the pool among the available pools
SubscriptionPool consumer2Pool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", consumer1Pool.poolId, clienttasks.getCurrentlyAvailableSubscriptionPools());
Assert.assertNotNull(consumer2Pool, "Consumer2 found the same pool from which consumer1 subscribed a quantity of " + consumer1Quantity);
// assert that the quantity available to consumer2 is correct
int consumer2Quantity = totalPoolQuantity - consumer1Quantity;
Assert.assertEquals(consumer2Pool.quantity, String.valueOf(consumer2Quantity), "The pool quantity available to consumer2 has been decremented by the quantity consumer1 consumed.");
// assert that consumer2 can NOT oversubscribe
Assert.assertTrue(!clienttasks.subscribe(null, null, consumer2Pool.poolId, null, null, String.valueOf(consumer2Quantity + 1), null, null, null, null, null, null, null).getStdout().startsWith("Success"), "An attempt by consumer2 to oversubscribe using the remaining pool quantity+1 should NOT succeed.");
// assert that consumer2 can successfully consume all the remaining pool quantity
Assert.assertTrue(clienttasks.subscribe(null, null, consumer2Pool.poolId, null, null, String.valueOf(consumer2Quantity), null, null, null, null, null, null, null).getStdout().startsWith("Success"), "An attempt by consumer2 to exactly consume the remaining pool quantity should succeed.");
// start rolling back the subscribes
clienttasks.clean();
// restore consumer1, unsubscribe, and assert remaining quantities
clienttasks.register(sm_clientUsername, sm_clientPassword, null, null, null, null, consumer1Id, null, null, null, (String) null, null, null, null, false, false, null, null, null, null);
Assert.assertNull(SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", consumer1Pool.poolId, clienttasks.getCurrentlyAvailableSubscriptionPools()), "SubscriptionPool '" + consumer1Pool.poolId + "' should NOT be available (because consumer1 is already subscribed to it).");
clienttasks.unsubscribe(null, clienttasks.getCurrentlyConsumedProductSubscriptions().get(0).serialNumber, null, null, null, null, null);
consumer1Pool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", consumer1Pool.poolId, clienttasks.getCurrentlyAvailableSubscriptionPools());
Assert.assertEquals(consumer1Pool.quantity, String.valueOf(totalPoolQuantity - consumer2Quantity), "The pool quantity available to consumer1 has incremented by the quantity consumer1 consumed.");
clienttasks.unregister(null, null, null, null);
// restore consumer2, unsubscribe, and assert remaining quantities
clienttasks.register(sm_clientUsername, sm_clientPassword, null, null, null, null, consumer2Id, null, null, null, (String) null, null, null, null, false, false, null, null, null, null);
consumer2Pool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", consumer2Pool.poolId, clienttasks.getCurrentlyAvailableSubscriptionPools());
// Assert.assertNull(consumer2Pool,"SubscriptionPool '"+consumer2Pool.poolId+"' should NOT be available (because consumer2 is already subscribed to it).");
Assert.assertNotNull(consumer2Pool, "SubscriptionPool '" + consumer2Pool.poolId + "' should be available even though consumer2 is already subscribed to it because it is multi-entitleable.");
Assert.assertEquals(consumer2Pool.quantity, String.valueOf(totalPoolQuantity - consumer2Quantity), "The pool quantity available to consumer2 is still decremented by the quantity consumer2 consumed.");
clienttasks.unsubscribe(null, clienttasks.getCurrentlyConsumedProductSubscriptions().get(0).serialNumber, null, null, null, null, null);
consumer2Pool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", consumer2Pool.poolId, clienttasks.getCurrentlyAvailableSubscriptionPools());
Assert.assertEquals(consumer2Pool.quantity, String.valueOf(totalPoolQuantity), "The pool quantity available to consumer2 has been restored to its original total quantity");
clienttasks.unregister(null, null, null, null);
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class SubscribeTests method testSubscribeToFutureSubscriptionPool.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-27122", "RHEL7-51945" }, 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 = "subscription-manager: subscribe to future subscription pool", groups = { "Tier2Tests", "blockedByBug-979492", "blockedByBug-1440180" }, // dataProvider="getAllFutureSystemSubscriptionPoolsData", // 06/04/2014 takes too long; rarely reveals a bug
dataProvider = "getRandomSubsetOfFutureSystemSubscriptionPoolsData", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribeToFutureSubscriptionPool(SubscriptionPool pool) throws Exception {
// if (!pool.productId.equals("awesomeos-virt-unlmtd-phys")) throw new SkipException("debugTesting pool productId="+pool.productId);
Calendar now = new GregorianCalendar();
now.setTimeInMillis(System.currentTimeMillis());
// subscribe to the future subscription pool
SSHCommandResult subscribeResult = clienttasks.subscribe(null, null, pool.poolId, null, null, null, null, null, null, null, null, null, null);
// Pool is restricted to physical systems: '8a9086d3443c043501443c052aec1298'.
if (subscribeResult.getStdout().startsWith("Pool is restricted")) {
throw new SkipException("Subscribing to this future subscription is not applicable to this test: " + pool);
}
// assert that the granted entitlement cert begins in the future
EntitlementCert entitlementCert = clienttasks.getEntitlementCertCorrespondingToSubscribedPool(pool);
Assert.assertNotNull(entitlementCert, "Found the newly granted EntitlementCert on the client after subscribing to future subscription pool '" + pool.poolId + "'.");
Assert.assertTrue(entitlementCert.validityNotBefore.after(now), "The newly granted EntitlementCert is not valid until the future. EntitlementCert: " + entitlementCert);
Assert.assertTrue(entitlementCert.orderNamespace.startDate.after(now), "The newly granted EntitlementCert's OrderNamespace starts in the future. OrderNamespace: " + entitlementCert.orderNamespace);
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class SubscribeTests method testSubscribeWithQuantityToMultiplePools.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36585", "RHEL7-51388" }, 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 = "subscription-manager: subscribe to multiple pools using --quantity that exceeds some pools and is under other pools.", groups = { "Tier2Tests", "blockedByBug-722975" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribeWithQuantityToMultiplePools() throws JSONException, Exception {
// is this system virtual
boolean isSystemVirtual = Boolean.valueOf(clienttasks.getFactValue("virt.is_guest"));
// register
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);
// get all the available pools
List<SubscriptionPool> pools = clienttasks.getCurrentlyAllAvailableSubscriptionPools();
List<String> poolIds = new ArrayList<String>();
// find the poolIds and their quantities
List<Integer> quantities = new ArrayList<Integer>();
for (SubscriptionPool pool : pools) {
poolIds.add(pool.poolId);
// ignore "unlimited" pools
try {
Integer.valueOf(pool.quantity);
} catch (NumberFormatException e) {
continue;
}
quantities.add(Integer.valueOf(pool.quantity));
}
Collections.sort(quantities);
// choose the median as the quantity to subscribe with
int quantity = quantities.get(quantities.size() / 2);
// collectively subscribe to all pools with --quantity
SSHCommandResult subscribeResult = clienttasks.subscribe_(null, null, poolIds, null, null, String.valueOf(quantity), null, null, null, null, null, null, null);
/*
Multi-entitlement not supported for pool with id '8a90f8c6320e9a4401320e9be0e20480'.
Successfully subscribed the system to Pool 8a90f8c6320e9a4401320e9be196049e
No free entitlements are available for the pool with id '8a90f8c6320e9a4401320e9be1d404a8'.
Multi-entitlement not supported for pool with id '8a90f8c6320e9a4401320e9be24004be'.
Successfully subscribed the system to Pool 8a90f8c6320e9a4401320e9be2e304dd
No free entitlements are available for the pool with id '8a90f8c6320e9a4401320e9be30c04e8'.
Multi-entitlement not supported for pool with id '8a90f8c6320e9a4401320e9be3b80505'.
Multi-entitlement not supported for pool with id '8a90f8c6320e9a4401320e9be4660520'.
Pool is restricted to physical systems: '8a9086d34470376901447038624d0f87'.
Pool is restricted to virtual guests: '8a9086d344549b0c0144549bf9ae0dd4'.
*/
// assert that the expected pools were subscribed to based on quantity
Assert.assertEquals(subscribeResult.getExitCode(), Integer.valueOf(0), "The exit code from the subscribe command indicates a success.");
String expectedSubscribeResultStdoutSubString = null;
for (SubscriptionPool pool : pools) {
if (quantity > 1 && !CandlepinTasks.isPoolProductMultiEntitlement(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
expectedSubscribeResultStdoutSubString = String.format("Multi-entitlement not supported for pool with id '%s'.", pool.poolId);
if (!clienttasks.workaroundForBug876764(sm_serverType))
expectedSubscribeResultStdoutSubString = String.format("Multi-entitlement not supported for pool with ID '%s'.", pool.poolId);
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.3.1-1")) {
// commit 0d5fefcfa8c1c2485921d2dee6633879b1e06931 Correct incorrect punctuation in user messages
expectedSubscribeResultStdoutSubString = String.format("Multi-entitlement not supported for pool with ID \"%s\".", pool.poolId);
}
Assert.assertTrue(subscribeResult.getStdout().contains(expectedSubscribeResultStdoutSubString), "Subscribe attempt to non-multi-entitlement pool '" + pool.poolId + "' was NOT successful when subscribing with --quantity greater than one.");
} else if (isSystemVirtual && CandlepinTasks.isPoolRestrictedToPhysicalSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
// Note: the "Multi-entitlement not supported" restriction is thrown before "Pool is restricted to physical systems"
expectedSubscribeResultStdoutSubString = String.format("Pool is restricted to physical systems: '%s'.", pool.poolId);
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.3.1-1")) {
// commit 0d5fefcfa8c1c2485921d2dee6633879b1e06931 Correct incorrect punctuation in user messages
expectedSubscribeResultStdoutSubString = String.format("Pool is restricted to physical systems: \"%s\".", pool.poolId);
}
Assert.assertTrue(subscribeResult.getStdout().contains(expectedSubscribeResultStdoutSubString), "Subscribe attempt to physical_only pool '" + pool.poolId + "' was NOT successful when system is virtual.");
} else if (!isSystemVirtual && CandlepinTasks.isPoolRestrictedToVirtualSystems(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId)) {
// Note: the "Multi-entitlement not supported" restriction is thrown before "Pool is restricted to virtual systems"
expectedSubscribeResultStdoutSubString = String.format("Pool is restricted to virtual guests: '%s'.", pool.poolId);
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.3.1-1")) {
// commit 0d5fefcfa8c1c2485921d2dee6633879b1e06931 Correct incorrect punctuation in user messages
expectedSubscribeResultStdoutSubString = String.format("Pool is restricted to virtual guests: \"%s\".", pool.poolId);
}
Assert.assertTrue(subscribeResult.getStdout().contains(expectedSubscribeResultStdoutSubString), "Subscribe attempt to virt_only pool '" + pool.poolId + "' was NOT successful when system is physical.");
} else if (pool.quantity.equalsIgnoreCase("unlimited") || quantity <= Integer.valueOf(pool.quantity)) {
// Assert.assertTrue(subscribeResult.getStdout().contains(String.format("Successfully consumed a subscription from the pool with id %s.",pool.poolId)),"Subscribe to pool '"+pool.poolId+"' was successful when subscribing with --quantity less than or equal to the pool's availability."); // Bug 812410 - Subscription-manager subscribe CLI feedback
// Assert.assertTrue(subscribeResult.getStdout().contains(String.format("Successfully consumed a subscription for: %s",pool.subscriptionName)),"Subscribe to pool '"+pool.poolId+"' was successful when subscribing with --quantity less than or equal to the pool's availability."); // changed by Bug 874804 Subscribe -> Attach
Assert.assertTrue(subscribeResult.getStdout().contains(String.format("Successfully attached a subscription for: %s", pool.subscriptionName)), "Subscribe to pool '" + pool.poolId + "' was successful when subscribing with --quantity less than or equal to the pool's availability.");
} else {
// expected string changed by bug 876758
expectedSubscribeResultStdoutSubString = String.format("No entitlements are available from the pool with id '%s'.", pool.poolId);
expectedSubscribeResultStdoutSubString = String.format("No subscriptions are available from the pool with id '%s'.", pool.poolId);
if (!clienttasks.workaroundForBug876764(sm_serverType))
expectedSubscribeResultStdoutSubString = String.format("No subscriptions are available from the pool with ID '%s'.", pool.poolId);
if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.3.1-1")) {
// commit 0d5fefcfa8c1c2485921d2dee6633879b1e06931 Correct incorrect punctuation in user messages
expectedSubscribeResultStdoutSubString = String.format("No subscriptions are available from the pool with ID \"%s\".", pool.poolId);
}
Assert.assertTrue(subscribeResult.getStdout().contains(expectedSubscribeResultStdoutSubString), "Subscribe to pool '" + pool.poolId + "' was NOT successful when subscribing with --quantity greater than the pool's availability.");
}
}
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class SubscribeTests method testSubscribeWithQuantity.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-19981", "RHEL7-33098" }, 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 = "subscription-manager: subscribe using various good and bad values for the --quantity option", groups = { "Tier1Tests", "blockedByBug-962520" }, dataProvider = "getSubscribeWithQuantityData", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribeWithQuantity(Object meta, SubscriptionPool pool, String quantity, Integer expectedExitCode, String expectedStdoutRegex, String expectedStderrRegex) {
log.info("Testing subscription-manager subscribe using various good and bad values for the --quantity option.");
// special case in the dataProvider to identify when a test pool was not available; expectedStderrRegex contains a message for what kind of test pool was being searched for.
if (pool == null)
throw new SkipException(expectedStderrRegex);
// start fresh by returning all entitlements
clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
// for debugging purposes, list what is currently available so we can see the available quantity before we attempt to attach
clienttasks.list_(null, true, null, null, null, null, null, null, null, null, null, null, null, null);
// subscribe with quantity
SSHCommandResult sshCommandResult = clienttasks.subscribe_(null, null, pool.poolId, null, null, quantity, null, null, null, null, null, null, null);
// assert the sshCommandResult here
if (expectedExitCode != null)
Assert.assertEquals(sshCommandResult.getExitCode(), expectedExitCode, "ExitCode after subscribe with quantity=\"" + quantity + "\" option:");
if (expectedStdoutRegex != null)
Assert.assertContainsMatch(sshCommandResult.getStdout().trim(), expectedStdoutRegex, "Stdout after subscribe with --quantity=\"" + quantity + "\" option:");
if (expectedStderrRegex != null)
Assert.assertContainsMatch(sshCommandResult.getStderr().trim(), expectedStderrRegex, "Stderr after subscribe with --quantity=\"" + quantity + "\" option:");
// when successful, assert that the quantity is correctly reported in the list of consumed subscriptions
List<ProductSubscription> subscriptionsConsumed = client1tasks.getCurrentlyConsumedProductSubscriptions();
List<EntitlementCert> entitlementCerts = client1tasks.getCurrentEntitlementCerts();
if (expectedExitCode == 0 && expectedStdoutRegex != null && expectedStdoutRegex.contains("Successful")) {
Assert.assertEquals(entitlementCerts.size(), 1, "One EntitlementCert should have been downloaded to " + client1tasks.hostname + " when the attempt to subscribe is successful.");
Assert.assertEquals(entitlementCerts.get(0).orderNamespace.quantityUsed, quantity.replaceFirst("^\\+", ""), "The quantityUsed in the OrderNamespace of the downloaded EntitlementCert should match the quantity requested when we subscribed to pool '" + pool.poolId + "'. OrderNamespace: " + entitlementCerts.get(0).orderNamespace);
for (ProductSubscription productSubscription : subscriptionsConsumed) {
Assert.assertEquals(productSubscription.quantityUsed, Integer.valueOf(quantity.replaceFirst("^\\+", "")), "The quantityUsed reported in each consumed ProductSubscription should match the quantity requested when we subscribed to pool '" + pool.poolId + "'. ProductSubscription: " + productSubscription);
}
} else {
Assert.assertEquals(subscriptionsConsumed.size(), 0, "No subscriptions should be consumed when the attempt to subscribe is not successful.");
}
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class SubscribeTests method testSubscribeWithAutoMoreThanOnce.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36580", "RHEL7-51382" }, 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 = "subscription-manager: autosubscribe consumer more than once and verify we are not duplicately subscribed", groups = { "Tier2Tests", "blockedByBug-723044", "blockedByBug-743082", "blockedByBug-977321" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribeWithAutoMoreThanOnce() throws Exception {
// before testing, make sure all the expected subscriptionPoolProductId are available
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);
// TEMPORARY WORKAROUND
if (Boolean.valueOf(clienttasks.getFactValue("virt.is_guest"))) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1198494 - Auto-heal continuously attaches subscriptions to make the system compliant on a guest machine
String bugId = "1198494";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
clienttasks.mapSystemAsAGuestOfItself();
}
}
// END OF WORKAROUND
// autosubscribe once
SSHCommandResult result1 = clienttasks.subscribe(Boolean.TRUE, null, (String) null, null, null, null, null, null, null, null, null, null, null);
List<File> entitlementCertFiles1 = clienttasks.getCurrentEntitlementCertFiles();
List<InstalledProduct> autosubscribedProductStatusList1 = InstalledProduct.parse(result1.getStdout());
// autosubscribe twice
SSHCommandResult result2 = clienttasks.subscribe(Boolean.TRUE, null, (String) null, null, null, null, null, null, null, null, null, null, null);
List<File> entitlementCertFiles2 = clienttasks.getCurrentEntitlementCertFiles();
List<InstalledProduct> autosubscribedProductStatusList2 = InstalledProduct.parse(result2.getStdout());
// assert results
Assert.assertEquals(entitlementCertFiles2.size(), entitlementCertFiles1.size(), "The number of granted entitlement certs is the same after a second autosubscribe.");
Assert.assertEquals(autosubscribedProductStatusList2.size(), autosubscribedProductStatusList1.size(), "The stdout from autosubscribe reports the same number of installed product status entries after a second autosubscribe.");
Assert.assertTrue(autosubscribedProductStatusList1.containsAll(autosubscribedProductStatusList2), "The list of installed product status entries from a second autosubscribe is the same as the first.");
}
Aggregations