use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class ContentTests method testSubscribabilityOfSKUProvidingA185ContentSetProduct.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36652", "RHEL7-51484" }, 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 = "Verify that a 185 content set product subscription is always subscribable", groups = { "Tier2Tests", "SubscribabilityOfContentSetProduct_Tests", "blockedByBug-871146", "blockedByBug-905546" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSubscribabilityOfSKUProvidingA185ContentSetProduct() {
Map<String, String> factsMap = new HashMap<String, String>();
File entitlementCertFile;
EntitlementCert entitlementCert;
String systemCertificateVersionFactValue;
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);
SubscriptionPool pool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("productId", subscriptionSKUProvidingA185ContentSetProduct, clienttasks.getCurrentlyAvailableSubscriptionPools());
Assert.assertNotNull(pool, "Found an available pool to subscribe to productId '" + subscriptionSKUProvidingA185ContentSetProduct + "': " + pool);
// test that it IS subscribable when system.certificate_version: None
factsMap.put("system.certificate_version", null);
clienttasks.createFactsFileWithOverridingValues(factsMap);
clienttasks.facts(null, true, null, null, null, null);
Assert.assertEquals(clienttasks.getFactValue("system.certificate_version"), "None", "When the system.certificate_version fact is null, its fact value is reported as 'None'.");
// entitlementCertFile = clienttasks.subscribeToProductId(skuTo185ContentSetProduct);
// entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
clienttasks.subscribe(null, null, pool.poolId, null, null, null, null, null, null, null, null, null, null);
entitlementCert = clienttasks.getEntitlementCertCorrespondingToSubscribedPool(pool);
entitlementCertFile = clienttasks.getEntitlementCertFileFromEntitlementCert(entitlementCert);
Assert.assertEquals(entitlementCert.version, "1.0", "When the system.certificate_version fact is null, the version of the entitlement certificate granted by candlepin is '1.0'.");
Assert.assertEquals(entitlementCert.contentNamespaces.size(), 185, "The number of content sets provided in the version 1.0 entitlement cert parsed using the rct cat-cert tool.");
entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFileUsingOpensslX509(entitlementCertFile);
Assert.assertEquals(entitlementCert.contentNamespaces.size(), 185, "The number of content sets provided in this version '" + entitlementCert.version + "' entitlement cert parsed using the openssl x509 tool.");
clienttasks.assertEntitlementCertsInYumRepolist(Arrays.asList(entitlementCert), true);
// clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
clienttasks.unsubscribeFromSerialNumber(clienttasks.getSerialNumberFromEntitlementCertFile(entitlementCertFile));
// test that it IS subscribable when system.certificate_version: 1.0
factsMap.put("system.certificate_version", "1.0");
clienttasks.createFactsFileWithOverridingValues(factsMap);
clienttasks.facts(null, true, null, null, null, null);
Assert.assertEquals(clienttasks.getFactValue("system.certificate_version"), "1.0", "When the system.certificate_version fact is 1.0, its fact value is reported as '1.0'.");
// entitlementCertFile = clienttasks.subscribeToProductId(skuTo185ContentSetProduct);
// entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
clienttasks.subscribe(null, null, pool.poolId, null, null, null, null, null, null, null, null, null, null);
entitlementCert = clienttasks.getEntitlementCertCorrespondingToSubscribedPool(pool);
entitlementCertFile = clienttasks.getEntitlementCertFileFromEntitlementCert(entitlementCert);
Assert.assertEquals(entitlementCert.version, "1.0", "When the system.certificate_version fact is 1.0, the version of the entitlement certificate granted by candlepin is '1.0'.");
Assert.assertEquals(entitlementCert.contentNamespaces.size(), 185, "The number of content sets provided in the version 1.0 entitlement cert parsed using the rct cat-cert tool.");
entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFileUsingOpensslX509(entitlementCertFile);
Assert.assertEquals(entitlementCert.contentNamespaces.size(), 185, "The number of content sets provided in this version '" + entitlementCert.version + "' entitlement cert parsed using the openssl x509 tool.");
clienttasks.assertEntitlementCertsInYumRepolist(Arrays.asList(entitlementCert), true);
// clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
clienttasks.unsubscribeFromSerialNumber(clienttasks.getSerialNumberFromEntitlementCertFile(entitlementCertFile));
// test that it IS subscribable when system.certificate_version is the system's default value (should be >=3.0)
clienttasks.deleteFactsFileWithOverridingValues();
systemCertificateVersionFactValue = clienttasks.getFactValue("system.certificate_version");
Assert.assertTrue(Float.valueOf(systemCertificateVersionFactValue) >= 3.0, "The actual default system.certificate_version fact '" + systemCertificateVersionFactValue + "' is >= 3.0.");
// entitlementCertFile = clienttasks.subscribeToProductId(skuTo185ContentSetProduct);
// entitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(entitlementCertFile);
clienttasks.subscribe(null, null, pool.poolId, null, null, null, null, null, null, null, null, null, null);
entitlementCert = clienttasks.getEntitlementCertCorrespondingToSubscribedPool(pool);
entitlementCertFile = clienttasks.getEntitlementCertFileFromEntitlementCert(entitlementCert);
// TOO ASSERTIVE Assert.assertTrue(Float.valueOf(entitlementCert.version)<=Float.valueOf(systemCertificateVersionFactValue),"The version of the entitlement certificate '"+entitlementCert.version+"' granted by candlepin is less than or equal to the system.certificate_version '"+systemCertificateVersionFactValue+"' which indicates the maximum certificate version this system knows how to handle."); // This assert was too assertive according to https://bugzilla.redhat.com/show_bug.cgi?id=1425236#c2
// Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1425236#c2
Assert.assertEquals(Float.valueOf(entitlementCert.version).intValue(), Float.valueOf(systemCertificateVersionFactValue).intValue(), "The major value of the entitlement certificate '" + entitlementCert.version + "' granted by candlepin matches the major value of the system.certificate_version '" + systemCertificateVersionFactValue + "' which indicates certificate compatibility.");
Assert.assertEquals(entitlementCert.contentNamespaces.size(), 185, "The number of content sets provided in this version '" + entitlementCert.version + "' entitlement cert parsed using the rct cat-cert tool.");
clienttasks.assertEntitlementCertsInYumRepolist(Arrays.asList(entitlementCert), true);
// clienttasks.unsubscribeFromAllOfTheCurrentlyConsumedProductSubscriptions();
clienttasks.unsubscribeFromSerialNumber(clienttasks.getSerialNumberFromEntitlementCertFile(entitlementCertFile));
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class ContentTests method testRhelSubscriptionContentIsAvailable.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20084", "RHEL7-55189" }, 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 there is at least one available RHEL subscription and that yum content is available for the installed RHEL product cert", groups = { "Tier1Tests", "FipsTests", "blockedByBug-1156638" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testRhelSubscriptionContentIsAvailable() throws JSONException, Exception {
// TEMPORARY WORKAROUND
if (clienttasks.arch.equals("ppc64le")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1156638 - "Red Hat Enterprise Linux for IBM POWER" subscriptions need to provide content for arch "ppc64le"
String bugId = "1156638";
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) {
throw new SkipException("Skipping this test on arch '" + clienttasks.arch + "' while blocking bug '" + bugId + "' is open.");
}
}
// END OF WORKAROUND
// get the currently installed RHEL product cert
ProductCert rhelProductCert = clienttasks.getCurrentRhelProductCert();
Assert.assertNotNull(rhelProductCert, "Expecting a RHEL Product Cert to be installed.");
log.info("RHEL product cert installed: " + rhelProductCert);
// register and make sure autoheal is off
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);
// verify that NO yum content is available since no entitlements have been granted
Integer yumRepolistPackageCount = clienttasks.getYumRepolistPackageCount("enabled");
// added only for debugging a failure
if (yumRepolistPackageCount > 0)
clienttasks.list_(null, null, true, null, null, null, null, null, null, null, null, null, null, null);
Assert.assertEquals(yumRepolistPackageCount, new Integer(0), "Expecting no available packages (actual='" + yumRepolistPackageCount + "') because no RHEL subscription have been explicitly attached.");
// loop through the available pools looking for those that provide content for this rhelProductCert
boolean rhelYumContentIsAvailable = true;
boolean rhelSubscriptionIsAvailable = false;
for (SubscriptionPool pool : clienttasks.getCurrentlyAvailableSubscriptionPools()) {
if (CandlepinTasks.getPoolProvidedProductIds(sm_clientUsername, sm_clientPassword, sm_serverUrl, pool.poolId).contains(rhelProductCert.productId)) {
// subscribe
EntitlementCert rhelEntitlementCert = clienttasks.getEntitlementCertFromEntitlementCertFile(clienttasks.subscribeToSubscriptionPool(pool, sm_clientUsername, sm_clientPassword, sm_serverUrl));
// Brand Name:
if (rhelProductCert.productId.equals("261") && clienttasks.arch.equals("aarch64")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
String bugId = "1174966";
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) {
String enablerepo = "rhel-server-for-arm-development-preview-rpms";
log.info("Explicitly enabling repo '" + enablerepo + "' to gain access to ARM content.");
clienttasks.repos(null, null, null, enablerepo, null, null, null, null, null);
}
}
// WORKAROUND FOR RHEL-ALT-7.5 aarch64
if (clienttasks.redhatReleaseXY.equals("7.5") && rhelProductCert.productId.equals("433")) {
// Red Hat Enterprise Linux for IBM System z (Structure A) Beta
String repo = "rhel-7-for-system-z-a-beta-rpms";
log.info("WORKAROUND: Enabling beta repo '" + repo + "' for installed product '" + rhelProductCert.productName + "' (" + rhelProductCert.productId + ") because this is the debut release for this product. No GA content from repo rhel-7-for-system-z-a-rpms is available yet.");
clienttasks.repos(null, null, null, repo, null, null, null, null, null);
}
// END OF WORKAROUND
// verify that rhel yum content is available
yumRepolistPackageCount = clienttasks.getYumRepolistPackageCount("enabled");
if (yumRepolistPackageCount > 0) {
Assert.assertTrue(yumRepolistPackageCount > 0, "Expecting many available packages (actual='" + yumRepolistPackageCount + "') of enabled repo content because RHEL subscription '" + pool.subscriptionName + "' SKU '" + pool.productId + "' was just attached.");
} else {
log.warning("No enabled yum repo content packages are available after attaching RHEL subscription '" + pool.subscriptionName + "'. (This can happen when the RHEL product is brand new and content has not yet been pushed to '" + clienttasks.baseurl + "')");
rhelYumContentIsAvailable = false;
}
// unsubscribe
clienttasks.unsubscribe(null, rhelEntitlementCert.serialNumber, null, null, null, null, null);
rhelSubscriptionIsAvailable = true;
if (rhelYumContentIsAvailable)
break;
}
}
if (!rhelSubscriptionIsAvailable && sm_serverType.equals(CandlepinType.standalone))
throw new SkipException("Skipping this test against a standalone Candlepin server that has no RHEL subscriptions available.");
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1090058
if (clienttasks.redhatReleaseX.equals("5") && clienttasks.arch.startsWith("ppc")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
String bugId = "1090058";
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) {
if (!rhelSubscriptionIsAvailable)
throw new SkipException("skipping this test while bug '" + bugId + "' is open");
}
}
if (!rhelSubscriptionIsAvailable) {
clienttasks.facts_(true, null, null, null, null, null);
log.warning("This test is about to fail and may be due to the lack of an available subscription with enough socket/ram/core support to cover this system. Visually confirm by reviewing the system facts above.");
}
Assert.assertTrue(rhelSubscriptionIsAvailable, "Successfully subscribed to at least one available RHEL subscription that provided for our installed RHEL product cert: " + rhelProductCert);
Assert.assertTrue(rhelYumContentIsAvailable, "All of the RHEL subscriptions subscribed provided at least one enabled yum content package applicable for our installed RHEL product cert: " + rhelProductCert + " (See WARNINGS logged above for failed subscriptions)");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class ContentTests method testGpgCheckValuesInYumRepos.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20082", "RHEL7-51098" }, 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 content flag : gpgcheck value in redhat.repo should be disabled when gpg_url is empty or null", groups = { "Tier1Tests", "blockedByBug-741293", "blockedByBug-805690", "blockedByBug-962520" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testGpgCheckValuesInYumRepos() throws JSONException, Exception {
// [root@jsefler-r63-server ~]# cat /etc/yum.repos.d/redhat.repo
// #
// # Certificate-Based Repositories
// # Managed by (rhsm) subscription-manager
// #
// # If this file is empty and this system is subscribed consider
// # a "yum repolist" to refresh available repos
// #
//
// [content-label]
// name = content
// baseurl = https://cdn.redhat.com/foo/path
// enabled = 1
// gpgcheck = 1
// gpgkey = https://cdn.redhat.com/foo/path/gpg/
// sslverify = 1
// sslcacert = /etc/rhsm/ca/redhat-uep.pem
// sslclientkey = /etc/pki/entitlement/5488047145460852736-key.pem
// sslclientcert = /etc/pki/entitlement/5488047145460852736.pem
// metadata_expire = 0
// 1.3.6.1.4.1.2312.9.2 (Content Namespace)
// 1.3.6.1.4.1.2312.9.2.<content_hash> (Red Hat Enterprise Linux (core server))
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1 (Yum repo type))
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.1 (Name) : Red Hat Enterprise Linux (core server)
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.2 (Label) : rhel-server
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.5 (Vendor ID): %Red_Hat_Id% or %Red_Hat_Label%
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.6 (Download URL): content/rhel-server/$releasever/$basearch
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.7 (GPG Key URL): file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.8 (Enabled): 1
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.9 (Metadata Expire Seconds): 604800
// 1.3.6.1.4.1.2312.9.2.<content_hash>.1.10 (Required Tags): TAG1,TAG2,TAG3
List<ProductCert> currentProductCerts = clienttasks.getCurrentProductCerts();
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);
if (clienttasks.subscribeToTheCurrentlyAvailableSubscriptionPoolsCollectively().size() <= 0)
throw new SkipException("No available subscriptions were found. Therefore we cannot perform this test.");
List<EntitlementCert> entitlementCerts = clienttasks.getCurrentEntitlementCerts();
// or maybe we should skip when nothing is consumed
Assert.assertTrue(!entitlementCerts.isEmpty(), "After subscribing to all available subscription pools, there must be some entitlements.");
ArrayList<String> repolist = clienttasks.getYumRepolist("enabled");
List<YumRepo> yumRepos = clienttasks.getCurrentlySubscribedYumRepos();
for (EntitlementCert entitlementCert : entitlementCerts) {
for (ContentNamespace contentNamespace : entitlementCert.contentNamespaces) {
if (!contentNamespace.type.equalsIgnoreCase("yum"))
continue;
if (contentNamespace.enabled) {
if (!clienttasks.areAllRequiredTagsInContentNamespaceProvidedByProductCerts(contentNamespace, currentProductCerts))
continue;
YumRepo yumRepo = YumRepo.findFirstInstanceWithMatchingFieldFromList("id", /*label*/
contentNamespace.label, yumRepos);
Assert.assertNotNull(yumRepo, "Found the yum repo within '" + clienttasks.redhatRepoFile + "' corresponding to the entitled content namespace label '" + contentNamespace.label + "'.");
// case 1: contentNamespace.gpgKeyUrl==null
if (contentNamespace.gpgKeyUrl == null) {
Assert.assertFalse(yumRepo.gpgcheck, "gpgcheck is False for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a null gpgKeyUrl: contentNamespace: " + contentNamespace);
Assert.assertNull(yumRepo.gpgkey, "gpgkey is not set for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a null gpgKeyUrl: contentNamespace: " + contentNamespace);
// case 2: contentNamespace.gpgKeyUrl==""
} else if (contentNamespace.gpgKeyUrl.equals("")) {
Assert.assertFalse(yumRepo.gpgcheck, "gpgcheck is False for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has an empty gpgKeyUrl: contentNamespace: " + contentNamespace);
Assert.assertNull(yumRepo.gpgkey, "gpgkey is not set for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has an empty gpgKeyUrl: contentNamespace: " + contentNamespace);
// case 3: contentNamespace.gpgKeyUrl.startsWith("http")
} else if (contentNamespace.gpgKeyUrl.startsWith("http:") || contentNamespace.gpgKeyUrl.startsWith("https:")) {
Assert.assertTrue(yumRepo.gpgcheck, "gpgcheck is True for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
Assert.assertEquals(yumRepo.gpgkey, contentNamespace.gpgKeyUrl, "gpgkey is set for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
// case 4: contentNamespace.gpgKeyUrl.startsWith("file:")
} else if (contentNamespace.gpgKeyUrl.startsWith("file:")) {
Assert.assertTrue(yumRepo.gpgcheck, "gpgcheck is True for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
Assert.assertEquals(yumRepo.gpgkey, contentNamespace.gpgKeyUrl, "gpgkey is set for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
// case 5: contentNamespace.gpgKeyUrl is a relative path
} else {
Assert.assertTrue(yumRepo.gpgcheck, "gpgcheck is True for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
Assert.assertEquals(yumRepo.gpgkey, clienttasks.baseurl + contentNamespace.gpgKeyUrl, "gpgkey is set for Yum repo '" + yumRepo.id + "' when corresponding entitlement contentNamespace has a non-null/empty gpgKeyUrl: contentNamespace: " + contentNamespace);
}
}
}
}
if (yumRepos.isEmpty())
throw new SkipException("Since no Red Hat repos were found in '" + clienttasks.redhatRepoFile + "', there are no gpgcheck values to verify.");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class ContentTests method testYumRepoUiRepoIdVars.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-20086", "RHEL7-51097" }, 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 yum vars used in a baseurl are listed in a yum repo parameter called ui_repoid_vars", groups = { "Tier1Tests", "blockedByBug-906554" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testYumRepoUiRepoIdVars() throws JSONException, Exception {
// 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);
// subscribe to available subscriptions
clienttasks.subscribeToTheCurrentlyAvailableSubscriptionPoolsCollectively();
// process each of the yum repos granted and assert the yum vars contained in the baseurl are listed in the ui_repoid_vars
boolean UiRepoIdVarsTested = false;
for (YumRepo yumRepo : clienttasks.getCurrentlySubscribedYumRepos()) {
log.info("Asserting Yum Repo: " + yumRepo);
// baseurl = https://cdn.redhat.com/content/dist/rhel/server/5/$releasever/$basearch/jbeap/5/os
Pattern p = Pattern.compile("\\$\\w+");
Matcher matcher = p.matcher(yumRepo.baseurl);
// first, check if the baseurl has any yum vars
if (!matcher.find()) {
// assert that this yumRepo has no ui_repoid_vars configuration
Assert.assertNull(yumRepo.ui_repoid_vars, "When baseurl '" + yumRepo.baseurl + "' of yumRepo '" + yumRepo.id + "' contains no yum vars, then configuration ui_repoid_vars is not required.");
continue;
}
// now make sure all of the yum vars in the baseurl are present in the ui_repoid_vars configuration
matcher.reset();
List<String> actualUiRepoidVars = Arrays.asList(yumRepo.ui_repoid_vars.trim().split("\\s+"));
while (matcher.find()) {
UiRepoIdVarsTested = true;
String yumVar = matcher.group();
// assert that the configured ui_repoid_vars contains this yum var
Assert.assertTrue(actualUiRepoidVars.contains(yumVar.replaceFirst("^\\$", "")), "The ui_repoid_vars configuration in repo id '" + yumRepo.id + "' contains yum var '" + yumVar + "' used in its baseurl '" + yumRepo.baseurl + "'.");
}
// TODO on RHEL7 we should learn how the yum vars get propagated to the ui when calling yum repolist (dgregor probably knows)
// [root@jsefler-7 ~]# yum repolist
// Loaded plugins: langpacks, product-id, security, subscription-manager
// This system is receiving updates from Red Hat Subscription Management.
// repo id repo name status
// always-enabled-content/6.92Server always-enabled-content 0
// awesomeos/6.92Server/x86_64 awesomeos 0
// repolist: 0
// Notice the repoid labels are appended with /$releasever and /$releasever/$basearch
}
if (!UiRepoIdVarsTested)
throw new SkipException("Could not find any YumRepos containing yum vars to assert this test.");
}
use of com.redhat.qe.auto.tcms.ImplementsNitrateTest in project rhsm-qe by RedHatQE.
the class EventTests method testEntitlementCreated.
@// update=true // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21842", "RHEL7-51663" }, 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 = "subscription-manager: events: Enitlement Created is sent over an RSS atom feed.", groups = { "Tier3Tests", "EntitlementCreated_Test" }, dependsOnGroups = { "ConsumerCreated_Test" }, enabled = true)
@ImplementsNitrateTest(caseId = 50403)
public void testEntitlementCreated() throws Exception {
// test prerequisites
List<SubscriptionPool> pools = clienttasks.getCurrentlyAvailableSubscriptionPools();
ConsumerCert consumerCert = clienttasks.getCurrentConsumerCert();
// 7/30/2012 updating consumer's autoheal to prevent an auto 'ENTITLEMENT CREATED' event
CandlepinTasks.setAutohealForConsumer(sm_clientUsername, sm_clientPassword, sm_serverUrl, consumerCert.consumerid, false);
// get the owner and consumer feeds before we test the firing of a new event
String ownerKey = CandlepinTasks.getOwnerKeyOfConsumerId(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, consumerCert.consumerid);
SyndFeed oldFeed = CandlepinTasks.getSyndFeed(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
SyndFeed oldOwnerFeed = CandlepinTasks.getSyndFeedForOwner(ownerKey, sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
SyndFeed oldConsumerFeed = CandlepinTasks.getSyndFeedForConsumer(/*ownerKey,*/
consumerCert.consumerid, sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl);
// fire a subscribe event
// SubscriptionPool pool = pools.get(0); // pick the first pool
// randomly pick a pool
testPool = pools.get(randomGenerator.nextInt(pools.size()));
// debugTesting randomly picked standalone non-zero virt_limit pools
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("productId", "awesomeos-virt-4", pools);
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("productId", "awesomeos-virt-unlimited", pools);
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("productId", "awesomeos-server-basic-dc", pools);
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("poolId", "8a90860f5eed6282015eed64099a0193", pools);
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("contract", "", pools);
// testPool = SubscriptionPool.findFirstInstanceWithMatchingFieldFromList("subscriptionType", "Standard (Temporary)", pools);
// clienttasks.subscribeToSubscriptionPoolUsingPoolId(testPool); // RHEL59: THIS IS GENERATING EXTRA CONSUMER MODIFIED EVENTS THAT WE DON'T REALLY WANT TO TEST
clienttasks.subscribe(null, null, testPool.poolId, null, null, null, null, null, null, null, null, null, null);
List<String> newEventTitles = new ArrayList<String>();
// newEventTitles.add("COMPLIANCE CREATED"); // COMPLIANCE CREATED events were added to support gutterball
newEventTitles.add("ENTITLEMENT CREATED");
// newEventTitles.add("COMPLIANCE CREATED");
// newEventTitles.add("COMPLIANCE CREATED");
// TEMPORARY WORKAROUND FOR BUG
// Status: CLOSED CURRENTRELEASE
boolean invokeWorkaroundWhileBugIsOpen = false;
// jsefler 07/14/2011 Bug 721136 - the content of the atom feeds has the same value for title and description
String bugId = "721136";
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) {
newEventTitles.clear();
newEventTitles.add(clienttasks.hostname + " consumed a subscription for product " + testPool.subscriptionName);
}
// END OF WORKAROUND
// assert the consumer feed...
// assertTheNewConsumerFeed(ownerKey, consumerCert.consumerid, oldConsumerFeed, newEventTitles.toArray(new String[]{})); // worked prior to RHEL59
// TODO Using the IgnoringEventTitles is a workaround bug 838123#c2
assertTheNewConsumerFeedIgnoringEventTitles(ownerKey, consumerCert.consumerid, oldConsumerFeed, newEventTitles.toArray(new String[] {}), new HashSet<String>() {
{
add("CONSUMER MODIFIED");
add("COMPLIANCE CREATED");
}
});
// adjust the expected events when the candlepin server is standalone and the pool has a non-zero virt_limit
String virt_limit = CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, testPool.poolId, "virt_limit");
if (servertasks.statusStandalone && virt_limit != null && !virt_limit.equals("0")) {
newEventTitles.add(1, "POOL CREATED");
}
// assert the owner feed...
// assertTheNewOwnerFeed(ownerKey, oldOwnerFeed, newEventTitles.toArray(new String[]{})); // worked prior to RHEL59
// TODO Using the IgnoringEventTitles is a workaround bug 838123#c2
assertTheNewOwnerFeedIgnoringEventTitles(ownerKey, oldOwnerFeed, newEventTitles.toArray(new String[] {}), new HashSet<String>() {
{
add("CONSUMER MODIFIED");
add("COMPLIANCE CREATED");
}
});
// assert the feed...
// assertTheNewFeed(oldFeed, newEventTitles.toArray(new String[]{})); // worked prior to RHEL59
assertTheNewFeedIgnoringEventTitles(oldFeed, newEventTitles.toArray(new String[] {}), new HashSet<String>() {
{
add("CONSUMER MODIFIED");
add("COMPLIANCE CREATED");
}
});
}
Aggregations