{"action":"created","comment":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/62748811","id":62748811,"diff_hunk":"@@ -70,73 +71,72 @@ func Test(t *testing.T) {\n \trunner.TestingT(t, output)\n \n \tif _, err := os.Stat(config.DefaultFileName); err == nil {\n-\t\tcfg, err := config.ReadConfig(config.DefaultFileName)\n-\t\tif err != nil {\n-\t\t\tt.Fatalf(\"Error reading config: %v\", err)\n-\t\t}\n-\n-\t\tif err := tearDownSnapd(cfg.FromBranch); err != nil {\n-\t\t\tt.Fatalf(\"Error stopping daemon: %v\", err)\n-\t\t}\n+\t\ttearDownSnapd(&check.C{})\n \t}\n }\n \n func setUpSnapd(c *check.C, fromBranch bool, extraEnv string) {\n \tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"stop\",\n \t\t\"snapd.service\", \"snapd.socket\")\n \n-\tif fromBranch {\n-\t\tbinPath, err := filepath.Abs(\"integration-tests/bin/snapd\")\n-\t\tc.Assert(err, check.IsNil)\n+\tcli.ExecCommand(c, \"sudo\", \"mkdir\", \"-p\", cfgDir)\n \n-\t\t_, err = cli.ExecCommandErr(\"sudo\", \"mount\", \"-o\", \"bind\",\n-\t\t\tbinPath, daemonBinaryPath)\n+\tif fromBranch {\n+\t\terr := writeCoverageConfig()\n \t\tc.Assert(err, check.IsNil)\n \t}\n \n \terr := writeEnvConfig(extraEnv)\n \tc.Assert(err, check.IsNil)\n \n-\t_, err = cli.ExecCommandErr(\"sudo\", \"systemctl\", \"daemon-reload\")\n-\tc.Assert(err, check.IsNil)\n+\tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"daemon-reload\")\n \n-\t_, err = cli.ExecCommandErr(\"sudo\", \"systemctl\", \"start\", \"snapd.service\")\n-\tc.Assert(err, check.IsNil)\n+\tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"start\", \"snapd.service\")\n }\n \n-func tearDownSnapd(fromBranch bool) error {\n-\tif _, err := cli.ExecCommandErr(\"sudo\", \"systemctl\", \"stop\",\n-\t\t\"snapd.service\"); err != nil {\n-\t\treturn err\n-\t}\n+func tearDownSnapd(c *check.C) {\n+\tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"stop\",\n+\t\t\"snapd.service\")\n+\n+\tcli.ExecCommand(c, \"sudo\", \"rm\", \"-rf\", cfgDir)\n+\n+\tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"daemon-reload\")\n \n-\tif _, err := cli.ExecCommandErr(\"sudo\", \"rm\", \"-rf\", cfgDir); err != nil {\n+\tcli.ExecCommand(c, \"sudo\", \"systemctl\", \"start\", \"snapd.service\")\n+}\n+\n+// this function writes a config file for snapd.service which clears and overrides the default\n+// ExecStart setting adding the required flags for recording coverage info\n+func writeCoverageConfig() error {\n+\tcfgFileName := \"coverage.conf\"\n+\tcfgFile := filepath.Join(cfgDir, cfgFileName)\n+\n+\tbinPath, err := filepath.Abs(\"integration-tests/bin/snapd\")\n+\tif err != nil {\n \t\treturn err\n \t}\n+\tcmd, err := cli.AddOptionsToCommand([]string{filepath.Base(binPath)})\n+\tcmd[0] = binPath\n \n-\tif fromBranch {\n-\t\tif _, err := cli.ExecCommandErr(\"sudo\", \"umount\", daemonBinaryPath); err != nil {\n-\t\t\treturn err\n-\t\t}\n-\t}\n+\tcfgContent := []byte(fmt.Sprintf(`[Service]\n+ExecStart=\n+ExecStart=%s\n+`, strings.Join(cmd, \" \")))\n+\n+\tfmt.Println(string(cfgContent))","path":"integration-tests/tests/base_test.go","position":92,"original_position":92,"commit_id":"238066bf71e9d1932884bda00a229f8741f61831","original_commit_id":"238066bf71e9d1932884bda00a229f8741f61831","user":{"login":"elopio","id":617831,"avatar_url":"https://avatars.githubusercontent.com/u/617831?v=3","gravatar_id":"","url":"https://api.github.com/users/elopio","html_url":"https://github.com/elopio","followers_url":"https://api.github.com/users/elopio/followers","following_url":"https://api.github.com/users/elopio/following{/other_user}","gists_url":"https://api.github.com/users/elopio/gists{/gist_id}","starred_url":"https://api.github.com/users/elopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elopio/subscriptions","organizations_url":"https://api.github.com/users/elopio/orgs","repos_url":"https://api.github.com/users/elopio/repos","events_url":"https://api.github.com/users/elopio/events{/privacy}","received_events_url":"https://api.github.com/users/elopio/received_events","type":"User","site_admin":false},"body":"I think the comment is ok, but it won't go into the logs. \r\nIMO, just add something like:\r\nfmt.Println(\"snapd config:\")","created_at":"2016-05-10T20:45:57Z","updated_at":"2016-05-10T20:45:57Z","html_url":"https://github.com/ubuntu-core/snappy/pull/1124#discussion_r62748811","pull_request_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124","_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments/62748811"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/1124#discussion_r62748811"},"pull_request":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124"}}},"pull_request":{"url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124","id":68834274,"html_url":"https://github.com/ubuntu-core/snappy/pull/1124","diff_url":"https://github.com/ubuntu-core/snappy/pull/1124.diff","patch_url":"https://github.com/ubuntu-core/snappy/pull/1124.patch","issue_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/1124","number":1124,"state":"open","locked":false,"title":"integration-tests: add coverage flags to snapd.service ExecStart setting when building from branch","user":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"body":"A new conf file is written in `/etc/systemd/system/snapd.service.d` with the ExecStart reset and override, adding the options for recording the coverage reports.\r\nAlso the `tearDownSnapd` signature has been modified to match `setUpSnapd`, including a `*check.C` as first parameter to ease error handling.","created_at":"2016-05-04T09:39:30Z","updated_at":"2016-05-10T20:45:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"682513aa55e350ca8d713bb2d7804b2cf18b7902","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124/commits","review_comments_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124/comments","review_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/1124/comments","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/238066bf71e9d1932884bda00a229f8741f61831","head":{"label":"fgimenez:snapd-coverage","ref":"snapd-coverage","sha":"238066bf71e9d1932884bda00a229f8741f61831","user":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"repo":{"id":45098487,"name":"snappy","full_name":"fgimenez/snappy","owner":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fgimenez/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":true,"url":"https://api.github.com/repos/fgimenez/snappy","forks_url":"https://api.github.com/repos/fgimenez/snappy/forks","keys_url":"https://api.github.com/repos/fgimenez/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fgimenez/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fgimenez/snappy/teams","hooks_url":"https://api.github.com/repos/fgimenez/snappy/hooks","issue_events_url":"https://api.github.com/repos/fgimenez/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/fgimenez/snappy/events","assignees_url":"https://api.github.com/repos/fgimenez/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/fgimenez/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/fgimenez/snappy/tags","blobs_url":"https://api.github.com/repos/fgimenez/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fgimenez/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fgimenez/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/fgimenez/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fgimenez/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/fgimenez/snappy/languages","stargazers_url":"https://api.github.com/repos/fgimenez/snappy/stargazers","contributors_url":"https://api.github.com/repos/fgimenez/snappy/contributors","subscribers_url":"https://api.github.com/repos/fgimenez/snappy/subscribers","subscription_url":"https://api.github.com/repos/fgimenez/snappy/subscription","commits_url":"https://api.github.com/repos/fgimenez/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/fgimenez/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/fgimenez/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/fgimenez/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/fgimenez/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/fgimenez/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fgimenez/snappy/merges","archive_url":"https://api.github.com/repos/fgimenez/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fgimenez/snappy/downloads","issues_url":"https://api.github.com/repos/fgimenez/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/fgimenez/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/fgimenez/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/fgimenez/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fgimenez/snappy/labels{/name}","releases_url":"https://api.github.com/repos/fgimenez/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/fgimenez/snappy/deployments","created_at":"2015-10-28T08:23:58Z","updated_at":"2016-01-14T08:49:44Z","pushed_at":"2016-05-10T20:41:29Z","git_url":"git://github.com/fgimenez/snappy.git","ssh_url":"git@github.com:fgimenez/snappy.git","clone_url":"https://github.com/fgimenez/snappy.git","svn_url":"https://github.com/fgimenez/snappy","homepage":null,"size":29483,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"ubuntu-core:master","ref":"master","sha":"617d88f9559b0d537bf06606101c0775d12bafda","user":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snappy","full_name":"ubuntu-core/snappy","owner":{"login":"ubuntu-core","id":15022473,"avatar_url":"https://avatars.githubusercontent.com/u/15022473?v=3","gravatar_id":"","url":"https://api.github.com/users/ubuntu-core","html_url":"https://github.com/ubuntu-core","followers_url":"https://api.github.com/users/ubuntu-core/followers","following_url":"https://api.github.com/users/ubuntu-core/following{/other_user}","gists_url":"https://api.github.com/users/ubuntu-core/gists{/gist_id}","starred_url":"https://api.github.com/users/ubuntu-core/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubuntu-core/subscriptions","organizations_url":"https://api.github.com/users/ubuntu-core/orgs","repos_url":"https://api.github.com/users/ubuntu-core/repos","events_url":"https://api.github.com/users/ubuntu-core/events{/privacy}","received_events_url":"https://api.github.com/users/ubuntu-core/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubuntu-core/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":false,"url":"https://api.github.com/repos/ubuntu-core/snappy","forks_url":"https://api.github.com/repos/ubuntu-core/snappy/forks","keys_url":"https://api.github.com/repos/ubuntu-core/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubuntu-core/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubuntu-core/snappy/teams","hooks_url":"https://api.github.com/repos/ubuntu-core/snappy/hooks","issue_events_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/ubuntu-core/snappy/events","assignees_url":"https://api.github.com/repos/ubuntu-core/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/ubuntu-core/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/ubuntu-core/snappy/tags","blobs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubuntu-core/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubuntu-core/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubuntu-core/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubuntu-core/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/ubuntu-core/snappy/languages","stargazers_url":"https://api.github.com/repos/ubuntu-core/snappy/stargazers","contributors_url":"https://api.github.com/repos/ubuntu-core/snappy/contributors","subscribers_url":"https://api.github.com/repos/ubuntu-core/snappy/subscribers","subscription_url":"https://api.github.com/repos/ubuntu-core/snappy/subscription","commits_url":"https://api.github.com/repos/ubuntu-core/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubuntu-core/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubuntu-core/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubuntu-core/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubuntu-core/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/ubuntu-core/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubuntu-core/snappy/merges","archive_url":"https://api.github.com/repos/ubuntu-core/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubuntu-core/snappy/downloads","issues_url":"https://api.github.com/repos/ubuntu-core/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/ubuntu-core/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/ubuntu-core/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/ubuntu-core/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubuntu-core/snappy/labels{/name}","releases_url":"https://api.github.com/repos/ubuntu-core/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/ubuntu-core/snappy/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2016-05-08T22:28:44Z","pushed_at":"2016-05-10T20:35:20Z","git_url":"git://github.com/ubuntu-core/snappy.git","ssh_url":"git@github.com:ubuntu-core/snappy.git","clone_url":"https://github.com/ubuntu-core/snappy.git","svn_url":"https://github.com/ubuntu-core/snappy","homepage":null,"size":30756,"stargazers_count":189,"watchers_count":189,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":18,"forks":40,"open_issues":18,"watchers":189,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124"},"html":{"href":"https://github.com/ubuntu-core/snappy/pull/1124"},"issue":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/1124"},"comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/issues/1124/comments"},"review_comments":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124/comments"},"review_comment":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ubuntu-core/snappy/pulls/1124/commits"},"statuses":{"href":"https://api.github.com/repos/ubuntu-core/snappy/statuses/238066bf71e9d1932884bda00a229f8741f61831"}}}}