Search in sources :

Example 36 with BlockedByBzBug

use of com.redhat.qe.auto.bugzilla.BlockedByBzBug in project rhsm-qe by RedHatQE.

the class ActivationKeyTests method getRegisterWithActivationKeyContainingPoolWithQuantityDataAsListOfLists.

protected List<List<Object>> getRegisterWithActivationKeyContainingPoolWithQuantityDataAsListOfLists() throws Exception {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    for (List<Object> l : getAllJSONPoolsDataAsListOfLists()) {
        JSONObject jsonPool = (JSONObject) l.get(0);
        int quantity = jsonPool.getInt("quantity");
        // does this pool provide an unlimited quantity of entitlements?
        if (quantity == -1) {
            log.info("Assuming that pool '" + jsonPool.getString("id") + "' provides an unlimited quantity of entitlements.");
            // assume any quantity greater than what is currently consumed
            quantity = jsonPool.getInt("consumed") + 10;
        }
        // choose a random valid pool quantity (1<=quantity<=totalPoolQuantity)
        int quantityAvail = quantity - jsonPool.getInt("consumed");
        // avoid a addQuantity < 1 see https://bugzilla.redhat.com/show_bug.cgi?id=729125
        int addQuantity = Math.max(1, randomGenerator.nextInt(quantityAvail + 1));
        // is this pool known to be blocked by any activation key bugs?
        BlockedByBzBug blockedByBugs = null;
        List<String> bugids = new ArrayList<String>();
        if (ConsumerType.person.toString().equals(CandlepinTasks.getPoolProductAttributeValue(sm_clientUsername, sm_clientPassword, sm_serverUrl, jsonPool.getString("id"), "requires_consumer_type")))
            bugids.add("732538");
        if (!CandlepinTasks.isPoolProductMultiEntitlement(sm_clientUsername, sm_clientPassword, sm_serverUrl, jsonPool.getString("id")) && addQuantity > 1)
            bugids.add("729070");
        if (!bugids.isEmpty())
            blockedByBugs = new BlockedByBzBug(bugids.toArray(new String[] {}));
        String keyName = String.format("ActivationKey%s_ForPool%s_WithQuantity%s", System.currentTimeMillis(), jsonPool.getString("id"), addQuantity);
        // Object blockedByBug, String keyName, JSONObject jsonPool
        ll.add(Arrays.asList(new Object[] { blockedByBugs, keyName, jsonPool, addQuantity }));
        // minimize the number of dataProvided rows (useful during automated testcase development)
        if (Boolean.valueOf(getProperty("sm.debug.dataProviders.minimize", "false")))
            break;
    }
    return ll;
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(org.json.JSONObject) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug)

Example 37 with BlockedByBzBug

use of com.redhat.qe.auto.bugzilla.BlockedByBzBug in project rhsm-qe by RedHatQE.

the class BashCompletionTests method getBashCompletionDataAsListOfLists.

