{"action":"created","comment":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/comments/69087646","id":69087646,"diff_hunk":"@@ -428,3 +413,86 @@ type: kernel`\n \t\t\"snappy_mode\":   \"try\",\n \t})\n }\n+\n+func (ms *mgrsSuite) installLocalTestSnap(c *C, snapYamlContent string) *snap.Info {\n+\tst := ms.o.State()\n+\n+\tsnapPath := makeTestSnap(c, snapYamlContent)\n+\tsnapf, err := snap.Open(snapPath)\n+\tc.Assert(err, IsNil)\n+\tinfo, err := snap.ReadInfoFromSnapFile(snapf, nil)\n+\tc.Assert(err, IsNil)\n+\n+\t// store current state\n+\tsnapName := info.Name()\n+\tvar snapst snapstate.SnapState\n+\tsnapstate.Get(st, snapName, &snapst)\n+\n+\tts, err := snapstate.InstallPath(st, snapName, snapPath, \"\", snapstate.DevMode)\n+\tc.Assert(err, IsNil)\n+\tchg := st.NewChange(\"install-snap\", \"...\")\n+\tchg.AddAll(ts)\n+\n+\tst.Unlock()\n+\terr = ms.o.Settle()\n+\tst.Lock()\n+\tc.Assert(err, IsNil)\n+\n+\tc.Assert(chg.Status(), Equals, state.DoneStatus, Commentf(\"install-snap change failed with: %v\", chg.Err()))\n+\n+\t// ensure its different from before\n+\tvar newSnapst snapstate.SnapState\n+\tsnapstate.Get(st, snapName, &newSnapst)\n+\tc.Assert(newSnapst.CurrentSideInfo().Revision.Unset(), Equals, false)\n+\tc.Assert(snapst.CurrentSideInfo(), Not(DeepEquals), newSnapst.CurrentSideInfo())\n+\n+\treturn info\n+}\n+\n+func (ms *mgrsSuite) TestHappyRevert(c *C) {\n+\tst := ms.o.State()\n+\tst.Lock()\n+\tdefer st.Unlock()\n+\n+\tsnapYamlContent := `name: foo\n+apps:\n+ bar:\n+  command: bin/bar\n+`\n+\tms.installLocalTestSnap(c, snapYamlContent+\"version: 1.0\")\n+\tms.installLocalTestSnap(c, snapYamlContent+\"version: 2.0\")\n+\n+\t// ensure we are on r2\n+\tc.Assert(osutil.FileExists(filepath.Join(dirs.SnapBlobDir, \"foo_x2.snap\")), Equals, true)\n+\tmup := systemd.MountUnitPath(\"/snap/foo/x2\", \"mount\")\n+\tcontent, err := ioutil.ReadFile(mup)\n+\tc.Assert(err, IsNil)\n+\tc.Assert(string(content), Matches, \"(?ms).*^Where=/snap/foo/x2\")\n+\tc.Assert(string(content), Matches, \"(?ms).*^What=/var/lib/snapd/snaps/foo_x2.snap\")\n+\n+\t// now do the revert\n+\tts, err := snapstate.Revert(st, \"foo\")\n+\tc.Assert(err, IsNil)\n+\tchg := st.NewChange(\"revert-snap\", \"...\")\n+\tchg.AddAll(ts)\n+\n+\tst.Unlock()\n+\terr = ms.o.Settle()\n+\tst.Lock()\n+\tc.Assert(err, IsNil)\n+\n+\tc.Assert(chg.Status(), Equals, state.DoneStatus, Commentf(\"revert-snap change failed with: %v\", chg.Err()))\n+\n+\t// ensure we are back to x1 after the revert\n+\tc.Assert(osutil.FileExists(filepath.Join(dirs.SnapBlobDir, \"foo_x1.snap\")), Equals, true)","path":"overlord/managers_test.go","position":118,"original_position":118,"commit_id":"a98a355a34dce007bb43b55f266ff3789ac6eb39","original_commit_id":"a98a355a34dce007bb43b55f266ff3789ac6eb39","user":{"login":"mvo5","id":914418,"avatar_url":"https://avatars.githubusercontent.com/u/914418?v=3","gravatar_id":"","url":"https://api.github.com/users/mvo5","html_url":"https://github.com/mvo5","followers_url":"https://api.github.com/users/mvo5/followers","following_url":"https://api.github.com/users/mvo5/following{/other_user}","gists_url":"https://api.github.com/users/mvo5/gists{/gist_id}","starred_url":"https://api.github.com/users/mvo5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvo5/subscriptions","organizations_url":"https://api.github.com/users/mvo5/orgs","repos_url":"https://api.github.com/users/mvo5/repos","events_url":"https://api.github.com/users/mvo5/events{/privacy}","received_events_url":"https://api.github.com/users/mvo5/received_events","type":"User","site_admin":false},"body":"Thanks, indeed, this test was useless, sorry for overlooking that. Fixed now.","created_at":"2016-06-30T08:01:02Z","updated_at":"2016-06-30T08:01:02Z","html_url":"https://github.com/snapcore/snapd/pull/1275#discussion_r69087646","pull_request_url":"https://api.github.com/repos/snapcore/snapd/pulls/1275","_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments/69087646"},"html":{"href":"https://github.com/snapcore/snapd/pull/1275#discussion_r69087646"},"pull_request":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1275"}}},"pull_request":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/1275","id":72687125,"html_url":"https://github.com/snapcore/snapd/pull/1275","diff_url":"https://github.com/snapcore/snapd/pull/1275.diff","patch_url":"https://github.com/snapcore/snapd/pull/1275.patch","issue_url":"https://api.github.com/repos/snapcore/snapd/issues/1275","number":1275,"state":"open","locked":false,"title":"many: add `snap rollback`","user":{"login":"mvo5","id":914418,"avatar_url":"https://avatars.githubusercontent.com/u/914418?v=3","gravatar_id":"","url":"https://api.github.com/users/mvo5","html_url":"https://github.com/mvo5","followers_url":"https://api.github.com/users/mvo5/followers","following_url":"https://api.github.com/users/mvo5/following{/other_user}","gists_url":"https://api.github.com/users/mvo5/gists{/gist_id}","starred_url":"https://api.github.com/users/mvo5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvo5/subscriptions","organizations_url":"https://api.github.com/users/mvo5/orgs","repos_url":"https://api.github.com/users/mvo5/repos","events_url":"https://api.github.com/users/mvo5/events{/privacy}","received_events_url":"https://api.github.com/users/mvo5/received_events","type":"User","site_admin":false},"body":"This is a bit iteration on the snap rollback support mainly to gather some feedback about the approach taken. Some tests around snapstate.Rollback() are missing still but I would love to get some feedback on the direction before continuing.","created_at":"2016-06-06T10:26:45Z","updated_at":"2016-06-30T08:01:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18862c49ac12390266b083860ad3316e555c81aa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/snapcore/snapd/pulls/1275/commits","review_comments_url":"https://api.github.com/repos/snapcore/snapd/pulls/1275/comments","review_comment_url":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snapcore/snapd/issues/1275/comments","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/a98a355a34dce007bb43b55f266ff3789ac6eb39","head":{"label":"mvo5:feature/rollback","ref":"feature/rollback","sha":"a98a355a34dce007bb43b55f266ff3789ac6eb39","user":{"login":"mvo5","id":914418,"avatar_url":"https://avatars.githubusercontent.com/u/914418?v=3","gravatar_id":"","url":"https://api.github.com/users/mvo5","html_url":"https://github.com/mvo5","followers_url":"https://api.github.com/users/mvo5/followers","following_url":"https://api.github.com/users/mvo5/following{/other_user}","gists_url":"https://api.github.com/users/mvo5/gists{/gist_id}","starred_url":"https://api.github.com/users/mvo5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvo5/subscriptions","organizations_url":"https://api.github.com/users/mvo5/orgs","repos_url":"https://api.github.com/users/mvo5/repos","events_url":"https://api.github.com/users/mvo5/events{/privacy}","received_events_url":"https://api.github.com/users/mvo5/received_events","type":"User","site_admin":false},"repo":{"id":45067233,"name":"snappy","full_name":"mvo5/snappy","owner":{"login":"mvo5","id":914418,"avatar_url":"https://avatars.githubusercontent.com/u/914418?v=3","gravatar_id":"","url":"https://api.github.com/users/mvo5","html_url":"https://github.com/mvo5","followers_url":"https://api.github.com/users/mvo5/followers","following_url":"https://api.github.com/users/mvo5/following{/other_user}","gists_url":"https://api.github.com/users/mvo5/gists{/gist_id}","starred_url":"https://api.github.com/users/mvo5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvo5/subscriptions","organizations_url":"https://api.github.com/users/mvo5/orgs","repos_url":"https://api.github.com/users/mvo5/repos","events_url":"https://api.github.com/users/mvo5/events{/privacy}","received_events_url":"https://api.github.com/users/mvo5/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mvo5/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":true,"url":"https://api.github.com/repos/mvo5/snappy","forks_url":"https://api.github.com/repos/mvo5/snappy/forks","keys_url":"https://api.github.com/repos/mvo5/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mvo5/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mvo5/snappy/teams","hooks_url":"https://api.github.com/repos/mvo5/snappy/hooks","issue_events_url":"https://api.github.com/repos/mvo5/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/mvo5/snappy/events","assignees_url":"https://api.github.com/repos/mvo5/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/mvo5/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/mvo5/snappy/tags","blobs_url":"https://api.github.com/repos/mvo5/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mvo5/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mvo5/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mvo5/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mvo5/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/mvo5/snappy/languages","stargazers_url":"https://api.github.com/repos/mvo5/snappy/stargazers","contributors_url":"https://api.github.com/repos/mvo5/snappy/contributors","subscribers_url":"https://api.github.com/repos/mvo5/snappy/subscribers","subscription_url":"https://api.github.com/repos/mvo5/snappy/subscription","commits_url":"https://api.github.com/repos/mvo5/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mvo5/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mvo5/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mvo5/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mvo5/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/mvo5/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mvo5/snappy/merges","archive_url":"https://api.github.com/repos/mvo5/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mvo5/snappy/downloads","issues_url":"https://api.github.com/repos/mvo5/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/mvo5/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/mvo5/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/mvo5/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mvo5/snappy/labels{/name}","releases_url":"https://api.github.com/repos/mvo5/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/mvo5/snappy/deployments","created_at":"2015-10-27T20:12:18Z","updated_at":"2016-01-11T10:04:34Z","pushed_at":"2016-06-30T07:22:30Z","git_url":"git://github.com/mvo5/snappy.git","ssh_url":"git@github.com:mvo5/snappy.git","clone_url":"https://github.com/mvo5/snappy.git","svn_url":"https://github.com/mvo5/snappy","homepage":null,"size":32783,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"snapcore:master","ref":"master","sha":"21db9ac6bfefc465d8bbb1366bee396d11cfaff1","user":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snapd","full_name":"snapcore/snapd","owner":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snapcore/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":false,"url":"https://api.github.com/repos/snapcore/snapd","forks_url":"https://api.github.com/repos/snapcore/snapd/forks","keys_url":"https://api.github.com/repos/snapcore/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snapcore/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snapcore/snapd/teams","hooks_url":"https://api.github.com/repos/snapcore/snapd/hooks","issue_events_url":"https://api.github.com/repos/snapcore/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/snapcore/snapd/events","assignees_url":"https://api.github.com/repos/snapcore/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/snapcore/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/snapcore/snapd/tags","blobs_url":"https://api.github.com/repos/snapcore/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snapcore/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snapcore/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/snapcore/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/snapcore/snapd/languages","stargazers_url":"https://api.github.com/repos/snapcore/snapd/stargazers","contributors_url":"https://api.github.com/repos/snapcore/snapd/contributors","subscribers_url":"https://api.github.com/repos/snapcore/snapd/subscribers","subscription_url":"https://api.github.com/repos/snapcore/snapd/subscription","commits_url":"https://api.github.com/repos/snapcore/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/snapcore/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/snapcore/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/snapcore/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/snapcore/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/snapcore/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snapcore/snapd/merges","archive_url":"https://api.github.com/repos/snapcore/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snapcore/snapd/downloads","issues_url":"https://api.github.com/repos/snapcore/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/snapcore/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/snapcore/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/snapcore/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snapcore/snapd/labels{/name}","releases_url":"https://api.github.com/repos/snapcore/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/snapcore/snapd/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2016-06-29T17:54:13Z","pushed_at":"2016-06-30T07:24:32Z","git_url":"git://github.com/snapcore/snapd.git","ssh_url":"git@github.com:snapcore/snapd.git","clone_url":"https://github.com/snapcore/snapd.git","svn_url":"https://github.com/snapcore/snapd","homepage":"","size":33463,"stargazers_count":340,"watchers_count":340,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":24,"forks":67,"open_issues":24,"watchers":340,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1275"},"html":{"href":"https://github.com/snapcore/snapd/pull/1275"},"issue":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1275"},"comments":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1275/comments"},"review_comments":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1275/comments"},"review_comment":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1275/commits"},"statuses":{"href":"https://api.github.com/repos/snapcore/snapd/statuses/a98a355a34dce007bb43b55f266ff3789ac6eb39"}}}}
{"actor":{"display_login":"mvo5"}}