use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class ListTests method testListAllAvailableWithMatchInstalled.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36553", "RHEL7-51330" }, 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: subcription manager list all with --match-installed option", groups = { "Tier2Tests", "blockedByBug-654501", "blockedByBug-1493711" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testListAllAvailableWithMatchInstalled() throws JSONException, Exception {
clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, null, null, null, (String) null, null, null, null, false, null, null, null, null, null);
clienttasks.autoheal(null, null, true, null, null, null, null);
// assemble a list of currently installed product ids
List<ProductCert> installedProductCerts = clienttasks.getCurrentProductCerts();
List<String> installedProductIds = new ArrayList<String>();
for (ProductCert productCert : installedProductCerts) installedProductIds.add(productCert.productId);
// get all the available subscription pools
List<SubscriptionPool> allAvailableSubscriptionPools = SubscriptionPool.parse(clienttasks.list(true, true, null, null, null, null, false, null, null, null, null, null, null, null).getStdout());
List<SubscriptionPool> allAvailableSubscriptionPoolsMatchingInstalled = SubscriptionPool.parse(clienttasks.list(true, true, null, null, null, null, true, null, null, null, null, null, null, null).getStdout());
// loop through the list of all available subscription pools with match-installed and assert they really do provide at least one product that is installed.
for (SubscriptionPool subscriptionPool : allAvailableSubscriptionPoolsMatchingInstalled) {
ProductCert matchedInstalledProductCert = null;
for (String providedProductId : CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, subscriptionPool.poolId)) {
matchedInstalledProductCert = ProductCert.findFirstInstanceWithMatchingFieldFromList("productId", providedProductId, installedProductCerts);
if (matchedInstalledProductCert != null)
break;
}
if (matchedInstalledProductCert != null)
Assert.assertTrue(matchedInstalledProductCert != null, "Available subscription pool '" + subscriptionPool.subscriptionName + "' provides=" + subscriptionPool.provides + " includes product id '" + matchedInstalledProductCert.productId + "' which was found among the product ids of the currently installed product certs. " + installedProductIds);
else
Assert.fail("Subscription-manager list all available with match-installed option erroneously reported SubscriptionPool '" + subscriptionPool.subscriptionName + "' provides=" + subscriptionPool.provides + " which does NOT provide a product whose id was found among the currently installed product certs. " + installedProductIds);
}
// loop through the list of all available subscription without match-installed and make sure those that provide an installed product id are included in the filtered list
for (SubscriptionPool subscriptionPool : allAvailableSubscriptionPools) {
boolean providesAnInstalledProductId = false;
for (String providedProductId : CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, subscriptionPool.poolId)) {
if (installedProductIds.contains(providedProductId))
providesAnInstalledProductId = true;
}
if (providesAnInstalledProductId)
Assert.assertTrue(allAvailableSubscriptionPoolsMatchingInstalled.contains(subscriptionPool), "The list of all available subscriptions with match-installed option includes '" + subscriptionPool.subscriptionName + "' provides=" + subscriptionPool.provides);
else
Assert.assertTrue(!allAvailableSubscriptionPoolsMatchingInstalled.contains(subscriptionPool), "The list of all available subscriptions with match-installed option does NOT include '" + subscriptionPool.subscriptionName + "' provides=" + subscriptionPool.provides);
}
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class MigrationDataTests method testChannelCertMapping.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20100", "RHEL7-51107" }, 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 Tier2 Tier3")
@Test(description = "Verify that the channel-cert-mapping.txt contains a unique map of channels to product certs", groups = { "Tier1Tests", "Tier2Tests", "Tier3Tests" }, dependsOnMethods = { "testChannelCertMappingFileExists" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testChannelCertMapping() throws FileNotFoundException, IOException {
Assert.assertTrue(RemoteFileTasks.testExists(client, channelCertMappingFilename), "The expected channel cert mapping file '" + channelCertMappingFilename + "' exists.");
// Read the channelCertMappingFilename as if they were properties (Warning! this will mask non-unique mappings)
// [root@jsefler-onprem-5client ~]# cat /usr/share/rhsm/product/RHEL-5/channel-cert-mapping.txt
// rhn-tools-rhel-x86_64-server-5-beta: none
// rhn-tools-rhel-x86_64-server-5: Server-Server-x86_64-fbe6b460-a559-4b02-aa3a-3e580ea866b2-69.pem
// rhn-tools-rhel-x86_64-client-5-beta: none
// rhn-tools-rhel-x86_64-client-5: Client-Client-x86_64-efe91c1c-78d7-4d19-b2fb-3c88cfc2da35-68.pem
SSHCommandResult result = client.runCommandAndWait("cat " + channelCertMappingFilename);
Properties p = new Properties();
p.load(new ByteArrayInputStream(result.getStdout().getBytes("UTF-8")));
for (Object key : p.keySet()) {
// load the channelsToProductCertFilesMap
channelsToProductCertFilenamesMap.put((String) key, p.getProperty((String) (key)));
// load the mappedProductCertFiles
if (!channelsToProductCertFilenamesMap.get(key).equalsIgnoreCase("none"))
mappedProductCertFilenames.add(channelsToProductCertFilenamesMap.get(key));
}
// Read the channelCertMappingFilename line by line asserting unique mappings
boolean uniqueChannelsToProductCertFilenamesMap = true;
for (String line : result.getStdout().trim().split("\\n")) {
// skip blank lines
if (line.trim().equals(""))
continue;
// skip comments
if (line.trim().startsWith("#"))
continue;
String channel = line.split(":")[0].trim();
String productCertFilename = line.split(":")[1].trim();
if (channelsToProductCertFilenamesMap.containsKey(channel)) {
if (!channelsToProductCertFilenamesMap.get(channel).equals(productCertFilename)) {
log.warning("RHN Channel '" + channel + "' is already mapped to productFilename '" + productCertFilename + "' while parsing " + channelCertMappingFilename + " line: " + line);
uniqueChannelsToProductCertFilenamesMap = false;
}
} else {
Assert.fail("Having trouble parsing the following channel:product map from " + channelCertMappingFilename + ": " + line);
}
}
Assert.assertTrue(uniqueChannelsToProductCertFilenamesMap, "Each channel in " + channelCertMappingFilename + " maps to a unique product cert filename. (See above warnings for offenders.)");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class MigrationDataTests method testAllExistingProductCertFilesAreMapped.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20102", "RHEL7-51109" }, 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 = "Verify that all existing product cert files are mapped in channel-cert-mapping.txt", groups = { "Tier1Tests", "blockedByBug-799103", "blockedByBug-849274", "blockedByBug-909436", "blockedByBug-1025338" }, dependsOnMethods = { "testChannelCertMapping" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testAllExistingProductCertFilesAreMapped() {
// get a list of all the existing product cert files
SSHCommandResult result = client.runCommandAndWait("ls " + baseProductsDir + "/*.pem");
Assert.assertEquals(result.getExitCode(), new Integer(0), "Exit code from a list of all migration data product certs.");
List<String> existingProductCertFiles = Arrays.asList(result.getStdout().split("\\n"));
boolean allExitingProductCertFilesAreMapped = true;
for (String existingProductCertFile : existingProductCertFiles) {
if (mappedProductCertFilenames.contains(new File(existingProductCertFile).getName())) {
log.info("Existing productCert file '" + existingProductCertFile + "' is mapped in '" + channelCertMappingFilename + "'.");
} else {
log.warning("Existing productCert file '" + existingProductCertFile + "' is NOT mapped in '" + channelCertMappingFilename + "'.");
/* Notes: http://entitlement.etherpad.corp.redhat.com/Entitlement02MAY12
/product_ids/rhel-6.3/ComputeNode-ScalableFileSystem-x86_64-21b36280d242-175.pem is not mapped to any RHN Channels in /cdn/product-baseline.json (SEEMS WRONG)
(dgregor) channel won't exist until 6.3 GA. suggest we pick this up in 6.4
(jsefler) TODO update automated test with pre-6.3GA work-around
/product_ids/rhel-6.3/Server-HPN-ppc64-fff6dded9725-173.pem is not mapped to any RHN Channels in /cdn/product-baseline.json (SEEMS WRONG)
(dgregor) channel won't exist until 6.3 GA. suggest we pick this up in 6.4
(jsefler) TODO update automated test with pre-6.3GA work-around
*/
if (existingProductCertFile.endsWith("-173.pem") && clienttasks.redhatReleaseXY.equals("6.3")) {
log.warning("Ignoring that existing productCert file '" + existingProductCertFile + "' is NOT mapped in '" + channelCertMappingFilename + "' until release 6.4 as recommended by dgregor.");
} else if (existingProductCertFile.endsWith("-175.pem") && clienttasks.redhatReleaseXY.equals("6.3")) {
log.warning("Ignoring that existing productCert file '" + existingProductCertFile + "' is NOT mapped in '" + channelCertMappingFilename + "' until release 6.4 as recommended by dgregor.");
} else
// END OF WORKAROUND
allExitingProductCertFilesAreMapped = false;
}
}
Assert.assertTrue(allExitingProductCertFilesAreMapped, "All of the existing productCert files in directory '" + baseProductsDir + "' are mapped to a channel in '" + channelCertMappingFilename + "'.");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class MigrationDataTests method testRHEL4ChannelMappings.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20101", "RHEL7-51108" }, 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 RHEL4 channel mappings exist in channel-cert-mapping.txt", groups = { "Tier3Tests", "blockedByBug-1009932", "blockedByBug-1025338", "blockedByBug-1080072", "blockedByBug-1100872" }, dependsOnMethods = { "testChannelCertMappingFileExists" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testRHEL4ChannelMappings() {
// hand assemble a list of expected RHEL4 channels
// [root@jsefler-6 ~]# egrep 'rhel-.*-4(:|-.*:|\.[[:digit:]]\.z:)' /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt | egrep --invert-match '(-ost-4|-4-els|-4-hwcert)'
// rhel-i386-as-4: AS-AS-i386-002dbe5bbca3-69.pem
List<String> expectedRhel4Channels = Arrays.asList(new String[] { "rhel-i386-as-4", // "rhel-i386-as-4-hwcert", // Name: Red Hat Hardware Certification Test Suite
"rhel-i386-as-4.5.z", "rhel-i386-as-4.6.z", "rhel-i386-as-4.7.z", "rhel-i386-as-4.8.z", "rhel-i386-es-4", "rhel-i386-es-4.5.z", "rhel-i386-es-4.6.z", "rhel-i386-es-4.7.z", "rhel-i386-es-4.8.z", "rhel-i386-ws-4", // added by subscription-manager-migration-data-2.0.10-1.el5
"rhel-i386-ws-4-beta", "rhel-ia64-as-4", // "rhel-ia64-as-4-hwcert",
"rhel-ia64-as-4.5.z", "rhel-ia64-as-4.6.z", "rhel-ia64-as-4.7.z", "rhel-ia64-as-4.8.z", "rhel-ia64-es-4", // added by subscription-manager-migration-data-2.0.10-1.el5
"rhel-ia64-ws-4-beta", "rhel-ia64-es-4.5.z", "rhel-ia64-es-4.6.z", "rhel-ia64-es-4.7.z", "rhel-ia64-es-4.8.z", "rhel-ia64-ws-4", "rhel-ppc-as-4", "rhel-ppc-as-4.5.z", "rhel-ppc-as-4.6.z", "rhel-ppc-as-4.7.z", "rhel-ppc-as-4.8.z", "rhel-s390-as-4", "rhel-s390-as-4.5.z", "rhel-s390-as-4.6.z", "rhel-s390-as-4.7.z", "rhel-s390-as-4.8.z", "rhel-s390x-as-4", "rhel-s390x-as-4.5.z", "rhel-s390x-as-4.6.z", "rhel-s390x-as-4.7.z", "rhel-s390x-as-4.8.z", "rhel-x86_64-as-4", // "rhel-x86_64-as-4-hwcert",
"rhel-x86_64-as-4.5.z", "rhel-x86_64-as-4.6.z", "rhel-x86_64-as-4.7.z", "rhel-x86_64-as-4.8.z", "rhel-x86_64-es-4", "rhel-x86_64-es-4.5.z", "rhel-x86_64-es-4.6.z", "rhel-x86_64-es-4.7.z", "rhel-x86_64-es-4.8.z", // "rhel-x86_64-server-6-ost-4-debuginfo",
"rhel-x86_64-ws-4", // added by subscription-manager-migration-data-2.0.10-1.el5
"rhel-x86_64-ws-4-beta" });
// use a regex and grep to detect actual RHEL4 channel mappings
List<String> actualRhel4Channels = new ArrayList<String>();
SSHCommandResult result = client.runCommandAndWait("egrep 'rhel-.*-4(:|-.*:|\\.[[:digit:]]\\.z:)' " + channelCertMappingFilename + " | egrep --invert-match '(-ost-4|-4-els|-4-hwcert)'");
for (String line : result.getStdout().trim().split("\\n")) {
// skip blank lines
if (line.trim().equals(""))
continue;
// skip comments
if (line.trim().startsWith("#"))
continue;
String channel = line.split(":")[0].trim();
String productCertFilename = line.split(":")[1].trim();
actualRhel4Channels.add(channel);
}
boolean allExpectedRhel4ChannelsAreMapped = true;
for (String channel : expectedRhel4Channels) {
if (actualRhel4Channels.contains(channel)) {
Assert.assertTrue(actualRhel4Channels.contains(channel), "Expected RHEL4 channel '" + channel + "' was found in channel cert mapping file '" + channelCertMappingFilename + "'.");
} else {
log.warning("Expected RHEL4 channel '" + channel + "' was not found in channel cert mapping file '" + channelCertMappingFilename + "'.");
allExpectedRhel4ChannelsAreMapped = false;
}
}
boolean allActualRhel4ChannelsMappedAreExpected = true;
for (String channel : actualRhel4Channels) {
if (!expectedRhel4Channels.contains(channel)) {
log.warning("Actual RHEL4 channel '" + channel + "' in channel cert mapping file '" + channelCertMappingFilename + "' that was not expected. This automated test may need an update.");
allActualRhel4ChannelsMappedAreExpected = false;
}
}
Assert.assertTrue(allExpectedRhel4ChannelsAreMapped, "All expected RHEL4 channels are mapped in '" + channelCertMappingFilename + "'. (See above warnings for offenders.)");
Assert.assertTrue(allActualRhel4ChannelsMappedAreExpected, "All actual RHEL4 channels mapped in '" + channelCertMappingFilename + "' are expected. (See above warnings for offenders.)");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class RHELPersonalTests method testEntitlementCertForSubPoolIsNotRevokedOnceAnotherSystemUnsubscribesFromSubPool.
// DUE TO BEHAVIOR CHNAGE, THIS TEST WAS REPLACED BY EnsurePersonCannotUnsubscribeWhileSubpoolsAreConsumed_Test
// @Test( description="subscription-manager-cli: Ensure that the entitlement certs for subscribed subpool is revoked once the person unsubscribes from RHEL Personal",
// groups={"Tier2Tests","EnsureEntitlementCertForSubPoolIsRevokedOncePersonUnsubscribesFromRHELPersonal_Test","RHELPersonal","blockedByBug-639434"},
// dependsOnGroups={"SubscribeMultipleSystemsToSubPool_Test","EnsurePersonCannotUnsubscribeWhileSubpoolsAreConsumed_Test","EnsurePersonCannotUnregisterWhileSubpoolsAreConsumed_Test"},
// // dataProvider="getRHELPersonalData",
// enabled=true)
// @ImplementsNitrateTest(caseId=58898)
// // 1) unsubscribe person from personal pool while systems are subscribed to subpool (scenario from calfanso@redhat.com)
// public void EnsureEntitlementCertForSubPoolIsRevokedOncePersonUnsubscribesFromRHELPersonal_Test(/*String consumerUsername, String consumerPassword, String personSubscriptionName, String systemSubscriptionName, String systemConsumedProductName*/) {
// log.info("Assuming that multiple systems have subscribed to subpool '"+systemSubscriptionName+"' in prior testcase...");
//
// log.info("Now, unsubscribe the person on client 1 from the '"+personSubscriptionName+"' and assert that the '"+systemConsumedProductName+"' and '"+systemSubscriptionName+"' gets revoked from the system consumers.");
// client1tasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
//
// log.info("Now the the certs for '"+systemConsumedProductName+"' and '"+systemSubscriptionName+"' should be revoked from the system consumers...");
// for (String consumerId : consumerIds) {
// //client2tasks.reregister(consumerUsername,consumerPassword,consumerId);
// client2tasks.reregisterToExistingConsumer(consumerUsername,consumerPassword,consumerId);
// // 10/11/2010 NOT NEEDED SINCE register --consumerid NOW REFRESHES CERTS client2tasks.restart_rhsmcertd(1, true); // give rhsmcertd a chance to download the consumer's certs
// ProductSubscription productSubscription = client2tasks.findProductSubscriptionWithMatchingFieldFromList("productName",systemConsumedProductName,client2tasks.getCurrentlyConsumedProductSubscriptions());
// Assert.assertTrue(productSubscription==null,systemConsumedProductName+" is no longer consumed by '"+consumerId+"' (registered as a system under username '"+consumerUsername+"')");
// SubscriptionPool systemSubscriptionPool = client2tasks.findSubscriptionPoolWithMatchingFieldFromList("subscriptionName",systemSubscriptionName,client2tasks.getCurrentlyAvailableSubscriptionPools());
// Assert.assertTrue(systemSubscriptionPool==null,systemSubscriptionName+" is no longer available to consumer '"+consumerId+"' (registered as a system under username '"+consumerUsername+"')");
// }
// }
@Test(description = "subscription-manager-cli: Ensure that unsubscribing system from subpool while other systems are subscribed to subpool does not cause subpool to go away", groups = { "Tier2Tests", "EnsureEntitlementCertForSubPoolIsNotRevokedOnceAnotherSystemUnsubscribesFromSubPool_Test", "RHELPersonal", "blockedByBug-643405" }, // dependsOnGroups={"SubscribeMultipleSystemsToSubPool_Test","EnsurePersonCannotUnsubscribeWhileSubpoolsAreConsumed_Test","EnsurePersonCannotUnregisterWhileSubpoolsAreConsumed_Test"},
priority = 160, dependsOnMethods = { "testSubscribeMultipleSystemsToSubPool" }, // registered consumers type of "person" was originally intended for entitling people to training. Red Hat Learning Management systems never made use if it, and candlepin has no active requirements for it. Disabling the personal tests... Reference CLOSED WONTFIX BUG https://bugzilla.redhat.com/show_bug.cgi?id=967160#c1
enabled = false)
@ImplementsNitrateTest(caseId = 58899)
public // 2) unsubscribe system from subpool while other systems are subscribed to subpool, make sure the subpool doesn't go away (scenario from calfanso@redhat.com)
void testEntitlementCertForSubPoolIsNotRevokedOnceAnotherSystemUnsubscribesFromSubPool() throws JSONException {
log.info("Now start unsubscribing each system from the consumed product(s) and assert the personal sub pool is still available...");
for (String consumerId : systemConsumerIds) {
// client2tasks.reregister(consumerUsername,consumerPassword,consumerId);
client2tasks.reregisterToExistingConsumer(username, password, consumerId);
for (int j = 0; j < sm_personSubscriptionPoolProductData.length(); j++) {
JSONObject poolProductDataAsJSONObject = (JSONObject) sm_personSubscriptionPoolProductData.get(j);
String personProductId = poolProductDataAsJSONObject.getString("personProductId");
JSONObject subpoolProductDataAsJSONObject = poolProductDataAsJSONObject.getJSONObject("subPoolProductData");
String systemProductId = subpoolProductDataAsJSONObject.getString("systemProductId");
JSONArray bundledProductData = subpoolProductDataAsJSONObject.getJSONArray("bundledProductData");
String systemConsumedProductName = null;
for (int k = 0; k < bundledProductData.length(); k++) {
JSONObject bundledProductAsJSONObject = (JSONObject) bundledProductData.get(k);
systemConsumedProductName = bundledProductAsJSONObject.getString("productName");
}
ProductSubscription productSubscription = ProductSubscription.findFirstInstanceWithMatchingFieldFromList("productName", systemConsumedProductName, client2tasks.getCurrentlyConsumedProductSubscriptions());
Assert.assertNotNull(productSubscription, "Found the consumed Product Subscription with productName='" + systemConsumedProductName + "'.");
client2tasks.unsubscribeFromProductSubscription(productSubscription);
SubscriptionPool systemSubscriptionPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("productId", systemProductId, client2tasks.getCurrentlyAvailableSubscriptionPools());
Assert.assertNotNull(systemSubscriptionPool, "Subscription to ProductId '" + systemProductId + "' is once again available to consumer '" + consumerId + "' (registered as a system under username '" + username + "')");
}
}
}
Aggregations