Return-Path: X-Original-To: apmail-hawq-dev-archive@minotaur.apache.org Delivered-To: apmail-hawq-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 57F8A18440 for ; Tue, 22 Dec 2015 00:56:26 +0000 (UTC) Received: (qmail 52159 invoked by uid 500); 22 Dec 2015 00:56:26 -0000 Delivered-To: apmail-hawq-dev-archive@hawq.apache.org Received: (qmail 52099 invoked by uid 500); 22 Dec 2015 00:56:26 -0000 Mailing-List: contact dev-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list dev@hawq.incubator.apache.org Received: (qmail 52088 invoked by uid 99); 22 Dec 2015 00:56:25 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2015 00:56:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 14B4A1804C6 for ; Tue, 22 Dec 2015 00:56:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.427 X-Spam-Level: X-Spam-Status: No, score=0.427 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id VLozWG5ogVdE for ; Tue, 22 Dec 2015 00:56:15 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 6A28220FD2 for ; Tue, 22 Dec 2015 00:56:15 +0000 (UTC) Received: (qmail 51929 invoked by uid 99); 22 Dec 2015 00:56:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2015 00:56:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2A8E0E07BA; Tue, 22 Dec 2015 00:56:15 +0000 (UTC) From: hornn To: dev@hawq.incubator.apache.org Reply-To: dev@hawq.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-hawq pull request: Hawq 257 Content-Type: text/plain Message-Id: <20151222005615.2A8E0E07BA@git1-us-west.apache.org> Date: Tue, 22 Dec 2015 00:56:15 +0000 (UTC) Github user hornn commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/206#discussion_r48211299 --- Diff: src/backend/access/external/test/pxfuriparser_test.c --- @@ -76,6 +77,87 @@ test__parseGPHDUri__ValidURI(void **state) } /* + * Test parsing of valid uri with with nameservice instead of host and port + * as given in LOCATION in a PXF external table. + */ +void +test__parseGPHDUri__ValidURI_HA(void **state) +{ + char* uri = "pxf://hanameservice/some/path/and/table.tbl?FRAGMENTER=SomeFragmenter&ACCESSOR=SomeAccessor&RESOLVER=SomeResolver&ANALYZER=SomeAnalyzer"; + List* options = NIL; + ListCell* cell = NULL; + OptionData* option = NULL; + + /* mock GPHD_HA_load_nodes */ + NNHAConf* ha_conf = (NNHAConf *)palloc0(sizeof(NNHAConf)); + ha_conf->nameservice = "hanameservice"; + ha_conf->numn = 2; + ha_conf->nodes = ((char**)palloc0(sizeof(char*) * 2)); + ha_conf->nodes[0] = "node1"; + ha_conf->restports = ((char**)palloc0(sizeof(char*) * 2)); + ha_conf->restports[0] = "1001"; + expect_string(GPHD_HA_load_nodes, nameservice, "hanameservice"); + will_return(GPHD_HA_load_nodes, ha_conf); + + /* mode GPHD_HA_release_nodes */ + expect_value(GPHD_HA_release_nodes, conf, ha_conf); + will_be_called(GPHD_HA_release_nodes); + + GPHDUri* parsed = parseGPHDUri(uri); + + assert_true(parsed != NULL); + assert_string_equal(parsed->uri, uri); + + assert_string_equal(parsed->protocol, "pxf"); + assert_string_equal(parsed->host, "node1"); /* value should be taken from ha_nodes */ + assert_string_equal(parsed->port, "1001"); /* it should be taken from ha_nodes */ + assert_false(parsed->ha_nodes == NULL); + assert_string_equal(parsed->data, "some/path/and/table.tbl"); + + freeGPHDUri(parsed); + + /* free NNHAConf */ + if (ha_conf) + { + pfree(ha_conf->nodes); + pfree(ha_conf->restports); + pfree(ha_conf); + } +} + +/* + * Test parsing of valid uri as given in LOCATION in a PXF external table, + * with pxf_isilon set to true. + */ +void +test__parseGPHDUri__ValidURI_Isilon(void **state) +{ + char* uri = "pxf://servername:5000/some/path/and/table.tbl?FRAGMENTER=SomeFragmenter&ACCESSOR=SomeAccessor&RESOLVER=SomeResolver&ANALYZER=SomeAnalyzer"; + List* options = NIL; + ListCell* cell = NULL; + OptionData* option = NULL; + + /* set pxf_isilon to true */ + pxf_isilon = true; + + GPHDUri* parsed = parseGPHDUri(uri); + + assert_true(parsed != NULL); + assert_string_equal(parsed->uri, uri); + + assert_string_equal(parsed->protocol, "pxf"); + assert_string_equal(parsed->host, "servername"); + assert_int_equal(atoi(parsed->port), pxf_service_port); /* it should be pxf_service_port */ + assert_true(parsed->ha_nodes == NULL); + assert_string_equal(parsed->data, "some/path/and/table.tbl"); + + freeGPHDUri(parsed); + + /* set pxf_isilon back to false */ + pxf_isilon = false; --- End diff -- It's a system variable, so if I change it in the beginning of the test (line 141) I should clean after me. It can potentially affect other tests that assume it has specific value, although that's not very likely. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---