{"action":"created","comment":{"url":"https://api.github.com/repos/google/trillian/pulls/comments/206512510","pull_request_review_id":141933603,"id":206512510,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjUxMjUxMA==","diff_hunk":"@@ -0,0 +1,134 @@\n+// Copyright 2018 Google 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 rpcflags\n+\n+import (\n+\t\"context\"\n+\t\"encoding/pem\"\n+\t\"flag\"\n+\t\"strings\"\n+\t\"testing\"\n+\n+\t\"github.com/google/trillian\"\n+\t\"github.com/google/trillian/testonly/integration\"\n+\t\"github.com/google/trillian/testonly/setup\"\n+\t\"github.com/google/trillian/util/flagsaver\"\n+\t\"google.golang.org/grpc\"\n+\t\"google.golang.org/grpc/credentials\"\n+)\n+\n+func TestNewClientDialOptionsFromFlagsWithTLSCertFileNotSet(t *testing.T) {\n+\t// Set up Trillian servers\n+\tconst numSequencers = 2\n+\tserverOpts := []grpc.ServerOption{}\n+\tclientOpts := []grpc.DialOption{grpc.WithInsecure()}\n+\tlogEnv, err := integration.NewLogEnvWithGRPCOptions(context.Background(), numSequencers, serverOpts, clientOpts)\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\tdefer logEnv.Close()\n+\n+\tdialOpts, err := NewClientDialOptionsFromFlags()\n+\tif err != nil {\n+\t\tt.Errorf(\"Got an unexpected error: %v\", err)\n+\t}\n+\n+\t// Check that the returned dial options can be used to connect and make\n+\t// requests against the Trillian services created above.\n+\tconn, err := grpc.Dial(logEnv.Address, dialOpts...)\n+\tif err != nil {\n+\t\tt.Errorf(\"failed to dial %v: %v\", logEnv.Address, err)\n+\t}\n+\tdefer conn.Close()\n+\n+\tadminClient := trillian.NewTrillianAdminClient(conn)\n+\t_, err = adminClient.ListTrees(context.Background(), &trillian.ListTreesRequest{})\n+\tif err != nil {\n+\t\tt.Errorf(\"failed to request trees from the Admin Server: %v\", err)\n+\t}\n+}\n+\n+func TestNewClientDialOptionsFromFlagsWithTLSCertFileMissing(t *testing.T) {\n+\tdefer flagsaver.Save().Restore()\n+\terr := flag.Set(\"tls_cert_file\", \"/a/missing/file\")\n+\tif err != nil {\n+\t\tt.Errorf(\"Failed to set flag: %v\", err)\n+\t}\n+\n+\tdialOpts, err := NewClientDialOptionsFromFlags()\n+\tif err == nil || !strings.Contains(err.Error(), \"no such file or directory\") {\n+\t\tt.Errorf(\"Expected to get an error due to the file not being found, instead got: %v\", err)\n+\t}\n+\n+\tif dialOpts != nil {\n+\t\tt.Errorf(\"Expected returned dialOpts to be nil, instead got: %v\", dialOpts)\n+\t}\n+}\n+\n+func TestNewClientDialOptionsFromFlagsWithTLSCertFileSet(t *testing.T) {\n+\t// Create new TLS certificates for the test services, and write the Client\n+\t// certificate to a file (so we can refer to it using the flag).\n+\tcrtFile, cleanupCrtFile := setup.TempFile(t, \"test.crt.\")\n+\tdefer cleanupCrtFile()\n+\n+\ttlsCert := setup.NewTLSCertificate(t)\n+\n+\t// Certificate file and client dial options.\n+\terr := pem.Encode(crtFile, &pem.Block{Type: \"CERTIFICATE\", Bytes: tlsCert.Certificate[0]})\n+\tif err != nil {\n+\t\tt.Fatalf(\"Failed to encode the test TLS certificate %v\", err)\n+\t}\n+\tclientCreds, err := credentials.NewClientTLSFromFile(crtFile.Name(), \"\")\n+\tif err != nil {\n+\t\tt.Fatalf(\"Failed to get credentials: %v\", err)\n+\t}\n+\n+\t// Set up Trillian servers (with TLS enabled)\n+\tconst numSequencers = 2","path":"client/rpcflags/rpcflags_test.go","position":99,"original_position":99,"commit_id":"90ebe3049c46851afebc2c8d098f3d4e2a0c1967","original_commit_id":"90ebe3049c46851afebc2c8d098f3d4e2a0c1967","user":{"login":"AlCutter","id":7648032,"node_id":"MDQ6VXNlcjc2NDgwMzI=","avatar_url":"https://avatars0.githubusercontent.com/u/7648032?v=4","gravatar_id":"","url":"https://api.github.com/users/AlCutter","html_url":"https://github.com/AlCutter","followers_url":"https://api.github.com/users/AlCutter/followers","following_url":"https://api.github.com/users/AlCutter/following{/other_user}","gists_url":"https://api.github.com/users/AlCutter/gists{/gist_id}","starred_url":"https://api.github.com/users/AlCutter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlCutter/subscriptions","organizations_url":"https://api.github.com/users/AlCutter/orgs","repos_url":"https://api.github.com/users/AlCutter/repos","events_url":"https://api.github.com/users/AlCutter/events{/privacy}","received_events_url":"https://api.github.com/users/AlCutter/received_events","type":"User","site_admin":false},"body":"I guess you don't actually need sequencers, could you set this to zero to speed the test up/use fewer resources?","created_at":"2018-07-31T12:51:03Z","updated_at":"2018-07-31T12:59:33Z","html_url":"https://github.com/google/trillian/pull/1243#discussion_r206512510","pull_request_url":"https://api.github.com/repos/google/trillian/pulls/1243","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/comments/206512510"},"html":{"href":"https://github.com/google/trillian/pull/1243#discussion_r206512510"},"pull_request":{"href":"https://api.github.com/repos/google/trillian/pulls/1243"}}},"pull_request":{"url":"https://api.github.com/repos/google/trillian/pulls/1243","id":205084583,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MDg0NTgz","html_url":"https://github.com/google/trillian/pull/1243","diff_url":"https://github.com/google/trillian/pull/1243.diff","patch_url":"https://github.com/google/trillian/pull/1243.patch","issue_url":"https://api.github.com/repos/google/trillian/issues/1243","number":1243,"state":"open","locked":false,"title":"Add a module for managing Trillian client connection options","user":{"login":"maljub01","id":350635,"node_id":"MDQ6VXNlcjM1MDYzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/350635?v=4","gravatar_id":"","url":"https://api.github.com/users/maljub01","html_url":"https://github.com/maljub01","followers_url":"https://api.github.com/users/maljub01/followers","following_url":"https://api.github.com/users/maljub01/following{/other_user}","gists_url":"https://api.github.com/users/maljub01/gists{/gist_id}","starred_url":"https://api.github.com/users/maljub01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maljub01/subscriptions","organizations_url":"https://api.github.com/users/maljub01/orgs","repos_url":"https://api.github.com/users/maljub01/repos","events_url":"https://api.github.com/users/maljub01/events{/privacy}","received_events_url":"https://api.github.com/users/maljub01/received_events","type":"User","site_admin":false},"body":"This change adds a `-tls_cert_file` flag to the following binaries, making it possible for them to talk to Trillian services configured to use TLS:\r\n- createtree\r\n- deletetree\r\n- updatetree\r\n\r\nAlso, it adds the following test helper methods, under a new `testonly/setup` module:\r\n- `TempFile`: Returns a new temporary file and a cleanup method to\r\n  delete it, which should be called with `defer`.\r\n- `NewTLSCertificate`: Creates a random new TLS certificate that can be\r\n  used in tests.\r\n","created_at":"2018-07-31T11:44:25Z","updated_at":"2018-07-31T12:59:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f85195d04b6aa90aacb687153029c228ae39a621","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":389540533,"node_id":"MDU6TGFiZWwzODk1NDA1MzM=","url":"https://api.github.com/repos/google/trillian/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/google/trillian/pulls/1243/commits","review_comments_url":"https://api.github.com/repos/google/trillian/pulls/1243/comments","review_comment_url":"https://api.github.com/repos/google/trillian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/trillian/issues/1243/comments","statuses_url":"https://api.github.com/repos/google/trillian/statuses/90ebe3049c46851afebc2c8d098f3d4e2a0c1967","head":{"label":"maljub01:client-rpcflags","ref":"client-rpcflags","sha":"90ebe3049c46851afebc2c8d098f3d4e2a0c1967","user":{"login":"maljub01","id":350635,"node_id":"MDQ6VXNlcjM1MDYzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/350635?v=4","gravatar_id":"","url":"https://api.github.com/users/maljub01","html_url":"https://github.com/maljub01","followers_url":"https://api.github.com/users/maljub01/followers","following_url":"https://api.github.com/users/maljub01/following{/other_user}","gists_url":"https://api.github.com/users/maljub01/gists{/gist_id}","starred_url":"https://api.github.com/users/maljub01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maljub01/subscriptions","organizations_url":"https://api.github.com/users/maljub01/orgs","repos_url":"https://api.github.com/users/maljub01/repos","events_url":"https://api.github.com/users/maljub01/events{/privacy}","received_events_url":"https://api.github.com/users/maljub01/received_events","type":"User","site_admin":false},"repo":{"id":114906653,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ5MDY2NTM=","name":"trillian","full_name":"maljub01/trillian","owner":{"login":"maljub01","id":350635,"node_id":"MDQ6VXNlcjM1MDYzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/350635?v=4","gravatar_id":"","url":"https://api.github.com/users/maljub01","html_url":"https://github.com/maljub01","followers_url":"https://api.github.com/users/maljub01/followers","following_url":"https://api.github.com/users/maljub01/following{/other_user}","gists_url":"https://api.github.com/users/maljub01/gists{/gist_id}","starred_url":"https://api.github.com/users/maljub01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maljub01/subscriptions","organizations_url":"https://api.github.com/users/maljub01/orgs","repos_url":"https://api.github.com/users/maljub01/repos","events_url":"https://api.github.com/users/maljub01/events{/privacy}","received_events_url":"https://api.github.com/users/maljub01/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maljub01/trillian","description":"Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees.","fork":true,"url":"https://api.github.com/repos/maljub01/trillian","forks_url":"https://api.github.com/repos/maljub01/trillian/forks","keys_url":"https://api.github.com/repos/maljub01/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maljub01/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maljub01/trillian/teams","hooks_url":"https://api.github.com/repos/maljub01/trillian/hooks","issue_events_url":"https://api.github.com/repos/maljub01/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/maljub01/trillian/events","assignees_url":"https://api.github.com/repos/maljub01/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/maljub01/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/maljub01/trillian/tags","blobs_url":"https://api.github.com/repos/maljub01/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maljub01/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maljub01/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/maljub01/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maljub01/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/maljub01/trillian/languages","stargazers_url":"https://api.github.com/repos/maljub01/trillian/stargazers","contributors_url":"https://api.github.com/repos/maljub01/trillian/contributors","subscribers_url":"https://api.github.com/repos/maljub01/trillian/subscribers","subscription_url":"https://api.github.com/repos/maljub01/trillian/subscription","commits_url":"https://api.github.com/repos/maljub01/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/maljub01/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/maljub01/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/maljub01/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/maljub01/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/maljub01/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maljub01/trillian/merges","archive_url":"https://api.github.com/repos/maljub01/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maljub01/trillian/downloads","issues_url":"https://api.github.com/repos/maljub01/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/maljub01/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/maljub01/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/maljub01/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maljub01/trillian/labels{/name}","releases_url":"https://api.github.com/repos/maljub01/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/maljub01/trillian/deployments","created_at":"2017-12-20T16:10:29Z","updated_at":"2018-07-31T11:41:24Z","pushed_at":"2018-07-31T11:53:35Z","git_url":"git://github.com/maljub01/trillian.git","ssh_url":"git@github.com:maljub01/trillian.git","clone_url":"https://github.com/maljub01/trillian.git","svn_url":"https://github.com/maljub01/trillian","homepage":"","size":11152,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"9abd320ce4fc4ec4a39ea661b4d17ed1e46fdecc","user":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":58654489,"node_id":"MDEwOlJlcG9zaXRvcnk1ODY1NDQ4OQ==","name":"trillian","full_name":"google/trillian","owner":{"login":"google","id":1342004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDIwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1342004?v=4","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/trillian","description":"Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees.","fork":false,"url":"https://api.github.com/repos/google/trillian","forks_url":"https://api.github.com/repos/google/trillian/forks","keys_url":"https://api.github.com/repos/google/trillian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/trillian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/trillian/teams","hooks_url":"https://api.github.com/repos/google/trillian/hooks","issue_events_url":"https://api.github.com/repos/google/trillian/issues/events{/number}","events_url":"https://api.github.com/repos/google/trillian/events","assignees_url":"https://api.github.com/repos/google/trillian/assignees{/user}","branches_url":"https://api.github.com/repos/google/trillian/branches{/branch}","tags_url":"https://api.github.com/repos/google/trillian/tags","blobs_url":"https://api.github.com/repos/google/trillian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/trillian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/trillian/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/trillian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/trillian/statuses/{sha}","languages_url":"https://api.github.com/repos/google/trillian/languages","stargazers_url":"https://api.github.com/repos/google/trillian/stargazers","contributors_url":"https://api.github.com/repos/google/trillian/contributors","subscribers_url":"https://api.github.com/repos/google/trillian/subscribers","subscription_url":"https://api.github.com/repos/google/trillian/subscription","commits_url":"https://api.github.com/repos/google/trillian/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/trillian/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/trillian/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/trillian/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/trillian/contents/{+path}","compare_url":"https://api.github.com/repos/google/trillian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/trillian/merges","archive_url":"https://api.github.com/repos/google/trillian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/trillian/downloads","issues_url":"https://api.github.com/repos/google/trillian/issues{/number}","pulls_url":"https://api.github.com/repos/google/trillian/pulls{/number}","milestones_url":"https://api.github.com/repos/google/trillian/milestones{/number}","notifications_url":"https://api.github.com/repos/google/trillian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/trillian/labels{/name}","releases_url":"https://api.github.com/repos/google/trillian/releases{/id}","deployments_url":"https://api.github.com/repos/google/trillian/deployments","created_at":"2016-05-12T15:37:35Z","updated_at":"2018-07-30T23:43:45Z","pushed_at":"2018-07-31T11:53:36Z","git_url":"git://github.com/google/trillian.git","ssh_url":"git@github.com:google/trillian.git","clone_url":"https://github.com/google/trillian.git","svn_url":"https://github.com/google/trillian","homepage":"","size":11201,"stargazers_count":1152,"watchers_count":1152,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":137,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":137,"open_issues":56,"watchers":1152,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/trillian/pulls/1243"},"html":{"href":"https://github.com/google/trillian/pull/1243"},"issue":{"href":"https://api.github.com/repos/google/trillian/issues/1243"},"comments":{"href":"https://api.github.com/repos/google/trillian/issues/1243/comments"},"review_comments":{"href":"https://api.github.com/repos/google/trillian/pulls/1243/comments"},"review_comment":{"href":"https://api.github.com/repos/google/trillian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/trillian/pulls/1243/commits"},"statuses":{"href":"https://api.github.com/repos/google/trillian/statuses/90ebe3049c46851afebc2c8d098f3d4e2a0c1967"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"AlCutter"}}