protected List<List<Object>> getBashCompletionDataAsListOfLists() {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (clienttasks == null)
        return ll;
    // interpret the expected bash completion data from the HelpTests dataProvider getExpectedCommandLineOptionsDataAsListOfLists
    for (List<Object> l : HelpTests.getExpectedCommandLineOptionsDataAsListOfLists()) {
        // Object bugzilla, String helpCommand, Integer exitCode, String stdoutRegex, List<String> expectedOptions
        // BlockedByBzBug blockedByBzBug = (BlockedByBzBug) l.get(0);
        String helpCommand = (String) l.get(1);
        // Integer exitCode = (Integer) l.get(2);
        // String stdoutRegex = (String) l.get(3);
        List<String> expectedHelpOptions = (List<String>) l.get(4);
        // skip all the help tests with expectedOptions that do not come from --help
        if (!helpCommand.contains("--help"))
            continue;
        // based on comment https://bugzilla.redhat.com/show_bug.cgi?id=1004385#c7 we will only test rhsm-icon --help (we will skip tests for --help-gtk options or --help-all options)
        if (helpCommand.startsWith("rhsm-icon") && (helpCommand.contains("--help-gtk") || helpCommand.contains("--help-all")))
            continue;
        // remove "export DISPLAY=localhost:10.0 && " from the helpCommand export DISPLAY=localhost:10.0 && subscription-manager-gui --help
        // helpCommand = helpCommand.replace("export DISPLAY=localhost:10.0 && ","");
        helpCommand = helpCommand.replaceFirst("export DISPLAY=.* && ", "");
        // transcribe the helpCommand into a bashCommand
        // strip out "--help"
        String bashCommand = helpCommand.replaceFirst("\\s*(--help-all|--help-gtk|--help)\\s*", " ").trim();
        // append chars as a prefix to <tab><tab> complete the expected command line options
        bashCommand += " ";
        // special case for rct modules [cat-cert|cat-manifest|dump-manifest|stat-cert] need to start the bash completion of the options by adding a "-" as described in https://bugzilla.redhat.com/show_bug.cgi?id=1004318#c1
        if (bashCommand.equals("rct cat-cert "))
            bashCommand += "-";
        if (bashCommand.equals("rct cat-manifest "))
            bashCommand += "-";
        if (bashCommand.equals("rct dump-manifest "))
            bashCommand += "-";
        if (bashCommand.equals("rct stat-cert "))
            bashCommand += "-";
        // special case for rhsm-debug modules [system] need to start the bash completion of the options by adding a "-" as described in https://bugzilla.redhat.com/show_bug.cgi?id=1004318#c1
        if (bashCommand.equals("rhsm-debug system "))
            bashCommand += "-";
        // transcribe the expectedHelpOptions into expectedCompletions
        Set<String> expectedCompletions = new HashSet<String>();
        for (String expectedHelpOption : expectedHelpOptions) {
            // from the attach module usage test
            if (expectedHelpOption.equals("Attach a specified subscription to the registered system"))
                continue;
            // from the remove module usage test
            if (expectedHelpOption.equals("Remove all or specific subscriptions from this system"))
                continue;
            // from the subscribe and unsubscribe module usage test
            if (expectedHelpOption.startsWith("Deprecated, see"))
                continue;
            // Usage: subscription-manager MODULE-NAME [MODULE-OPTIONS] [--help]
            if (expectedHelpOption.toUpperCase().startsWith("USAGE:"))
                continue;
            // Usage:
            if (expectedHelpOption.startsWith(bashCommand))
                continue;
            // split expectedHelpOption of this form: -s SERVICELEVEL, --servicelevel=SERVICELEVEL
            for (String expectedOption : expectedHelpOption.split("\\s*,\\s*")) {
                // split expectedOption of this form: -s SERVICELEVEL
                // split expectedOption of this form: --servicelevel=SERVICELEVEL
                expectedOption = expectedOption.split("\\s*[= ]\\s*")[0];
                expectedCompletions.add(expectedOption);
            }
        }
        // skip this data provided row when there are no expectedCompletions left
        if (expectedCompletions.isEmpty())
            continue;
        // special case for subscription-manager bash completion to include -h and --help in expectedCompletions
        if (clienttasks.isPackageVersion("subscription-manager", ">=", "1.16.2-1")) {
            // see subscription-manager commit b39a3e9a615b99c7ba3adaafdd7df999f9714d74
            if (bashCommand.equals("subscription-manager ")) {
                // [root@jsefler-7 ~]# subscription-manager --help
                // Usage: subscription-manager MODULE-NAME [MODULE-OPTIONS] [--help]
                expectedCompletions.add("-h");
                expectedCompletions.add("--help");
            }
        }
        // mark dataProvider rows with a blockedByBzBug where appropriate
        Set<String> bugIds = new HashSet<String>();
        // Bug 812104 - Unable to tab complete new subscription-manager modules (release and service-level)
        if (bashCommand.startsWith("subscription-manager release "))
            bugIds.add("812104");
        if (bashCommand.startsWith("subscription-manager service-level "))
            bugIds.add("812104");
        // Bug 817390 - bash-completion of subscription-manager subscribe --<TAB><TAB> is not finding --servicelevel option
        if (bashCommand.startsWith("subscription-manager subscribe "))
            bugIds.add("817390");
        if (bashCommand.startsWith("subscription-manager register "))
            bugIds.add("817390");
        // Bug 817117 - bash-completion of subscription-manager environments --<TAB><TAB> is not working
        if (bashCommand.startsWith("subscription-manager environments "))
            bugIds.add("817117");
        // Bug 1011712 - bash-completion of subscription-manager environments --<TAB><TAB> is incomplete
        if (bashCommand.startsWith("subscription-manager environments "))
            bugIds.add("1011712");
        // Bug 1003010 - --status should be removed from bash-completion of subscription-manager list --<TAB><TAB>
        if (bashCommand.startsWith("subscription-manager list "))
            bugIds.add("1003010");
        // Bug 1001820 - Tab Completion: subscription-manager attach <tab tab>
        if (bashCommand.startsWith("subscription-manager attach "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager auto-attach "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager clean "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager config "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager environments "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager import "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager list "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager orgs "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager plugins "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager register "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager remove "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager service-level "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager status "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager subscribe "))
            bugIds.add("1001820");
        if (bashCommand.startsWith("subscription-manager unsubscribe "))
            bugIds.add("1001820");
        // Bug 1028555 - bash completion is missing for the new subscription-manager repo-override module and its options
        if (bashCommand.startsWith("subscription-manager repo-override "))
            bugIds.add("1028555");
        // Bug 1149359 - new subscription-manager repos --list-enabled and --list-disabled options do not bash complete
        if (bashCommand.startsWith("subscription-manager repos "))
            bugIds.add("1149359");
        // Bug 1004341 - subscription-manager-gui does not bash complete its options
        if (bashCommand.startsWith("subscription-manager-gui "))
            bugIds.add("1004341");
        // Bug 1004318 - rct [cat-cert cat-manifest dump-manifest stat-cert] does not bash complete its options
        if (bashCommand.startsWith("rct "))
            bugIds.add("1004318");
        // Bug 1369522 - rct cat-manifest is not bash-completing new option --no-content
        if (bashCommand.startsWith("rct cat-manifest "))
            bugIds.add("1369522");
        // Bug 1374389 - bash-completion for "rct stat-cert --<TAB><TAB>" should NOT show --no-content as an option
        if (bashCommand.startsWith("rct stat-cert "))
            bugIds.add("1374389");
        // Bug 1004385 - rhsm-icon bash completions should not end with a comma
        if (bashCommand.startsWith("rhsm-icon "))
            bugIds.add("1004385");
        // Bug 985090 - command "rhsmcertd" options
        if (bashCommand.startsWith("rhsmcertd "))
            bugIds.add("985090");
        // Bug 1004402 - rhsmd and rhsmcertd-worker does not bash complete its options
        if (bashCommand.startsWith("/usr/libexec/rhsmcertd-worker "))
            bugIds.add("1004402");
        if (bashCommand.startsWith("/usr/libexec/rhsmd "))
            bugIds.add("1004402");
        // Bug 1042897 - bash-completion for "rhsm-debug system -" is missing the proxy options
        if (bashCommand.startsWith("rhsm-debug system "))
            bugIds.add("1042897");
        // Bug 1057329 - rhsm-debug system <space> <TAB> <TAB> does not auto complete
        if (bashCommand.startsWith("rhsm-debug system "))
            bugIds.add("1057329");
        // Bug 1121251 - rhsm-debug system does not bash-complete the new "--no-subscriptions" option
        if (bashCommand.startsWith("rhsm-debug system -"))
            bugIds.add("1121251");
        // Bug 1094869 - on rhel5, bash-completion of rhsm-icon options should show -? instead of -h
        if (bashCommand.startsWith("rhsm-icon ") && clienttasks.redhatReleaseX.equals("5"))
            bugIds.add("1094869");
        if (bashCommand.startsWith("rhsmcertd ") && clienttasks.redhatReleaseX.equals("5"))
            bugIds.add("1094869");
        // Bug 1094879 - install-num-migrate-to-rhsm does not bash-complete its options
        if (bashCommand.startsWith("install-num-migrate-to-rhsm "))
            bugIds.add("1094879");
        // Bug 1149286 - tab-completion for rhn-migrate-classic-to-rhsm is completely wrong after several options were changed
        if (bashCommand.startsWith("rhn-migrate-classic-to-rhsm "))
            bugIds.add("1149286");
        // Bug 1161694 - incorrect bash completion for new subscription-manager list option "--pool-only"
        if (bashCommand.startsWith("subscription-manager list "))
            bugIds.add("1161694");
        // Bug 1196418 - rhn-migrate-classic-to-rhsm --activation-key does not bash complete
        if (bashCommand.startsWith("rhn-migrate-classic-to-rhsm "))
            bugIds.add("1196418");
        // https://bugzilla.redhat.com/show_bug.cgi?id=1180273#c9
        if (bashCommand.startsWith("rhn-migrate-classic-to-rhsm ") && clienttasks.isPackageVersion("subscription-manager", ">=", "1.14.3-1"))
            bugIds.add("1180273");
        // Bug 1441397 - bash completion for all subscription-manager modules is failing to include the new --noproxy option
        if (bashCommand.startsWith("subscription-manager attach "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager auto-attach "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager environments "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager list "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager orgs "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager register "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager remove "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager service-level "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager status "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager subscribe "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager unsubscribe "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager redeem "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager version "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager repos "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager repo-override "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager facts "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager identity "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager refresh "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager unregister "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("subscription-manager release "))
            bugIds.add("1441397");
        if (bashCommand.startsWith("rhsm-debug system "))
            bugIds.add("1441397");
        BlockedByBzBug blockedByBzBug = new BlockedByBzBug(bugIds.toArray(new String[] {}));
        // append a new row to the dataProvider
        ll.add(Arrays.asList(new Object[] { blockedByBzBug, bashCommand, expectedCompletions }));
    }
    return ll;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug) HashSet(java.util.HashSet)

Example 38 with BlockedByBzBug

use of com.redhat.qe.auto.bugzilla.BlockedByBzBug in project rhsm-qe by RedHatQE.

the class CertificateTests method getVerifyBaseRHELProductCertVersionUpdates_TestDataAsListOfLists.

protected List<List<Object>> getVerifyBaseRHELProductCertVersionUpdates_TestDataAsListOfLists() {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (clienttasks == null)
        return ll;
    BlockedByBzBug blockedByBugs = null;
    List<String> bugids = new ArrayList<String>();
    // Object blockedByBug, String testPackage, String oldProductCertVersion, String oldRelease, String newerRelease
    if (clienttasks.redhatReleaseX.equals("5")) {
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1086301", "1102107", "1119809" }), "zsh", "5.8 Beta", "5.8", "5.9" }));
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1086301", "1102107", "1119809" }), "zsh", "5.8", "5.8", "5.9" }));
    } else if (clienttasks.redhatReleaseX.equals("6")) {
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1035115", "1000281", "1120573", "1214856", "1559114" }), "zsh", "6.3 Beta", "6.3", "6.4" }));
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1035115", "1000281", "1120573", "1214856", "1559114" }), "zsh", "6.3", "6.3", "6.4" }));
        // ll.add(Arrays.asList(new Object[]{new BlockedByBzBug(new String[]{"1035115","1000281","1120573"}),	"zsh",	"6.1-Beta",	"6.1",	"6.5"}));	// will fail on ppc64 and s390x because the 6.1-Beta product cert tags do not provide any content (on ppc64 rhel-6.1-beta productId=74 Tags: rhel-6,rhel-6-premium-architectures) (on s390x rhel-6.1-beta productId=72 Tags: rhel-6,rhel-6-mainframe)  Not opening any bug since it was a Beta.
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1035115", "1000281", "1120573" }), "zsh", "6.1", "6.1", "6.5" }));
        ll.add(Arrays.asList(new Object[] { new BlockedByBzBug(new String[] { "1035115", "1000281", "1120573" }), "zsh", "6.3 Beta", "6.3", "6.5" }));
    } else if (clienttasks.redhatReleaseX.equals("7") && !clienttasks.redhatReleaseXY.equals("7.0") && !clienttasks.redhatReleaseXY.equals("7.1")) {
        // Bug 1267732 - production CDN productid files 404: Not Found. for ComputeNode releasever 7.1 and 7Server
        if (clienttasks.variant.equals("ComputeNode"))
            bugids.add("1267732");
        // Bug 1338857 - cdn.redhat.com has the wrong productId version for rhel 7.2
        if (clienttasks.variant.equals("Server") && clienttasks.arch.equals("x86_64"))
            bugids.add("1338857");
        // Bug 1351754 - production CDN productid files 404: Not Found. for Power, little endian releasever 7.1, 7.2, and 7Server
        if (clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64le"))
            bugids.add("1351754");
        // Bug 1351800 - production CDN productid files 404: Not Found. for ARM releasever 7.1, 7.2, and 7Server
        if (clienttasks.variant.equals("Server") && clienttasks.arch.equals("aarch64"))
            bugids.add("1351800");
        // Bug 1356738 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/s390x and server/7/7Server/s390x
        if (clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
            bugids.add("1356738");
        // Bug 1356740 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/ppc64 and server/7/7Server/ppc64
        if (clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64"))
            bugids.add("1356740");
        // Bug 1356710 - cdn.redhat.com has the wrong repodata/productId version at workstation/7/7.2 and workstation/7/7Workstation
        if (clienttasks.variant.equals("Workstation") && clienttasks.arch.equals("x86_64"))
            bugids.add("1356710");
        // Bug 1356722 - cdn.redhat.com has the wrong repodata/productId version at computenode/7/7.2 and computenode/7/7ComputeNode
        if (clienttasks.variant.equals("ComputeNode") && clienttasks.arch.equals("x86_64"))
            bugids.add("1356722");
        // Bug 1356729 - cdn.redhat.com has the wrong repodata/productId version at client/7/7.2 and client/7/7Client
        if (clienttasks.variant.equals("Client") && clienttasks.arch.equals("x86_64"))
            bugids.add("1356729");
        blockedByBugs = new BlockedByBzBug(bugids.toArray(new String[] {}));
        if (// ppc64le and aarch64 did not exist on 7.0 nor 7.1; exclude this row on these arches
        !clienttasks.arch.equals("ppc64le") && !clienttasks.arch.equals("aarch64"))
            ll.add(Arrays.asList(new Object[] { blockedByBugs, "Red_Hat_Enterprise_Linux-Release_Notes-7-fr-FR", "7.0", "7.0", "7.1" }));
        // ll.add(Arrays.asList(new Object[]{null,	"Red_Hat_Enterprise_Linux-Release_Notes-7-fr-FR",	"7.0 Beta",	"7.0",	"7.1"}));	// There is no 7.0 Beta product cert id 69 that can be updated.  The 7.0 Beta product cert is product id 226 Everything
        if (// ppc64le and aarch64 did not exist on 7.0 nor 7.1; exclude this row on these arches
        !clienttasks.arch.equals("ppc64le") && !clienttasks.arch.equals("aarch64"))
            ll.add(Arrays.asList(new Object[] { blockedByBugs, "Red_Hat_Enterprise_Linux-Release_Notes-7-fr-FR", "7.1 Beta", "7.1", "7.2" }));
    // TODO UNCOMMENT FOR RHEL74	TESTING		ll.add(Arrays.asList(new Object[]{blockedByBugs,	"Red_Hat_Enterprise_Linux-Release_Notes-7-fr-FR",	"7.2 Beta",	"7.2",	"7.3"}));
    // TODO UNCOMMENT FOR RHEL74	TESTING		ll.add(Arrays.asList(new Object[]{blockedByBugs,	"Red_Hat_Enterprise_Linux-Release_Notes-7-fr-FR",	"7.2",		"7.2",	"7.3"}));
    } else {
        ll.add(Arrays.asList(new Object[] { null, "FIXME: Unhandled Release", "1.0 Beta", "1.0", "1.1" }));
    }
    return ll;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug)

Example 39 with BlockedByBzBug

use of com.redhat.qe.auto.bugzilla.BlockedByBzBug in project rhsm-qe by RedHatQE.

the class CertificateTests method getVerifyBaseRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists.

protected List<List<Object>> getVerifyBaseRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists() {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (clienttasks == null)
        return ll;
    // unregister
    clienttasks.unregister(null, null, null, null);
    // get the currently installed RHEL product cert
    ProductCert rhelProductCert = clienttasks.getCurrentRhelProductCert();
    // rhel product cert cannot be subscribed if a rhel product cert is not installed
    if (rhelProductCert == null)
        throw new SkipException("Failed to find an installed RHEL product cert.");
    // register with autosubscribe
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, null, null, null, null, null, null);
    // find the autosubscribed entitlement that provides access to RHEL content
    List<EntitlementCert> rhelEntitlementCerts = clienttasks.getEntitlementCertsProvidingProductCert(rhelProductCert);
    if (rhelEntitlementCerts.isEmpty()) {
        log.warning("Could not find an entitlement to a RHEL subscription.");
        return ll;
    }
    // EntitlementCert rhelEntitlementCert = clienttasks.getEntitlementCertsProvidingProductCert(rhelProductCert).get(0);
    EntitlementCert rhelEntitlementCert = rhelEntitlementCerts.get(0);
    // get the cacert file
    File caCertFile = new File(clienttasks.getConfParameter("repo_ca_cert"));
    // get the baseurl
    String baseurl = clienttasks.getConfParameter("baseurl");
    // get the repo url to the currently enabled base RHEL repo (assume it ends in /6/$releasever/$basearch/os
    // get the list of currently enabled repos
    // [root@jsefler-os6 ~]# subscription-manager repos --list-enabled
    // +----------------------------------------------------------+
    // Available Repositories in /etc/yum.repos.d/redhat.repo
    // +----------------------------------------------------------+
    // Repo ID:   rhel-6-server-rpms
    // Repo Name: Red Hat Enterprise Linux 6 Server (RPMs)
    // Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/6/$releasever/$basearch/os
    // Enabled:   1
    // [root@amd-dinar-01 ~]# subscription-manager repos --list-enabled
    // +----------------------------------------------------------+
    // Available Repositories in /etc/yum.repos.d/redhat.repo
    // +----------------------------------------------------------+
    // Repo ID:   rhel-rs-for-rhel-7-server-eus-rpms
    // Repo Name: Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)
    // Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/resilientstorage/os
    // Enabled:   1
    // 
    // Repo ID:   rhel-ha-for-rhel-7-server-eus-rpms
    // Repo Name: Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)
    // Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/highavailability/os
    // Enabled:   1
    // 
    // Repo ID:   rhel-7-server-eus-rpms
    // Repo Name: Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)
    // Repo URL:  https://cdn.redhat.com/content/eus/rhel/server/7/$releasever/$basearch/os
    // Enabled:   1
    // 
    // Repo ID:   rhel-7-server-rpms
    // Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
    // Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
    // Enabled:   1
    // RHEL-ALT Repos:
    // Product 419 aarch64 Repo rhel-7-for-arm-64-rpms        URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/armv8-a/$basearch/os
    // Product 420 ppc64le Repo rhel-7-for-power-9-rpms       URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/power9/$basearch/os
    // Product 434 s390x   Repo rhel-7-for-system-z-a-rpms	   URL: https://cdn.redhat.com/content/dist/rhel-alt/server/7/$releasever/system-z-a/$basearch/os
    String rhelRepoUrl = null;
    for (Repo enabledRepo : Repo.parse(clienttasks.repos(null, true, false, (String) null, (String) null, null, null, null, null).getStdout())) {
        if (enabledRepo.enabled) {
            // if (enabledRepo.repoUrl.endsWith(clienttasks.redhatReleaseX+"/$releasever/$basearch/os")) {	// does not match the RHEL-ALT repos
            if (enabledRepo.repoUrl.matches(baseurl + "([\\w/-]+)*/" + clienttasks.redhatReleaseX + "/\\$releasever/([\\w/-]+/)*\\$basearch/os")) {
                // skip Extended Update Support repos
                if (enabledRepo.repoUrl.contains("/eus/"))
                    continue;
                if (rhelRepoUrl != null && !rhelRepoUrl.equals(enabledRepo.repoUrl)) {
                    Assert.fail("Excluding EUS, encountered multiple enabled repos that appear to serve the base RHEL content.  Did not expect this:\n " + rhelRepoUrl + "\n " + enabledRepo.repoUrl);
                }
                rhelRepoUrl = enabledRepo.repoUrl;
            }
        }
    }
    // add each available release as a row to the dataProvider
    for (String release : clienttasks.getCurrentlyAvailableReleases(null, null, null, null)) {
        List<String> bugIds = new ArrayList<String>();
        // https://pp.engineering.redhat.com/pp/product/rhel/overview
        if (release.startsWith("6")) {
            // Bug 1214856 - cdn.redhat.com has the wrong productId version for rhel 6.2 and 6.4
            if (release.equals("6.2"))
                bugIds.add("1214856");
            // Bug 1214856 - cdn.redhat.com has the wrong productId version for rhel 6.2 and 6.4
            if (release.equals("6.4"))
                bugIds.add("1214856");
            // Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
            if (release.equals("6.2") && clienttasks.variant.equals("Server") && clienttasks.arch.matches("i386|ppc64|s390x"))
                bugIds.add("1559114");
            // Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
            if (release.equals("6.4") && clienttasks.variant.equals("Server") && clienttasks.arch.matches("i386|ppc64|s390x"))
                bugIds.add("1559114");
            // Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
            if (release.equals("6.2") && clienttasks.variant.matches("Workstation|Client|ComputeNode"))
                bugIds.add("1559114");
            // Bug 1559114 - cdn.redhat.com has the wrong productId version for many variants/arches of RHEL 6.2 and 6.4
            if (release.equals("6.4") && clienttasks.variant.matches("Workstation|Client|ComputeNode"))
                bugIds.add("1559114");
            // Bug 1302409 - cdn.redhat.com has the wrong productId version for rhel 6.6
            if (release.equals("6.6") && clienttasks.variant.matches("Client|Server") && clienttasks.arch.matches("i\\d86"))
                bugIds.add("1302409");
        }
        if (release.startsWith("7")) {
            // Bug 1261163 - uncertain of expected release listing on rhel72 arm system
            if (release.equals("7.2") && clienttasks.arch.equals("aarch64"))
                bugIds.add("1261163");
            // Bug 1441281 - production CDN productid files 404: Not Found. for ARM releasever 7.2
            if (release.equals("7.2") && clienttasks.arch.equals("aarch64"))
                bugIds.add("1441281");
            // Bug 1261171 - uncertain of expected release listing on rhel72 ppc64le system
            if (release.equals("7.2") && clienttasks.arch.equals("ppc64le"))
                bugIds.add("1261171");
            // Bug 1267732 - production CDN productid files 404: Not Found. for ComputeNode releasever 7.1 and 7Server
            if (release.equals("7.2") && clienttasks.variant.equals("ComputeNode") && release.equals("7.1"))
                bugIds.add("1267732");
            // Bug 1267732 - production CDN productid files 404: Not Found. for ComputeNode releasever 7.1 and 7Server
            if (release.equals("7.2") && clienttasks.variant.equals("ComputeNode") && release.equals("7ComputeNode"))
                bugIds.add("1267732");
            // Bug 1338857 - cdn.redhat.com has the wrong productId version for rhel 7.2
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("x86_64"))
                bugIds.add("1338857");
            // Bug 1356738 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/s390x and server/7/7Server/s390x
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
                bugIds.add("1356738");
            // Bug 1356740 - cdn.redhat.com has the wrong repodata/productId version at server/7/7.2/ppc64 and server/7/7Server/ppc64
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64"))
                bugIds.add("1356740");
            // Bug 1356710 - cdn.redhat.com has the wrong repodata/productId version at workstation/7/7.2 and workstation/7/7Workstation
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Workstation") && clienttasks.arch.equals("x86_64"))
                bugIds.add("1356710");
            // Bug 1356722 - cdn.redhat.com has the wrong repodata/productId version at computenode/7/7.2 and computenode/7/7ComputeNode
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("ComputeNode") && clienttasks.arch.equals("x86_64"))
                bugIds.add("1356722");
            // Bug 1356729 - cdn.redhat.com has the wrong repodata/productId version at client/7/7.2 and client/7/7Client
            if (!release.matches("7.0|7.1") && clienttasks.variant.equals("Client") && clienttasks.arch.equals("x86_64"))
                bugIds.add("1356729");
            // Bug 1351754 - production CDN productid files 404: Not Found. for Power, little endian releasever 7.1, 7.2, and 7Server
            if (release.matches("7.0|7.1|7.2") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64le"))
                bugIds.add("1351754");
            // Bug 1351800 - production CDN productid files 404: Not Found. for ARM releasever 7.1, 7.2, and 7Server
            if (release.matches("7.*") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("aarch64"))
                bugIds.add("1351800");
        }
        BlockedByBzBug blockedByBzBug = new BlockedByBzBug(bugIds.toArray(new String[] {}));
        // Object blockedByBug, String release, String rhelRepoUrl, File rhelEntitlementCertFile, File caCertFile
        ll.add(Arrays.asList(new Object[] { blockedByBzBug, release, rhelRepoUrl, rhelEntitlementCert.file, caCertFile }));
    }
    return ll;
}
Also used : EntitlementCert(rhsm.data.EntitlementCert) ArrayList(java.util.ArrayList) ProductCert(rhsm.data.ProductCert) Repo(rhsm.data.Repo) ArrayList(java.util.ArrayList) List(java.util.List) SkipException(org.testng.SkipException) File(java.io.File) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug)

Example 40 with BlockedByBzBug

use of com.redhat.qe.auto.bugzilla.BlockedByBzBug in project rhsm-qe by RedHatQE.

the class BugzillaTests method getVerifyEUSRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists.

protected List<List<Object>> getVerifyEUSRHELProductCertVersionFromEachCDNReleaseVersion_TestDataAsListOfLists() throws JSONException, Exception {
    List<List<Object>> ll = new ArrayList<List<Object>>();
    if (!isSetupBeforeSuiteComplete)
        return ll;
    if (clienttasks == null)
        return ll;
    String eusProductId = null;
    if ((clienttasks.arch.equals("ppc64")) && (clienttasks.variant.equals("Server")))
        eusProductId = "75";
    else if ((clienttasks.arch.equals("x86_64")) && (clienttasks.variant.equals("Server")))
        eusProductId = "70";
    else if ((clienttasks.arch.equals("x86_64")) && clienttasks.variant.equals("ComputeNode"))
        eusProductId = "217";
    else if ((clienttasks.arch.equals("s390x")) && (clienttasks.variant.equals("Server")))
        eusProductId = "73";
    if (eusProductId == null) {
        log.warning("This test does not yet cover variant '" + clienttasks.variant + "' on arch '" + clienttasks.arch + "'.");
        // return no rows and no test will be run
        return ll;
    }
    // unregister
    clienttasks.unregister(null, null, null, null);
    // register
    clienttasks.register(sm_clientUsername, sm_clientPassword, sm_clientOrg, null, null, null, null, true, null, null, (String) null, null, null, null, null, null, null, null, null, null);
    // get current product cert and verify that rhelproduct is installed on
    // the system
    ProductCert rhelProductCert = clienttasks.getCurrentRhelProductCert();
    SubscriptionPool pool = null;
    for (SubscriptionPool eusSubscriptionPool : SubscriptionPool.parse(clienttasks.list(null, true, null, null, null, null, null, null, "*Extended*", null, null, null, null, null).getStdout())) {
        if ((CandlepinTasks.getPoolProvidedProductIds(sm_client1Username, sm_client1Password, sm_serverUrl, eusSubscriptionPool.poolId).contains(eusProductId))) {
            // and attach eus subscription
            clienttasks.subscribe(null, null, eusSubscriptionPool.poolId, null, null, null, null, null, null, null, null, null, null);
            pool = eusSubscriptionPool;
            break;
        }
    }
    if (pool == null) {
        log.warning("Could not find an available EUS subscription that covers EUS product '" + eusProductId + "'.");
        // return no rows and no test will be run
        return ll;
    }
    // find the entitlement that provides access to RHEL and EUS
    EntitlementCert eusEntitlementCerts = clienttasks.getEntitlementCertCorrespondingToSubscribedPool(pool);
    if (eusEntitlementCerts == null) {
        return ll;
    }
    // if eus repo is not enabled , enable it
    String rhelRepoUrl = null;
    for (Repo disabledRepo : Repo.parse(clienttasks.repos(null, false, true, (String) null, (String) null, null, null, null, null).getStdout())) {
        String variant = null;
        if (clienttasks.arch.equals("x86_64")) {
            if (clienttasks.variant.equals("ComputeNode"))
                variant = "hpc-node";
            if (clienttasks.variant.equals("Server"))
                variant = "server";
        } else if (clienttasks.arch.equals("ppc64") || (clienttasks.arch.equals("ppc64le"))) {
            variant = "for-power";
        } else if (clienttasks.arch.equals("s390x"))
            variant = "for-system-z";
        // add repos for eus-source rpms and debug rpms
        if ((disabledRepo.repoId.matches("rhel-[0-9]+-" + variant + "-eus-rpms"))) {
            clienttasks.repos(null, null, null, disabledRepo.repoId, (String) null, null, null, null, null);
        }
    }
    for (// if eus repo is enabled then add it to the data provider
    Repo enabledRepo : Repo.parse(clienttasks.repos(null, true, false, (String) null, (String) null, null, null, null, null).getStdout())) {
        if (enabledRepo.enabled) {
            String variant = null;
            if (clienttasks.arch.equals("x86_64")) {
                if (clienttasks.variant.equals("ComputeNode"))
                    variant = "hpc-node";
                if (clienttasks.variant.equals("Server"))
                    variant = "server";
            } else if (clienttasks.arch.equals("ppc64") || (clienttasks.arch.equals("ppc64le"))) {
                variant = "for-power";
            } else if (clienttasks.arch.equals("s390x"))
                variant = "for-system-z";
            if (enabledRepo.repoId.matches("rhel-[0-9]+-" + variant + "-eus-rpms")) {
                rhelRepoUrl = enabledRepo.repoUrl;
            }
        }
    }
    // against ppc64le
    for (String release : clienttasks.getCurrentlyAvailableReleases(null, null, null, null)) {
        // skip the latest releases; e.g. 6Server
        if (!isFloat(release))
            continue;
        List<String> bugIds = new ArrayList<String>();
        if (release.startsWith("6")) {
            if (release.matches("6.4") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("x86_64"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c16
                bugIds.add("1357574");
            if (release.matches("6.4") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("i386"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.5") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("i386"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.6") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("i386"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.4") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.5") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.6") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("s390x"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c18
                bugIds.add("1357574");
            if (release.matches("6.5") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c19
                bugIds.add("1357574");
            if (release.matches("6.6") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("ppc64"))
                // https://bugzilla.redhat.com/show_bug.cgi?id=1357574#c19
                bugIds.add("1357574");
            if (release.matches("6.7") && clienttasks.variant.equals("Server") && clienttasks.arch.equals("x86_64"))
                bugIds.add("1352162");
        }
        if (release.startsWith("7")) {
            if (// && clienttasks.variant.equals("Server"))
            release.matches("7.1"))
                bugIds.add("1369920");
        }
        BlockedByBzBug blockedByBzBug = new BlockedByBzBug(bugIds.toArray(new String[] {}));
        ll.add(Arrays.asList(new Object[] { blockedByBzBug, release, rhelRepoUrl, eusEntitlementCerts.file }));
    }
    return ll;
}
Also used : EntitlementCert(rhsm.data.EntitlementCert) Repo(rhsm.data.Repo) YumRepo(rhsm.data.YumRepo) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) JSONObject(org.json.JSONObject) ProductCert(rhsm.data.ProductCert) SubscriptionPool(rhsm.data.SubscriptionPool) BlockedByBzBug(com.redhat.qe.auto.bugzilla.BlockedByBzBug)

Aggregations

BlockedByBzBug (com.redhat.qe.auto.bugzilla.BlockedByBzBug)67 ArrayList (java.util.ArrayList)67 List (java.util.List)67 JSONObject (org.json.JSONObject)21 HashSet (java.util.HashSet)18 File (java.io.File)14 DataProvider (org.testng.annotations.DataProvider)14 SubscriptionPool (rhsm.data.SubscriptionPool)7 BigInteger (java.math.BigInteger)5 ProductCert (rhsm.data.ProductCert)5 HashMap (java.util.HashMap)3 JSONArray (org.json.JSONArray)3 EntitlementCert (rhsm.data.EntitlementCert)3 Repo (rhsm.data.Repo)2 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 SkipException (org.testng.SkipException)1 ConsumerType (rhsm.base.ConsumerType)1 YumRepo (rhsm.data.YumRepo)1