Merge lp:~elopio/snappy/examples2 into lp:~snappy-dev/snappy/snappy-moved-to-github
- examples2
- Merge into snappy-moved-to-github
Proposed by
Leo Arias
Status: | Merged |
---|---|
Approved by: | Federico Gimenez |
Approved revision: | 761 |
Merged at revision: | 769 |
Proposed branch: | lp:~elopio/snappy/examples2 |
Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
Prerequisite: | lp:~elopio/snappy/examples1 |
Diff against target: |
365 lines (+121/-56) 11 files modified
_integration-tests/data/snaps/basic-binaries/bin/fail (+3/-0) _integration-tests/data/snaps/basic-binaries/bin/success (+3/-0) _integration-tests/data/snaps/basic-binaries/meta/package.yaml (+2/-0) _integration-tests/tests/activate_test.go (+2/-1) _integration-tests/tests/build_test.go (+7/-6) _integration-tests/tests/examples_test.go (+37/-0) _integration-tests/tests/info_test.go (+4/-3) _integration-tests/tests/installApp_test.go (+21/-28) _integration-tests/tests/snapd_1_0_packages_test.go (+4/-3) _integration-tests/testutils/build/snap.go (+5/-15) _integration-tests/testutils/data/data.go (+33/-0) |
To merge this branch: | bzr merge lp:~elopio/snappy/examples2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Federico Gimenez (community) | Approve | ||
Review via email:
|
Commit message
Added a snap to test binaries.
Moved the hello-world tests to examples.
Description of the change
To post a comment you must log in.
lp:~elopio/snappy/examples2
updated
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
I merged with trunk.
@Federico, I moved the TestCallBinaryW
Can you please take a look again?
lp:~elopio/snappy/examples2
updated
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Federico Gimenez (fgimenez) wrote : | # |
Thanks Leo, sorry I didn't realize at first that the test was moved, not deleted.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file '_integration-tests/data/snaps/basic-binaries/bin/fail' | |||
2 | --- _integration-tests/data/snaps/basic-binaries/bin/fail 1970-01-01 00:00:00 +0000 | |||
3 | +++ _integration-tests/data/snaps/basic-binaries/bin/fail 2015-10-13 15:56:19 +0000 | |||
4 | @@ -0,0 +1,3 @@ | |||
5 | 1 | #!/bin/sh | ||
6 | 2 | |||
7 | 3 | exit 1 | ||
8 | 0 | 4 | ||
9 | === added file '_integration-tests/data/snaps/basic-binaries/bin/success' | |||
10 | --- _integration-tests/data/snaps/basic-binaries/bin/success 1970-01-01 00:00:00 +0000 | |||
11 | +++ _integration-tests/data/snaps/basic-binaries/bin/success 2015-10-13 15:56:19 +0000 | |||
12 | @@ -0,0 +1,3 @@ | |||
13 | 1 | #!/bin/sh | ||
14 | 2 | |||
15 | 3 | exit 0 | ||
16 | 0 | 4 | ||
17 | === modified file '_integration-tests/data/snaps/basic-binaries/meta/package.yaml' | |||
18 | --- _integration-tests/data/snaps/basic-binaries/meta/package.yaml 2015-10-09 07:42:40 +0000 | |||
19 | +++ _integration-tests/data/snaps/basic-binaries/meta/package.yaml 2015-10-13 15:56:19 +0000 | |||
20 | @@ -4,3 +4,5 @@ | |||
21 | 4 | icon: meta/snappy64.png | 4 | icon: meta/snappy64.png |
22 | 5 | binaries: | 5 | binaries: |
23 | 6 | - name: bin/echo | 6 | - name: bin/echo |
24 | 7 | - name: bin/success | ||
25 | 8 | - name: bin/fail | ||
26 | 7 | 9 | ||
27 | === modified file '_integration-tests/tests/activate_test.go' | |||
28 | --- _integration-tests/tests/activate_test.go 2015-10-09 07:49:19 +0000 | |||
29 | +++ _integration-tests/tests/activate_test.go 2015-10-13 15:56:19 +0000 | |||
30 | @@ -27,10 +27,11 @@ | |||
31 | 27 | "launchpad.net/snappy/_integration-tests/testutils/build" | 27 | "launchpad.net/snappy/_integration-tests/testutils/build" |
32 | 28 | "launchpad.net/snappy/_integration-tests/testutils/cli" | 28 | "launchpad.net/snappy/_integration-tests/testutils/cli" |
33 | 29 | "launchpad.net/snappy/_integration-tests/testutils/common" | 29 | "launchpad.net/snappy/_integration-tests/testutils/common" |
34 | 30 | "launchpad.net/snappy/_integration-tests/testutils/data" | ||
35 | 30 | ) | 31 | ) |
36 | 31 | 32 | ||
37 | 32 | const ( | 33 | const ( |
39 | 33 | activateSnapName = "basic-binaries" | 34 | activateSnapName = data.BasicBinariesSnapName |
40 | 34 | activateBinName = activateSnapName + ".echo" | 35 | activateBinName = activateSnapName + ".echo" |
41 | 35 | activateEchoOutput = "From basic-binaries snap\n" | 36 | activateEchoOutput = "From basic-binaries snap\n" |
42 | 36 | baseActivatePattern = "(?msU).*" + activateSnapName + `\s*.*\s*.*sideload` | 37 | baseActivatePattern = "(?msU).*" + activateSnapName + `\s*.*\s*.*sideload` |
43 | 37 | 38 | ||
44 | === modified file '_integration-tests/tests/build_test.go' | |||
45 | --- _integration-tests/tests/build_test.go 2015-09-28 10:35:06 +0000 | |||
46 | +++ _integration-tests/tests/build_test.go 2015-10-13 15:56:19 +0000 | |||
47 | @@ -26,6 +26,7 @@ | |||
48 | 26 | 26 | ||
49 | 27 | "launchpad.net/snappy/_integration-tests/testutils/build" | 27 | "launchpad.net/snappy/_integration-tests/testutils/build" |
50 | 28 | "launchpad.net/snappy/_integration-tests/testutils/common" | 28 | "launchpad.net/snappy/_integration-tests/testutils/common" |
51 | 29 | "launchpad.net/snappy/_integration-tests/testutils/data" | ||
52 | 29 | 30 | ||
53 | 30 | "gopkg.in/check.v1" | 31 | "gopkg.in/check.v1" |
54 | 31 | ) | 32 | ) |
55 | @@ -38,37 +39,37 @@ | |||
56 | 38 | 39 | ||
57 | 39 | func (s *buildSuite) TestBuildBasicSnapOnSnappy(c *check.C) { | 40 | func (s *buildSuite) TestBuildBasicSnapOnSnappy(c *check.C) { |
58 | 40 | // build basic snap and check output | 41 | // build basic snap and check output |
60 | 41 | snapPath, err := build.LocalSnap(c, build.BasicSnapName) | 42 | snapPath, err := build.LocalSnap(c, data.BasicSnapName) |
61 | 42 | defer os.Remove(snapPath) | 43 | defer os.Remove(snapPath) |
62 | 43 | c.Assert(err, check.IsNil) | 44 | c.Assert(err, check.IsNil) |
63 | 44 | 45 | ||
64 | 45 | // install built snap and check output | 46 | // install built snap and check output |
65 | 46 | installOutput := common.InstallSnap(c, snapPath) | 47 | installOutput := common.InstallSnap(c, snapPath) |
67 | 47 | defer common.RemoveSnap(c, build.BasicSnapName) | 48 | defer common.RemoveSnap(c, data.BasicSnapName) |
68 | 48 | expected := "(?ms)" + | 49 | expected := "(?ms)" + |
69 | 49 | "Installing " + snapPath + "\n" + | 50 | "Installing " + snapPath + "\n" + |
70 | 50 | ".*Signature check failed, but installing anyway as requested\n" + | 51 | ".*Signature check failed, but installing anyway as requested\n" + |
71 | 51 | "Name +Date +Version +Developer \n" + | 52 | "Name +Date +Version +Developer \n" + |
72 | 52 | ".*\n" + | 53 | ".*\n" + |
74 | 53 | build.BasicSnapName + " +.* +.* +sideload \n" + | 54 | data.BasicSnapName + " +.* +.* +sideload \n" + |
75 | 54 | ".*\n" | 55 | ".*\n" |
76 | 55 | 56 | ||
77 | 56 | c.Check(installOutput, check.Matches, expected) | 57 | c.Check(installOutput, check.Matches, expected) |
78 | 57 | } | 58 | } |
79 | 58 | 59 | ||
80 | 59 | func (s *buildSuite) TestBuildWrongYamlSnapOnSnappy(c *check.C) { | 60 | func (s *buildSuite) TestBuildWrongYamlSnapOnSnappy(c *check.C) { |
82 | 60 | commonWrongTest(c, build.WrongYamlSnapName, | 61 | commonWrongTest(c, data.WrongYamlSnapName, |
83 | 61 | "(?msi).*Can not parse.*yaml: line 2: mapping values are not allowed in this context.*") | 62 | "(?msi).*Can not parse.*yaml: line 2: mapping values are not allowed in this context.*") |
84 | 62 | } | 63 | } |
85 | 63 | 64 | ||
86 | 64 | func (s *buildSuite) TestBuildMissingReadmeSnapOnSnappy(c *check.C) { | 65 | func (s *buildSuite) TestBuildMissingReadmeSnapOnSnappy(c *check.C) { |
88 | 65 | commonWrongTest(c, build.MissingReadmeSnapName, | 66 | commonWrongTest(c, data.MissingReadmeSnapName, |
89 | 66 | ".*readme.md: no such file or directory\n") | 67 | ".*readme.md: no such file or directory\n") |
90 | 67 | } | 68 | } |
91 | 68 | 69 | ||
92 | 69 | func commonWrongTest(c *check.C, testName, expected string) { | 70 | func commonWrongTest(c *check.C, testName, expected string) { |
93 | 70 | // build wrong snap and check error | 71 | // build wrong snap and check error |
95 | 71 | cmd := exec.Command("snappy", "build", fmt.Sprintf("%s/%s", build.BaseSnapPath, testName)) | 72 | cmd := exec.Command("snappy", "build", fmt.Sprintf("%s/%s", data.BaseSnapPath, testName)) |
96 | 72 | echoOutput, err := cmd.CombinedOutput() | 73 | echoOutput, err := cmd.CombinedOutput() |
97 | 73 | c.Assert(err, check.NotNil, check.Commentf("%s should not be built", testName)) | 74 | c.Assert(err, check.NotNil, check.Commentf("%s should not be built", testName)) |
98 | 74 | 75 | ||
99 | 75 | 76 | ||
100 | === modified file '_integration-tests/tests/examples_test.go' | |||
101 | --- _integration-tests/tests/examples_test.go 2015-10-09 16:18:01 +0000 | |||
102 | +++ _integration-tests/tests/examples_test.go 2015-10-13 15:56:19 +0000 | |||
103 | @@ -29,6 +29,43 @@ | |||
104 | 29 | "gopkg.in/check.v1" | 29 | "gopkg.in/check.v1" |
105 | 30 | ) | 30 | ) |
106 | 31 | 31 | ||
107 | 32 | var _ = check.Suite(&helloWorldExampleSuite{}) | ||
108 | 33 | |||
109 | 34 | type helloWorldExampleSuite struct { | ||
110 | 35 | common.SnappySuite | ||
111 | 36 | } | ||
112 | 37 | |||
113 | 38 | func (s *helloWorldExampleSuite) TestCallHelloWorldBinary(c *check.C) { | ||
114 | 39 | common.InstallSnap(c, "hello-world") | ||
115 | 40 | s.AddCleanup(func() { | ||
116 | 41 | common.RemoveSnap(c, "hello-world") | ||
117 | 42 | }) | ||
118 | 43 | |||
119 | 44 | echoOutput := cli.ExecCommand(c, "hello-world.echo") | ||
120 | 45 | |||
121 | 46 | c.Assert(echoOutput, check.Equals, "Hello World!\n") | ||
122 | 47 | } | ||
123 | 48 | |||
124 | 49 | func (s *helloWorldExampleSuite) TestCallHelloWorldEvilMustPrintPermissionDeniedError(c *check.C) { | ||
125 | 50 | common.InstallSnap(c, "hello-world") | ||
126 | 51 | s.AddCleanup(func() { | ||
127 | 52 | common.RemoveSnap(c, "hello-world") | ||
128 | 53 | }) | ||
129 | 54 | |||
130 | 55 | echoOutput, err := cli.ExecCommandErr("hello-world.evil") | ||
131 | 56 | c.Assert(err, check.NotNil, check.Commentf("hello-world.evil did not fail")) | ||
132 | 57 | |||
133 | 58 | expected := "" + | ||
134 | 59 | "Hello Evil World!\n" + | ||
135 | 60 | "This example demonstrates the app confinement\n" + | ||
136 | 61 | "You should see a permission denied error next\n" + | ||
137 | 62 | "/apps/hello-world.canonical/.*/bin/evil: \\d+: " + | ||
138 | 63 | "/apps/hello-world.canonical/.*/bin/evil: " + | ||
139 | 64 | "cannot create /var/tmp/myevil.txt: Permission denied\n" | ||
140 | 65 | |||
141 | 66 | c.Assert(string(echoOutput), check.Matches, expected) | ||
142 | 67 | } | ||
143 | 68 | |||
144 | 32 | var _ = check.Suite(&webserverExampleSuite{}) | 69 | var _ = check.Suite(&webserverExampleSuite{}) |
145 | 33 | 70 | ||
146 | 34 | type webserverExampleSuite struct { | 71 | type webserverExampleSuite struct { |
147 | 35 | 72 | ||
148 | === modified file '_integration-tests/tests/info_test.go' | |||
149 | --- _integration-tests/tests/info_test.go 2015-10-08 06:40:06 +0000 | |||
150 | +++ _integration-tests/tests/info_test.go 2015-10-13 15:56:19 +0000 | |||
151 | @@ -26,6 +26,7 @@ | |||
152 | 26 | "launchpad.net/snappy/_integration-tests/testutils/build" | 26 | "launchpad.net/snappy/_integration-tests/testutils/build" |
153 | 27 | "launchpad.net/snappy/_integration-tests/testutils/cli" | 27 | "launchpad.net/snappy/_integration-tests/testutils/cli" |
154 | 28 | "launchpad.net/snappy/_integration-tests/testutils/common" | 28 | "launchpad.net/snappy/_integration-tests/testutils/common" |
155 | 29 | "launchpad.net/snappy/_integration-tests/testutils/data" | ||
156 | 29 | 30 | ||
157 | 30 | "gopkg.in/check.v1" | 31 | "gopkg.in/check.v1" |
158 | 31 | ) | 32 | ) |
159 | @@ -55,17 +56,17 @@ | |||
160 | 55 | } | 56 | } |
161 | 56 | 57 | ||
162 | 57 | func (s *infoSuite) TestInfoMustPrintInstalledApps(c *check.C) { | 58 | func (s *infoSuite) TestInfoMustPrintInstalledApps(c *check.C) { |
164 | 58 | snapPath, err := build.LocalSnap(c, build.BasicSnapName) | 59 | snapPath, err := build.LocalSnap(c, data.BasicSnapName) |
165 | 59 | defer os.Remove(snapPath) | 60 | defer os.Remove(snapPath) |
166 | 60 | c.Assert(err, check.IsNil) | 61 | c.Assert(err, check.IsNil) |
167 | 61 | common.InstallSnap(c, snapPath) | 62 | common.InstallSnap(c, snapPath) |
169 | 62 | defer common.RemoveSnap(c, build.BasicSnapName) | 63 | defer common.RemoveSnap(c, data.BasicSnapName) |
170 | 63 | 64 | ||
171 | 64 | infoOutput := cli.ExecCommand(c, "snappy", "info") | 65 | infoOutput := cli.ExecCommand(c, "snappy", "info") |
172 | 65 | 66 | ||
173 | 66 | expected := "(?ms)" + | 67 | expected := "(?ms)" + |
174 | 67 | ".*" + | 68 | ".*" + |
176 | 68 | "^apps: .*" + build.BasicSnapName + "\\.sideload.*\n" | 69 | "^apps: .*" + data.BasicSnapName + "\\.sideload.*\n" |
177 | 69 | c.Assert(infoOutput, check.Matches, expected) | 70 | c.Assert(infoOutput, check.Matches, expected) |
178 | 70 | } | 71 | } |
179 | 71 | 72 | ||
180 | 72 | 73 | ||
181 | === modified file '_integration-tests/tests/installApp_test.go' | |||
182 | --- _integration-tests/tests/installApp_test.go 2015-10-08 06:45:29 +0000 | |||
183 | +++ _integration-tests/tests/installApp_test.go 2015-10-13 15:56:19 +0000 | |||
184 | @@ -20,10 +20,13 @@ | |||
185 | 20 | package tests | 20 | package tests |
186 | 21 | 21 | ||
187 | 22 | import ( | 22 | import ( |
188 | 23 | "os" | ||
189 | 23 | "os/exec" | 24 | "os/exec" |
190 | 24 | 25 | ||
191 | 26 | "launchpad.net/snappy/_integration-tests/testutils/build" | ||
192 | 25 | "launchpad.net/snappy/_integration-tests/testutils/cli" | 27 | "launchpad.net/snappy/_integration-tests/testutils/cli" |
193 | 26 | "launchpad.net/snappy/_integration-tests/testutils/common" | 28 | "launchpad.net/snappy/_integration-tests/testutils/common" |
194 | 29 | "launchpad.net/snappy/_integration-tests/testutils/data" | ||
195 | 27 | 30 | ||
196 | 28 | "gopkg.in/check.v1" | 31 | "gopkg.in/check.v1" |
197 | 29 | ) | 32 | ) |
198 | @@ -50,36 +53,26 @@ | |||
199 | 50 | c.Assert(installOutput, check.Matches, expected) | 53 | c.Assert(installOutput, check.Matches, expected) |
200 | 51 | } | 54 | } |
201 | 52 | 55 | ||
211 | 53 | func (s *installAppSuite) TestCallBinaryFromInstalledSnap(c *check.C) { | 56 | func (s *installAppSuite) TestCallSuccessfulBinaryFromInstalledSnap(c *check.C) { |
212 | 54 | common.InstallSnap(c, "hello-world") | 57 | snapPath, err := build.LocalSnap(c, data.BasicBinariesSnapName) |
213 | 55 | s.AddCleanup(func() { | 58 | defer os.Remove(snapPath) |
214 | 56 | common.RemoveSnap(c, "hello-world") | 59 | c.Assert(err, check.IsNil) |
215 | 57 | }) | 60 | common.InstallSnap(c, snapPath) |
216 | 58 | 61 | defer common.RemoveSnap(c, data.BasicBinariesSnapName) | |
217 | 59 | echoOutput := cli.ExecCommand(c, "hello-world.echo") | 62 | |
218 | 60 | 63 | // Exec command does not fail. | |
219 | 61 | c.Assert(echoOutput, check.Equals, "Hello World!\n") | 64 | cli.ExecCommand(c, "basic-binaries.success") |
220 | 62 | } | 65 | } |
221 | 63 | 66 | ||
241 | 64 | func (s *installAppSuite) TestCallBinaryWithPermissionDeniedMustPrintError(c *check.C) { | 67 | func (s *installAppSuite) TestCallFailBinaryFromInstalledSnap(c *check.C) { |
242 | 65 | common.InstallSnap(c, "hello-world") | 68 | snapPath, err := build.LocalSnap(c, data.BasicBinariesSnapName) |
243 | 66 | s.AddCleanup(func() { | 69 | defer os.Remove(snapPath) |
244 | 67 | common.RemoveSnap(c, "hello-world") | 70 | c.Assert(err, check.IsNil) |
245 | 68 | }) | 71 | common.InstallSnap(c, snapPath) |
246 | 69 | 72 | defer common.RemoveSnap(c, data.BasicBinariesSnapName) | |
247 | 70 | cmd := exec.Command("hello-world.evil") | 73 | |
248 | 71 | echoOutput, err := cmd.CombinedOutput() | 74 | _, err = cli.ExecCommandErr("basic-binaries.fail") |
249 | 72 | c.Assert(err, check.NotNil, check.Commentf("hello-world.evil did not fail")) | 75 | c.Assert(err, check.NotNil, check.Commentf("The binary did not fail")) |
231 | 73 | |||
232 | 74 | expected := "" + | ||
233 | 75 | "Hello Evil World!\n" + | ||
234 | 76 | "This example demonstrates the app confinement\n" + | ||
235 | 77 | "You should see a permission denied error next\n" + | ||
236 | 78 | "/apps/hello-world.canonical/.*/bin/evil: \\d+: " + | ||
237 | 79 | "/apps/hello-world.canonical/.*/bin/evil: " + | ||
238 | 80 | "cannot create /var/tmp/myevil.txt: Permission denied\n" | ||
239 | 81 | |||
240 | 82 | c.Assert(string(echoOutput), check.Matches, expected) | ||
250 | 83 | } | 76 | } |
251 | 84 | 77 | ||
252 | 85 | func (s *installAppSuite) TestInstallUnexistingAppMustPrintError(c *check.C) { | 78 | func (s *installAppSuite) TestInstallUnexistingAppMustPrintError(c *check.C) { |
253 | 86 | 79 | ||
254 | === modified file '_integration-tests/tests/snapd_1_0_packages_test.go' | |||
255 | --- _integration-tests/tests/snapd_1_0_packages_test.go 2015-10-08 08:55:17 +0000 | |||
256 | +++ _integration-tests/tests/snapd_1_0_packages_test.go 2015-10-13 15:56:19 +0000 | |||
257 | @@ -24,6 +24,7 @@ | |||
258 | 24 | 24 | ||
259 | 25 | "launchpad.net/snappy/_integration-tests/testutils/build" | 25 | "launchpad.net/snappy/_integration-tests/testutils/build" |
260 | 26 | "launchpad.net/snappy/_integration-tests/testutils/common" | 26 | "launchpad.net/snappy/_integration-tests/testutils/common" |
261 | 27 | "launchpad.net/snappy/_integration-tests/testutils/data" | ||
262 | 27 | 28 | ||
263 | 28 | "gopkg.in/check.v1" | 29 | "gopkg.in/check.v1" |
264 | 29 | ) | 30 | ) |
265 | @@ -64,14 +65,14 @@ | |||
266 | 64 | func (s *snapd10PackagesTestSuite) SetUpTest(c *check.C) { | 65 | func (s *snapd10PackagesTestSuite) SetUpTest(c *check.C) { |
267 | 65 | s.snapdTestSuite.SetUpTest(c) | 66 | s.snapdTestSuite.SetUpTest(c) |
268 | 66 | var err error | 67 | var err error |
270 | 67 | s.snapPath, err = build.LocalSnap(c, build.BasicSnapName) | 68 | s.snapPath, err = build.LocalSnap(c, data.BasicSnapName) |
271 | 68 | c.Assert(err, check.IsNil) | 69 | c.Assert(err, check.IsNil) |
272 | 69 | } | 70 | } |
273 | 70 | 71 | ||
274 | 71 | func (s *snapd10PackagesTestSuite) TearDownTest(c *check.C) { | 72 | func (s *snapd10PackagesTestSuite) TearDownTest(c *check.C) { |
275 | 72 | s.snapdTestSuite.TearDownTest(c) | 73 | s.snapdTestSuite.TearDownTest(c) |
276 | 73 | os.Remove(s.snapPath) | 74 | os.Remove(s.snapPath) |
278 | 74 | common.RemoveSnap(c, build.BasicSnapName) | 75 | common.RemoveSnap(c, data.BasicSnapName) |
279 | 75 | } | 76 | } |
280 | 76 | 77 | ||
281 | 77 | func (s *snapd10PackagesTestSuite) resource() string { | 78 | func (s *snapd10PackagesTestSuite) resource() string { |
282 | @@ -92,7 +93,7 @@ | |||
283 | 92 | payload: s.snapPath, | 93 | payload: s.snapPath, |
284 | 93 | waitPattern: `(?U){.*,"status":"active".*"status":"OK","status_code":200,"type":"sync"}`, | 94 | waitPattern: `(?U){.*,"status":"active".*"status":"OK","status_code":200,"type":"sync"}`, |
285 | 94 | waitFunction: func() (string, error) { | 95 | waitFunction: func() (string, error) { |
287 | 95 | output, err := genericRequest(s.resource()+"/"+build.BasicSnapName+".sideload", "GET", nil) | 96 | output, err := genericRequest(s.resource()+"/"+data.BasicSnapName+".sideload", "GET", nil) |
288 | 96 | return string(output), err | 97 | return string(output), err |
289 | 97 | }}} | 98 | }}} |
290 | 98 | } | 99 | } |
291 | 99 | 100 | ||
292 | === modified file '_integration-tests/testutils/build/snap.go' | |||
293 | --- _integration-tests/testutils/build/snap.go 2015-09-30 11:06:40 +0000 | |||
294 | +++ _integration-tests/testutils/build/snap.go 2015-10-13 15:56:19 +0000 | |||
295 | @@ -25,20 +25,10 @@ | |||
296 | 25 | 25 | ||
297 | 26 | "gopkg.in/check.v1" | 26 | "gopkg.in/check.v1" |
298 | 27 | "launchpad.net/snappy/_integration-tests/testutils/cli" | 27 | "launchpad.net/snappy/_integration-tests/testutils/cli" |
313 | 28 | ) | 28 | "launchpad.net/snappy/_integration-tests/testutils/data" |
314 | 29 | 29 | ) | |
315 | 30 | const ( | 30 | |
316 | 31 | // BaseSnapPath is the path for the snap sources used in testing | 31 | const snapFilenameSufix = "_1.0_all.snap" |
303 | 32 | BaseSnapPath = "_integration-tests/data/snaps" | ||
304 | 33 | // BasicSnapName is the name of the basic snap | ||
305 | 34 | BasicSnapName = "basic" | ||
306 | 35 | // WrongYamlSnapName is the name of a snap with an invalid meta yaml | ||
307 | 36 | WrongYamlSnapName = "wrong-yaml" | ||
308 | 37 | // MissingReadmeSnapName is the name of a snap without readme | ||
309 | 38 | MissingReadmeSnapName = "missing-readme" | ||
310 | 39 | |||
311 | 40 | snapFilenameSufix = "_1.0_all.snap" | ||
312 | 41 | ) | ||
317 | 42 | 32 | ||
318 | 43 | var ( | 33 | var ( |
319 | 44 | // dependency aliasing | 34 | // dependency aliasing |
320 | @@ -67,5 +57,5 @@ | |||
321 | 67 | } | 57 | } |
322 | 68 | 58 | ||
323 | 69 | func buildPath(snap string) string { | 59 | func buildPath(snap string) string { |
325 | 70 | return filepath.Join(BaseSnapPath, snap) | 60 | return filepath.Join(data.BaseSnapPath, snap) |
326 | 71 | } | 61 | } |
327 | 72 | 62 | ||
328 | === added directory '_integration-tests/testutils/data' | |||
329 | === added file '_integration-tests/testutils/data/data.go' | |||
330 | --- _integration-tests/testutils/data/data.go 1970-01-01 00:00:00 +0000 | |||
331 | +++ _integration-tests/testutils/data/data.go 2015-10-13 15:56:19 +0000 | |||
332 | @@ -0,0 +1,33 @@ | |||
333 | 1 | // -*- Mode: Go; indent-tabs-mode: t -*- | ||
334 | 2 | |||
335 | 3 | /* | ||
336 | 4 | * Copyright (C) 2015 Canonical Ltd | ||
337 | 5 | * | ||
338 | 6 | * This program is free software: you can redistribute it and/or modify | ||
339 | 7 | * it under the terms of the GNU General Public License version 3 as | ||
340 | 8 | * published by the Free Software Foundation. | ||
341 | 9 | * | ||
342 | 10 | * This program is distributed in the hope that it will be useful, | ||
343 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
344 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
345 | 13 | * GNU General Public License for more details. | ||
346 | 14 | * | ||
347 | 15 | * You should have received a copy of the GNU General Public License | ||
348 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
349 | 17 | * | ||
350 | 18 | */ | ||
351 | 19 | |||
352 | 20 | package data | ||
353 | 21 | |||
354 | 22 | const ( | ||
355 | 23 | // BaseSnapPath is the path for the snap sources used in testing | ||
356 | 24 | BaseSnapPath = "_integration-tests/data/snaps" | ||
357 | 25 | // BasicSnapName is the name of the basic snap | ||
358 | 26 | BasicSnapName = "basic" | ||
359 | 27 | // BasicBinariesSnapName is the name of the basic snap with binaries | ||
360 | 28 | BasicBinariesSnapName = "basic-binaries" | ||
361 | 29 | // WrongYamlSnapName is the name of a snap with an invalid meta yaml | ||
362 | 30 | WrongYamlSnapName = "wrong-yaml" | ||
363 | 31 | // MissingReadmeSnapName is the name of a snap without readme | ||
364 | 32 | MissingReadmeSnapName = "missing-readme" | ||
365 | 33 | ) |
Looks very good, I think that we should keep the TestCallBinaryW ithPermissionDe niedMustPrintEr ror test, in hwAssign we check hardware assignation (adding elements to a device cgroup) and this test checks app confinement (write permissions to a directory that can be granted through apparmor).
Thanks!