{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/typha/pulls/comments/122200413","pull_request_review_id":44294475,"id":122200413,"diff_hunk":"@@ -0,0 +1,169 @@\n+// Copyright (c) 2017 Tigera, Inc. All rights reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package daemon_test\n+\n+import (\n+\t. \"github.com/projectcalico/typha/pkg/daemon\"\n+\n+\t\"context\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\n+\t. \"github.com/onsi/ginkgo\"\n+\t. \"github.com/onsi/gomega\"\n+\n+\t\"github.com/projectcalico/libcalico-go/lib/api\"\n+\tbapi \"github.com/projectcalico/libcalico-go/lib/backend/api\"\n+\t\"github.com/projectcalico/typha/fv-tests\"\n+\t\"github.com/projectcalico/typha/pkg/config\"\n+\t\"github.com/projectcalico/typha/pkg/syncclient\"\n+\t\"github.com/projectcalico/typha/pkg/syncserver\"\n+)\n+\n+var configContents = []byte(`[default]\n+LogFilePath=none\n+`)\n+\n+var _ = Describe(\"Daemon\", func() {\n+\tvar d *TyphaDaemon\n+\tvar backend *mockBackend\n+\tvar newClientErr error\n+\tvar earlyLoggingConfigured, loggingConfigured bool\n+\n+\tBeforeEach(func() {\n+\t\td = New()\n+\t\tbackend = &mockBackend{}\n+\t\td.NewBackendClient = func(config api.CalicoAPIConfig) (c BackendClient, err error) {\n+\t\t\treturn backend, newClientErr\n+\t\t}\n+\t\tearlyLoggingConfigured = false\n+\t\tloggingConfigured = false\n+\t\td.ConfigureEarlyLogging = func() {\n+\t\t\tearlyLoggingConfigured = true\n+\t\t}\n+\t\td.ConfigureLogging = func(config *config.Config) {\n+\t\t\tExpect(config).ToNot(BeNil())\n+\t\t\tloggingConfigured = true\n+\t\t}\n+\t})\n+\n+\tIt(\"shouldn't panic when DoEarlyRuntimeSetup is called\", func() {\n+\t\td.DoEarlyRuntimeSetup()\n+\t\tExpect(earlyLoggingConfigured).To(BeTrue())\n+\t})\n+\n+\tIt(\"should parse the config file path\", func() {\n+\t\td.ParseCommandLineArgs([]string{\"-c\", \"/tmp/config.cfg\"})\n+\t\tExpect(d.ConfigFilePath).To(Equal(\"/tmp/config.cfg\"))\n+\t})\n+\n+\tIt(\"should default the config file path\", func() {\n+\t\td.ParseCommandLineArgs([]string{})\n+\t\tExpect(d.ConfigFilePath).To(Equal(\"/etc/calico/typha.cfg\"))\n+\t})\n+\n+\tDescribe(\"with a config file loaded\", func() {\n+\t\tvar configFile *os.File\n+\n+\t\tBeforeEach(func() {\n+\t\t\tvar err error\n+\t\t\tconfigFile, err = ioutil.TempFile(\"\", \"typha\")\n+\t\t\tExpect(err).NotTo(HaveOccurred())\n+\n+\t\t\t_, err = configFile.Write(configContents)\n+\t\t\tExpect(err).NotTo(HaveOccurred())\n+\t\t\terr = configFile.Close()\n+\t\t\tExpect(err).NotTo(HaveOccurred())\n+\n+\t\t\td.ParseCommandLineArgs([]string{\"-c\", configFile.Name()})\n+\t\t\td.LoadConfiguration()\n+\t\t\tExpect(loggingConfigured).To(BeTrue())\n+\t\t})\n+\t\tAfterEach(func() {\n+\t\t\tos.Remove(configFile.Name())\n+\t\t})\n+\n+\t\tIt(\"should load the configuration and connect to the datastore\", func() {\n+\t\t\tExpect(backend.initCalled).To(BeTrue())\n+\t\t})\n+\n+\t\tIt(\"should create the server components\", func() {\n+\t\t\td.CreateServer()\n+\t\t\tExpect(d.SyncerToValidator).ToNot(BeNil())\n+\t\t\tExpect(d.Syncer).ToNot(BeNil())\n+\t\t\tExpect(d.SyncerToValidator).ToNot(BeNil())\n+\t\t\tExpect(d.ValidatorToCache).ToNot(BeNil())\n+\t\t\tExpect(d.Validator).ToNot(BeNil())\n+\t\t\tExpect(d.Cache).ToNot(BeNil())\n+\t\t\tExpect(d.Server).ToNot(BeNil())\n+\t\t})\n+\n+\t\tIt(\"should start a working server\", func() {\n+\t\t\t// Bypass the config validation to tell the server to pick a random port (so we won't clash)\n+\t\t\td.ConfigParams.ServerPort = syncserver.PortRandom\n+\t\t\td.CreateServer()\n+\n+\t\t\t// Start the server with a context that we can cancel.\n+\t\t\tcxt, cancelFn := context.WithCancel(context.Background())\n+\t\t\tdefer cancelFn()","path":"pkg/daemon/daemon_test.go","position":121,"original_position":121,"commit_id":"e7a69a5116cb000a84d61d3bdad005c9f6fd9d55","original_commit_id":"e7a69a5116cb000a84d61d3bdad005c9f6fd9d55","user":{"login":"fasaxc","id":469264,"avatar_url":"https://avatars3.githubusercontent.com/u/469264?v=3","gravatar_id":"","url":"https://api.github.com/users/fasaxc","html_url":"https://github.com/fasaxc","followers_url":"https://api.github.com/users/fasaxc/followers","following_url":"https://api.github.com/users/fasaxc/following{/other_user}","gists_url":"https://api.github.com/users/fasaxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fasaxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasaxc/subscriptions","organizations_url":"https://api.github.com/users/fasaxc/orgs","repos_url":"https://api.github.com/users/fasaxc/repos","events_url":"https://api.github.com/users/fasaxc/events{/privacy}","received_events_url":"https://api.github.com/users/fasaxc/received_events","type":"User","site_admin":false},"body":"The context is really there just to let the tests tear it down.  Not sure what I can do to improve on that.","created_at":"2017-06-15T13:20:31Z","updated_at":"2017-06-15T13:20:31Z","html_url":"https://github.com/projectcalico/typha/pull/23#discussion_r122200413","pull_request_url":"https://api.github.com/repos/projectcalico/typha/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/comments/122200413"},"html":{"href":"https://github.com/projectcalico/typha/pull/23#discussion_r122200413"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/projectcalico/typha/pulls/23","id":125612870,"html_url":"https://github.com/projectcalico/typha/pull/23","diff_url":"https://github.com/projectcalico/typha/pull/23.diff","patch_url":"https://github.com/projectcalico/typha/pull/23.patch","issue_url":"https://api.github.com/repos/projectcalico/typha/issues/23","number":23,"state":"open","locked":false,"title":"Add FV tests for \"main\"","user":{"login":"fasaxc","id":469264,"avatar_url":"https://avatars3.githubusercontent.com/u/469264?v=3","gravatar_id":"","url":"https://api.github.com/users/fasaxc","html_url":"https://github.com/fasaxc","followers_url":"https://api.github.com/users/fasaxc/followers","following_url":"https://api.github.com/users/fasaxc/following{/other_user}","gists_url":"https://api.github.com/users/fasaxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fasaxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasaxc/subscriptions","organizations_url":"https://api.github.com/users/fasaxc/orgs","repos_url":"https://api.github.com/users/fasaxc/repos","events_url":"https://api.github.com/users/fasaxc/events{/privacy}","received_events_url":"https://api.github.com/users/fasaxc/received_events","type":"User","site_admin":false},"body":"Move the \"main\" function to a library package and break it up for ease of mocking/testing.\r\n\r\nBuilds heavily on #20","created_at":"2017-06-14T14:39:54Z","updated_at":"2017-06-15T13:20:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a37308747d98aea48fc36581456d10faed062886","assignee":{"login":"neiljerram","id":2089263,"avatar_url":"https://avatars2.githubusercontent.com/u/2089263?v=3","gravatar_id":"","url":"https://api.github.com/users/neiljerram","html_url":"https://github.com/neiljerram","followers_url":"https://api.github.com/users/neiljerram/followers","following_url":"https://api.github.com/users/neiljerram/following{/other_user}","gists_url":"https://api.github.com/users/neiljerram/gists{/gist_id}","starred_url":"https://api.github.com/users/neiljerram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neiljerram/subscriptions","organizations_url":"https://api.github.com/users/neiljerram/orgs","repos_url":"https://api.github.com/users/neiljerram/repos","events_url":"https://api.github.com/users/neiljerram/events{/privacy}","received_events_url":"https://api.github.com/users/neiljerram/received_events","type":"User","site_admin":false},"assignees":[{"login":"neiljerram","id":2089263,"avatar_url":"https://avatars2.githubusercontent.com/u/2089263?v=3","gravatar_id":"","url":"https://api.github.com/users/neiljerram","html_url":"https://github.com/neiljerram","followers_url":"https://api.github.com/users/neiljerram/followers","following_url":"https://api.github.com/users/neiljerram/following{/other_user}","gists_url":"https://api.github.com/users/neiljerram/gists{/gist_id}","starred_url":"https://api.github.com/users/neiljerram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neiljerram/subscriptions","organizations_url":"https://api.github.com/users/neiljerram/orgs","repos_url":"https://api.github.com/users/neiljerram/repos","events_url":"https://api.github.com/users/neiljerram/events{/privacy}","received_events_url":"https://api.github.com/users/neiljerram/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/typha/pulls/23/commits","review_comments_url":"https://api.github.com/repos/projectcalico/typha/pulls/23/comments","review_comment_url":"https://api.github.com/repos/projectcalico/typha/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/typha/issues/23/comments","statuses_url":"https://api.github.com/repos/projectcalico/typha/statuses/e7a69a5116cb000a84d61d3bdad005c9f6fd9d55","head":{"label":"fasaxc:fv-main","ref":"fv-main","sha":"e7a69a5116cb000a84d61d3bdad005c9f6fd9d55","user":{"login":"fasaxc","id":469264,"avatar_url":"https://avatars3.githubusercontent.com/u/469264?v=3","gravatar_id":"","url":"https://api.github.com/users/fasaxc","html_url":"https://github.com/fasaxc","followers_url":"https://api.github.com/users/fasaxc/followers","following_url":"https://api.github.com/users/fasaxc/following{/other_user}","gists_url":"https://api.github.com/users/fasaxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fasaxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasaxc/subscriptions","organizations_url":"https://api.github.com/users/fasaxc/orgs","repos_url":"https://api.github.com/users/fasaxc/repos","events_url":"https://api.github.com/users/fasaxc/events{/privacy}","received_events_url":"https://api.github.com/users/fasaxc/received_events","type":"User","site_admin":false},"repo":{"id":93146257,"name":"typha","full_name":"fasaxc/typha","owner":{"login":"fasaxc","id":469264,"avatar_url":"https://avatars3.githubusercontent.com/u/469264?v=3","gravatar_id":"","url":"https://api.github.com/users/fasaxc","html_url":"https://github.com/fasaxc","followers_url":"https://api.github.com/users/fasaxc/followers","following_url":"https://api.github.com/users/fasaxc/following{/other_user}","gists_url":"https://api.github.com/users/fasaxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fasaxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasaxc/subscriptions","organizations_url":"https://api.github.com/users/fasaxc/orgs","repos_url":"https://api.github.com/users/fasaxc/repos","events_url":"https://api.github.com/users/fasaxc/events{/privacy}","received_events_url":"https://api.github.com/users/fasaxc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fasaxc/typha","description":"Experimental: Calico's Felix Syncer fan-out daemon.","fork":true,"url":"https://api.github.com/repos/fasaxc/typha","forks_url":"https://api.github.com/repos/fasaxc/typha/forks","keys_url":"https://api.github.com/repos/fasaxc/typha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fasaxc/typha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fasaxc/typha/teams","hooks_url":"https://api.github.com/repos/fasaxc/typha/hooks","issue_events_url":"https://api.github.com/repos/fasaxc/typha/issues/events{/number}","events_url":"https://api.github.com/repos/fasaxc/typha/events","assignees_url":"https://api.github.com/repos/fasaxc/typha/assignees{/user}","branches_url":"https://api.github.com/repos/fasaxc/typha/branches{/branch}","tags_url":"https://api.github.com/repos/fasaxc/typha/tags","blobs_url":"https://api.github.com/repos/fasaxc/typha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fasaxc/typha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fasaxc/typha/git/refs{/sha}","trees_url":"https://api.github.com/repos/fasaxc/typha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fasaxc/typha/statuses/{sha}","languages_url":"https://api.github.com/repos/fasaxc/typha/languages","stargazers_url":"https://api.github.com/repos/fasaxc/typha/stargazers","contributors_url":"https://api.github.com/repos/fasaxc/typha/contributors","subscribers_url":"https://api.github.com/repos/fasaxc/typha/subscribers","subscription_url":"https://api.github.com/repos/fasaxc/typha/subscription","commits_url":"https://api.github.com/repos/fasaxc/typha/commits{/sha}","git_commits_url":"https://api.github.com/repos/fasaxc/typha/git/commits{/sha}","comments_url":"https://api.github.com/repos/fasaxc/typha/comments{/number}","issue_comment_url":"https://api.github.com/repos/fasaxc/typha/issues/comments{/number}","contents_url":"https://api.github.com/repos/fasaxc/typha/contents/{+path}","compare_url":"https://api.github.com/repos/fasaxc/typha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fasaxc/typha/merges","archive_url":"https://api.github.com/repos/fasaxc/typha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fasaxc/typha/downloads","issues_url":"https://api.github.com/repos/fasaxc/typha/issues{/number}","pulls_url":"https://api.github.com/repos/fasaxc/typha/pulls{/number}","milestones_url":"https://api.github.com/repos/fasaxc/typha/milestones{/number}","notifications_url":"https://api.github.com/repos/fasaxc/typha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fasaxc/typha/labels{/name}","releases_url":"https://api.github.com/repos/fasaxc/typha/releases{/id}","deployments_url":"https://api.github.com/repos/fasaxc/typha/deployments","created_at":"2017-06-02T08:45:23Z","updated_at":"2017-06-02T08:45:25Z","pushed_at":"2017-06-15T08:11:50Z","git_url":"git://github.com/fasaxc/typha.git","ssh_url":"git@github.com:fasaxc/typha.git","clone_url":"https://github.com/fasaxc/typha.git","svn_url":"https://github.com/fasaxc/typha","homepage":null,"size":222,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"projectcalico:master","ref":"master","sha":"57d40eee5ce198d075322dd5e6c36bfb264adb22","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars0.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":93076738,"name":"typha","full_name":"projectcalico/typha","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars0.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/typha","description":"Beta: Calico's Felix datastore fan-out daemon.","fork":false,"url":"https://api.github.com/repos/projectcalico/typha","forks_url":"https://api.github.com/repos/projectcalico/typha/forks","keys_url":"https://api.github.com/repos/projectcalico/typha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/typha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/typha/teams","hooks_url":"https://api.github.com/repos/projectcalico/typha/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/typha/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/typha/events","assignees_url":"https://api.github.com/repos/projectcalico/typha/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/typha/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/typha/tags","blobs_url":"https://api.github.com/repos/projectcalico/typha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/typha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/typha/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/typha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/typha/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/typha/languages","stargazers_url":"https://api.github.com/repos/projectcalico/typha/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/typha/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/typha/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/typha/subscription","commits_url":"https://api.github.com/repos/projectcalico/typha/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/typha/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/typha/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/typha/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/typha/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/typha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/typha/merges","archive_url":"https://api.github.com/repos/projectcalico/typha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/typha/downloads","issues_url":"https://api.github.com/repos/projectcalico/typha/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/typha/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/typha/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/typha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/typha/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/typha/releases{/id}","deployments_url":"https://api.github.com/repos/projectcalico/typha/deployments","created_at":"2017-06-01T16:19:03Z","updated_at":"2017-06-13T08:46:15Z","pushed_at":"2017-06-15T08:11:51Z","git_url":"git://github.com/projectcalico/typha.git","ssh_url":"git@github.com:projectcalico/typha.git","clone_url":"https://github.com/projectcalico/typha.git","svn_url":"https://github.com/projectcalico/typha","homepage":"","size":188,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/23"},"html":{"href":"https://github.com/projectcalico/typha/pull/23"},"issue":{"href":"https://api.github.com/repos/projectcalico/typha/issues/23"},"comments":{"href":"https://api.github.com/repos/projectcalico/typha/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/typha/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/typha/statuses/e7a69a5116cb000a84d61d3bdad005c9f6fd9d55"}}}}
{"actor":{"display_login":"fasaxc"}}