{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/comments/67190807","id":67190807,"diff_hunk":"@@ -0,0 +1,231 @@\n+/*\n+ * --------------------------------- START OF LICENSE ----------------------------\n+ *\n+ * MySQL cimprov ver. 1.0\n+ *\n+ * Copyright (c) Microsoft Corporation\n+ *\n+ * All rights reserved. \n+ *\n+ * MIT License\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"\"Software\"\"), to deal\n+ * in the Software without restriction, including without limitation the rights to\n+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n+ * of the Software, and to permit persons to whom the Software is furnished to do\n+ * so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in all\n+ * copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ *\n+ * ---------------------------------- END OF LICENSE -----------------------------\n+*/\n+/*--------------------------------------------------------------------------------\n+\n+    Created date    2016-06-09 08:31:00\n+\n+    MySQL Config file loading unit tests.\n+\n+*/\n+/*----------------------------------------------------------------------------*/\n+\n+#include <scxcorelib/scxcmn.h>\n+#include <scxcorelib/scxexception.h>\n+#include <scxcorelib/scxfile.h>\n+#include <scxcorelib/stringaid.h>\n+#include <testutils/scxunit.h>\n+#include <testutils/providertestutils.h>\n+\n+#include <iostream> // for cout\n+#include <vector>\n+#include <map>\n+\n+#include \"mycnf-scanner.h\"\n+\n+using namespace SCXCoreLib;\n+\n+class MySQL_ScannerTestAuthenticationDependencies : public MySQL_AuthenticationDependencies\n+{\n+public:\n+    virtual SCXCoreLib::SCXFilePath GetDefaultAuthFileName(uid_t /* uid */) const\n+    {\n+        return L\"./does-not-exist.cnf\";\n+    }\n+\n+    virtual bool Force_AutoUpdate_Flag() { return true; }\n+};\n+\n+class ConfigScanner_Test : public CPPUNIT_NS::TestFixture\n+{\n+    CPPUNIT_TEST_SUITE( ConfigScanner_Test );\n+\n+    CPPUNIT_TEST( testCnfScan_RHELCnf_Success );\n+    CPPUNIT_TEST( testCnfScan_SLESCnf_Success );\n+    CPPUNIT_TEST( testCnfScan_CnfWithIncludeFileDirective_Success );\n+    CPPUNIT_TEST( testCnfScan_DebianCnf_Success );\n+    CPPUNIT_TEST( testCnfScan_DirectivesFormHierarchy_Success );\n+    CPPUNIT_TEST( testCnfScan_CnfWithIncludeFileIncludesItself_Throws );\n+    CPPUNIT_TEST( testCnfScan_IncludeDirsFormLoop_Throws );\n+    CPPUNIT_TEST( testCnfScan_CnfFileMissingIncludeDir_Throws );\n+    CPPUNIT_TEST( testCnfScan_CnfFileMissingInclude_Throws );\n+    CPPUNIT_TEST( testCnfScan_InvalidIncludeDir_Throws );\n+    CPPUNIT_TEST( testCnfScan_InvalidInclude_Throws );\n+\n+    CPPUNIT_TEST_SUITE_END();\n+\n+private:\n+\n+public:\n+    void setUp(void)\n+    {\n+    }\n+\n+    void tearDown(void)\n+    {\n+    }\n+\n+    void ValidateAuth(std::map< unsigned int, std::string >& expected, MySQL_Authentication& auth)\n+    {\n+        std::vector<unsigned int> authPorts;\n+        auth.GetPortList( authPorts );\n+        CPPUNIT_ASSERT_EQUAL(expected.size(), authPorts.size());\n+        for (std::vector<unsigned int>::const_iterator it = authPorts.begin(); it != authPorts.end(); ++it)\n+        {\n+            MySQL_AuthenticationEntry authEntry;\n+            auth.GetEntry(*it, authEntry);\n+            CPPUNIT_ASSERT_EQUAL(expected[authEntry.port], authEntry.binding);\n+        }\n+    }\n+\n+    void testCnfScan_RHELCnf_Success()\n+    {\n+        MySQL_Authentication auth( SCXHandle<MySQL_AuthenticationDependencies>(new MySQL_ScannerTestAuthenticationDependencies()));\n+        auth.Load();\n+\n+        std::map< unsigned int, std::string > portBindingMap;\n+        portBindingMap[3306] = \"127.0.0.1\";\n+\n+        MySQL::MySQL_ConfigurationScanner scanner;\n+        scanner.Scan(L\"cnfs/rhel/my.cnf\", auth);","path":"test/code/omi_preexec/config_scanner_test.cpp","position":118,"original_position":118,"commit_id":"dfed34b701fe10e612efcc18c67e8fffb50e160a","original_commit_id":"dfed34b701fe10e612efcc18c67e8fffb50e160a","user":{"login":"jeffaco","id":13700943,"avatar_url":"https://avatars.githubusercontent.com/u/13700943?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffaco","html_url":"https://github.com/jeffaco","followers_url":"https://api.github.com/users/jeffaco/followers","following_url":"https://api.github.com/users/jeffaco/following{/other_user}","gists_url":"https://api.github.com/users/jeffaco/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffaco/subscriptions","organizations_url":"https://api.github.com/users/jeffaco/orgs","repos_url":"https://api.github.com/users/jeffaco/repos","events_url":"https://api.github.com/users/jeffaco/events{/privacy}","received_events_url":"https://api.github.com/users/jeffaco/received_events","type":"User","site_admin":false},"body":"Oh, I see how this works, and why you're copying the files from their source location to the intermediate directory.  But what happens if my.cnf includes something else? Do you have to modify the checked in config files to be careful about paths?\r\n\r\nIf so, I would have preferred that you pass in a directory prefix to the test dependency object and have that prefix any directory (from !include or !includedir), thus allowing you to run \"in place\", without copying files around. I haven't looked at the actual configuration files yet, so I don't know if you modified this from what was shipped.","created_at":"2016-06-15T15:58:03Z","updated_at":"2016-06-15T15:58:03Z","html_url":"https://github.com/Microsoft/MySQL-Provider/pull/5#discussion_r67190807","pull_request_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/comments/67190807"},"html":{"href":"https://github.com/Microsoft/MySQL-Provider/pull/5#discussion_r67190807"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5","id":73367741,"html_url":"https://github.com/Microsoft/MySQL-Provider/pull/5","diff_url":"https://github.com/Microsoft/MySQL-Provider/pull/5.diff","patch_url":"https://github.com/Microsoft/MySQL-Provider/pull/5.patch","issue_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/5","number":5,"state":"open","locked":false,"title":"Fixing Bug#7554562 - Supporting \"!include\" and \"!includedir\" directives","user":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"body":"This commit introduces support for \"include\" and \"includedir\" directives in MySQL configuration files\r\n\r\n","created_at":"2016-06-10T12:44:31Z","updated_at":"2016-06-15T15:58:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b78046f28967b10da861ed622b35de440b7199eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5/commits","review_comments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5/comments","review_comment_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/5/comments","statuses_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/statuses/dfed34b701fe10e612efcc18c67e8fffb50e160a","head":{"label":"Microsoft:skapila/ConfigDirectives","ref":"skapila/ConfigDirectives","sha":"dfed34b701fe10e612efcc18c67e8fffb50e160a","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":47793697,"name":"MySQL-Provider","full_name":"Microsoft/MySQL-Provider","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/MySQL-Provider","description":"MySQL Monitoring Agent for OMI Server","fork":false,"url":"https://api.github.com/repos/Microsoft/MySQL-Provider","forks_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/forks","keys_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/teams","hooks_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/events","assignees_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/tags","blobs_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/languages","stargazers_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/subscription","commits_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/merges","archive_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/downloads","issues_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/deployments","created_at":"2015-12-10T23:33:24Z","updated_at":"2016-04-12T20:26:00Z","pushed_at":"2016-06-15T10:26:01Z","git_url":"git://github.com/Microsoft/MySQL-Provider.git","ssh_url":"git@github.com:Microsoft/MySQL-Provider.git","clone_url":"https://github.com/Microsoft/MySQL-Provider.git","svn_url":"https://github.com/Microsoft/MySQL-Provider","homepage":null,"size":7471,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"07381ab0f2ba1441b82173170a4dfc3d19c337f4","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":47793697,"name":"MySQL-Provider","full_name":"Microsoft/MySQL-Provider","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/MySQL-Provider","description":"MySQL Monitoring Agent for OMI Server","fork":false,"url":"https://api.github.com/repos/Microsoft/MySQL-Provider","forks_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/forks","keys_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/teams","hooks_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/events","assignees_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/tags","blobs_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/languages","stargazers_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/subscription","commits_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/merges","archive_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/downloads","issues_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/MySQL-Provider/deployments","created_at":"2015-12-10T23:33:24Z","updated_at":"2016-04-12T20:26:00Z","pushed_at":"2016-06-15T10:26:01Z","git_url":"git://github.com/Microsoft/MySQL-Provider.git","ssh_url":"git@github.com:Microsoft/MySQL-Provider.git","clone_url":"https://github.com/Microsoft/MySQL-Provider.git","svn_url":"https://github.com/Microsoft/MySQL-Provider","homepage":null,"size":7471,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5"},"html":{"href":"https://github.com/Microsoft/MySQL-Provider/pull/5"},"issue":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/5"},"comments":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/MySQL-Provider/statuses/dfed34b701fe10e612efcc18c67e8fffb50e160a"}}}}
{"actor":{"display_login":"jeffaco"}}