Merge lp:~elopio/snappy/add_tests_tests into lp:~snappy-dev/snappy/snappy-moved-to-github
- add_tests_tests
- Merge into snappy-moved-to-github
Proposed by
Leo Arias
Status: | Merged |
---|---|
Approved by: | Leo Arias |
Approved revision: | 607 |
Merged at revision: | 599 |
Proposed branch: | lp:~elopio/snappy/add_tests_tests |
Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
Prerequisite: | lp:~elopio/snappy/one_tests_package |
Diff against target: |
515 lines (+153/-68) 20 files modified
_integration-tests/helpers/common/common.go (+11/-20) _integration-tests/helpers/config/config.go (+26/-26) _integration-tests/helpers/config/config_test.go (+93/-0) _integration-tests/helpers/image/image.go (+1/-1) _integration-tests/main.go (+3/-3) _integration-tests/tests/apt_test.go (+1/-1) _integration-tests/tests/build_test.go (+1/-1) _integration-tests/tests/failover_rclocal_crash_test.go (+1/-1) _integration-tests/tests/failover_systemd_loop_test.go (+1/-1) _integration-tests/tests/failover_test.go (+1/-1) _integration-tests/tests/failover_zero_size_file_test.go (+1/-1) _integration-tests/tests/info_test.go (+2/-2) _integration-tests/tests/installApp_test.go (+1/-1) _integration-tests/tests/installFramework_test.go (+1/-1) _integration-tests/tests/list_test.go (+1/-1) _integration-tests/tests/rollback_test.go (+1/-1) _integration-tests/tests/search_test.go (+1/-1) _integration-tests/tests/update_test.go (+1/-1) _integration-tests/tests/writablePaths_test.go (+1/-1) run-checks (+4/-3) |
To merge this branch: | bzr merge lp:~elopio/snappy/add_tests_tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Federico Gimenez (community) | Approve | ||
Review via email:
|
Commit message
Refactored the helpers to be able to add tests for them.
Added tests for the config helpers.
Description of the change
I used as an example the config package. Now thinking about it again is the worst example, because we will get rid of it in favor of the test arguments. Oh well...
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '_integration-tests/helpers' | |||
2 | === renamed directory '_integration-tests/common' => '_integration-tests/helpers/common' | |||
3 | === modified file '_integration-tests/helpers/common/common.go' | |||
4 | --- _integration-tests/common/common.go 2015-07-22 15:12:24 +0000 | |||
5 | +++ _integration-tests/helpers/common/common.go 2015-07-22 19:10:34 +0000 | |||
6 | @@ -20,7 +20,6 @@ | |||
7 | 20 | package common | 20 | package common |
8 | 21 | 21 | ||
9 | 22 | import ( | 22 | import ( |
10 | 23 | "encoding/json" | ||
11 | 24 | "fmt" | 23 | "fmt" |
12 | 25 | "io/ioutil" | 24 | "io/ioutil" |
13 | 26 | "os" | 25 | "os" |
14 | @@ -31,6 +30,8 @@ | |||
15 | 31 | "strings" | 30 | "strings" |
16 | 32 | 31 | ||
17 | 33 | check "gopkg.in/check.v1" | 32 | check "gopkg.in/check.v1" |
18 | 33 | |||
19 | 34 | "launchpad.net/snappy/_integration-tests/helpers/config" | ||
20 | 34 | ) | 35 | ) |
21 | 35 | 36 | ||
22 | 36 | const ( | 37 | const ( |
23 | @@ -40,9 +41,9 @@ | |||
24 | 40 | channelCfgFile = "/etc/system-image/channel.ini" | 41 | channelCfgFile = "/etc/system-image/channel.ini" |
25 | 41 | ) | 42 | ) |
26 | 42 | 43 | ||
30 | 43 | // Config is a map of strings that contains the configurations values passed | 44 | // Cfg is a struct that contains the configurations values passed from the |
31 | 44 | // from the host to the testbed. | 45 | // host to the testbed. |
32 | 45 | var Config map[string]string | 46 | var Cfg config.Config |
33 | 46 | 47 | ||
34 | 47 | // SnappySuite is a structure used as a base test suite for all the snappy | 48 | // SnappySuite is a structure used as a base test suite for all the snappy |
35 | 48 | // integration tests. | 49 | // integration tests. |
36 | @@ -56,9 +57,11 @@ | |||
37 | 56 | ExecCommand(c, "sudo", "systemctl", "stop", "snappy-autopilot.timer") | 57 | ExecCommand(c, "sudo", "systemctl", "stop", "snappy-autopilot.timer") |
38 | 57 | ExecCommand(c, "sudo", "systemctl", "disable", "snappy-autopilot.timer") | 58 | ExecCommand(c, "sudo", "systemctl", "disable", "snappy-autopilot.timer") |
39 | 58 | if !isInRebootProcess() { | 59 | if !isInRebootProcess() { |
43 | 59 | Config = readConfig(c) | 60 | Cfg, err := config.ReadConfig( |
44 | 60 | if Config["update"] == "true" || Config["rollback"] == "true" { | 61 | "_integration-tests/data/output/testconfig.json") |
45 | 61 | switchSystemImageConf(c, Config["targetRelease"], Config["targetChannel"], "0") | 62 | c.Assert(err, check.IsNil, check.Commentf("Error reading config: %v", err)) |
46 | 63 | if Cfg.Update || Cfg.Rollback { | ||
47 | 64 | switchSystemImageConf(c, Cfg.TargetRelease, Cfg.TargetChannel, "0") | ||
48 | 62 | // Always use the installed snappy because we are updating from an old | 65 | // Always use the installed snappy because we are updating from an old |
49 | 63 | // image, so we should not use the snappy from the branch. | 66 | // image, so we should not use the snappy from the branch. |
50 | 64 | output := ExecCommand(c, "sudo", "/usr/bin/snappy", "update") | 67 | output := ExecCommand(c, "sudo", "/usr/bin/snappy", "update") |
51 | @@ -68,7 +71,7 @@ | |||
52 | 68 | } | 71 | } |
53 | 69 | } else if CheckRebootMark("setupsuite-update") { | 72 | } else if CheckRebootMark("setupsuite-update") { |
54 | 70 | RemoveRebootMark(c) | 73 | RemoveRebootMark(c) |
56 | 71 | if Config["rollback"] == "true" { | 74 | if Cfg.Rollback { |
57 | 72 | ExecCommand(c, "sudo", "snappy", "rollback", "ubuntu-core") | 75 | ExecCommand(c, "sudo", "snappy", "rollback", "ubuntu-core") |
58 | 73 | RebootWithMark(c, "setupsuite-rollback") | 76 | RebootWithMark(c, "setupsuite-rollback") |
59 | 74 | } | 77 | } |
60 | @@ -137,18 +140,6 @@ | |||
61 | 137 | s.cleanupHandlers = append(s.cleanupHandlers, f) | 140 | s.cleanupHandlers = append(s.cleanupHandlers, f) |
62 | 138 | } | 141 | } |
63 | 139 | 142 | ||
64 | 140 | func readConfig(c *check.C) map[string]string { | ||
65 | 141 | b, err := ioutil.ReadFile("_integration-tests/data/output/testconfig.json") | ||
66 | 142 | c.Assert( | ||
67 | 143 | err, check.IsNil, check.Commentf("Failed to read test config: %v", err)) | ||
68 | 144 | |||
69 | 145 | var decoded map[string]string | ||
70 | 146 | err = json.Unmarshal(b, &decoded) | ||
71 | 147 | c.Assert( | ||
72 | 148 | err, check.IsNil, check.Commentf("Failed to decode test config: %v", err)) | ||
73 | 149 | return decoded | ||
74 | 150 | } | ||
75 | 151 | |||
76 | 152 | func switchSystemImageConf(c *check.C, release, channel, version string) { | 143 | func switchSystemImageConf(c *check.C, release, channel, version string) { |
77 | 153 | targets := []string{"/", BaseOtherPath} | 144 | targets := []string{"/", BaseOtherPath} |
78 | 154 | for _, target := range targets { | 145 | for _, target := range targets { |
79 | 155 | 146 | ||
80 | === renamed directory '_integration-tests/config' => '_integration-tests/helpers/config' | |||
81 | === modified file '_integration-tests/helpers/config/config.go' | |||
82 | --- _integration-tests/config/config.go 2015-07-22 15:12:24 +0000 | |||
83 | +++ _integration-tests/helpers/config/config.go 2015-07-22 19:10:34 +0000 | |||
84 | @@ -24,51 +24,51 @@ | |||
85 | 24 | "fmt" | 24 | "fmt" |
86 | 25 | "io/ioutil" | 25 | "io/ioutil" |
87 | 26 | "log" | 26 | "log" |
88 | 27 | "strconv" | ||
89 | 28 | ) | 27 | ) |
90 | 29 | 28 | ||
91 | 30 | // Config contains the values to pass to the test bed from the host. | 29 | // Config contains the values to pass to the test bed from the host. |
92 | 31 | type Config struct { | 30 | type Config struct { |
100 | 32 | fileName string | 31 | FileName string |
101 | 33 | release string | 32 | Release string |
102 | 34 | channel string | 33 | Channel string |
103 | 35 | targetRelease string | 34 | TargetRelease string |
104 | 36 | targetChannel string | 35 | TargetChannel string |
105 | 37 | update bool | 36 | Update bool |
106 | 38 | rollback bool | 37 | Rollback bool |
107 | 39 | } | 38 | } |
108 | 40 | 39 | ||
109 | 41 | // NewConfig is the Config constructor | 40 | // NewConfig is the Config constructor |
110 | 42 | func NewConfig(fileName, release, channel, targetRelease, targetChannel string, update, rollback bool) *Config { | 41 | func NewConfig(fileName, release, channel, targetRelease, targetChannel string, update, rollback bool) *Config { |
111 | 43 | return &Config{ | 42 | return &Config{ |
115 | 44 | fileName: fileName, release: release, channel: channel, | 43 | FileName: fileName, Release: release, Channel: channel, |
116 | 45 | targetRelease: targetRelease, targetChannel: targetChannel, | 44 | TargetRelease: targetRelease, TargetChannel: targetChannel, |
117 | 46 | update: update, rollback: rollback, | 45 | Update: update, Rollback: rollback, |
118 | 47 | } | 46 | } |
119 | 48 | } | 47 | } |
120 | 49 | 48 | ||
121 | 50 | // Write writes the config to a file that will be copied to the test bed. | 49 | // Write writes the config to a file that will be copied to the test bed. |
122 | 51 | func (cfg Config) Write() { | 50 | func (cfg Config) Write() { |
123 | 52 | fmt.Println("Writing test config...") | 51 | fmt.Println("Writing test config...") |
138 | 53 | testConfig := map[string]string{ | 52 | fmt.Println(cfg) |
139 | 54 | "release": cfg.release, | 53 | encoded, err := json.Marshal(cfg) |
126 | 55 | "channel": cfg.channel, | ||
127 | 56 | } | ||
128 | 57 | if cfg.targetRelease != "" { | ||
129 | 58 | testConfig["targetRelease"] = cfg.targetRelease | ||
130 | 59 | } | ||
131 | 60 | if cfg.targetChannel != "" { | ||
132 | 61 | testConfig["targetChannel"] = cfg.targetChannel | ||
133 | 62 | } | ||
134 | 63 | testConfig["update"] = strconv.FormatBool(cfg.update) | ||
135 | 64 | testConfig["rollback"] = strconv.FormatBool(cfg.rollback) | ||
136 | 65 | fmt.Println(testConfig) | ||
137 | 66 | encoded, err := json.Marshal(testConfig) | ||
140 | 67 | if err != nil { | 54 | if err != nil { |
141 | 68 | log.Fatalf("Error encoding the test config: %v", err) | 55 | log.Fatalf("Error encoding the test config: %v", err) |
142 | 69 | } | 56 | } |
144 | 70 | err = ioutil.WriteFile(cfg.fileName, encoded, 0644) | 57 | err = ioutil.WriteFile(cfg.FileName, encoded, 0644) |
145 | 71 | if err != nil { | 58 | if err != nil { |
146 | 72 | log.Fatalf("Error writing the test config: %v", err) | 59 | log.Fatalf("Error writing the test config: %v", err) |
147 | 73 | } | 60 | } |
148 | 74 | } | 61 | } |
149 | 62 | |||
150 | 63 | // ReadConfig the config from a file | ||
151 | 64 | func ReadConfig(fileName string) (*Config, error) { | ||
152 | 65 | b, err := ioutil.ReadFile(fileName) | ||
153 | 66 | if err != nil { | ||
154 | 67 | return nil, err | ||
155 | 68 | } | ||
156 | 69 | var decoded Config | ||
157 | 70 | if err = json.Unmarshal(b, &decoded); err != nil { | ||
158 | 71 | return nil, err | ||
159 | 72 | } | ||
160 | 73 | return &decoded, nil | ||
161 | 74 | } | ||
162 | 75 | 75 | ||
163 | === added file '_integration-tests/helpers/config/config_test.go' | |||
164 | --- _integration-tests/helpers/config/config_test.go 1970-01-01 00:00:00 +0000 | |||
165 | +++ _integration-tests/helpers/config/config_test.go 2015-07-22 19:10:34 +0000 | |||
166 | @@ -0,0 +1,93 @@ | |||
167 | 1 | // -*- Mode: Go; indent-tabs-mode: t -*- | ||
168 | 2 | |||
169 | 3 | /* | ||
170 | 4 | * Copyright (C) 2014-2015 Canonical Ltd | ||
171 | 5 | * | ||
172 | 6 | * This program is free software: you can redistribute it and/or modify | ||
173 | 7 | * it under the terms of the GNU General Public License version 3 as | ||
174 | 8 | * published by the Free Software Foundation. | ||
175 | 9 | * | ||
176 | 10 | * This program is distributed in the hope that it will be useful, | ||
177 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
178 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
179 | 13 | * GNU General Public License for more details. | ||
180 | 14 | * | ||
181 | 15 | * You should have received a copy of the GNU General Public License | ||
182 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
183 | 17 | * | ||
184 | 18 | */ | ||
185 | 19 | |||
186 | 20 | package config | ||
187 | 21 | |||
188 | 22 | import ( | ||
189 | 23 | "fmt" | ||
190 | 24 | "io/ioutil" | ||
191 | 25 | "os" | ||
192 | 26 | "path/filepath" | ||
193 | 27 | "testing" | ||
194 | 28 | |||
195 | 29 | check "gopkg.in/check.v1" | ||
196 | 30 | ) | ||
197 | 31 | |||
198 | 32 | // Hook up check.v1 into the "go test" runner | ||
199 | 33 | func Test(t *testing.T) { check.TestingT(t) } | ||
200 | 34 | |||
201 | 35 | type ConfigSuite struct{} | ||
202 | 36 | |||
203 | 37 | var _ = check.Suite(&ConfigSuite{}) | ||
204 | 38 | |||
205 | 39 | func testConfigFileName(c *check.C) string { | ||
206 | 40 | tmpDir, err := ioutil.TempDir("", "") | ||
207 | 41 | c.Assert(err, check.IsNil, check.Commentf( | ||
208 | 42 | "Error creating a temporary directory: %v", err)) | ||
209 | 43 | return filepath.Join(tmpDir, "test.config") | ||
210 | 44 | } | ||
211 | 45 | |||
212 | 46 | func testConfigStruct(fileName string) *Config { | ||
213 | 47 | return NewConfig( | ||
214 | 48 | fileName, | ||
215 | 49 | "testrelease", "testchannel", "testtargetrelease", "testtargetchannel", | ||
216 | 50 | true, true) | ||
217 | 51 | } | ||
218 | 52 | func testConfigContents(fileName string) string { | ||
219 | 53 | return `{` + | ||
220 | 54 | fmt.Sprintf(`"FileName":"%s",`, fileName) + | ||
221 | 55 | `"Release":"testrelease",` + | ||
222 | 56 | `"Channel":"testchannel",` + | ||
223 | 57 | `"TargetRelease":"testtargetrelease",` + | ||
224 | 58 | `"TargetChannel":"testtargetchannel",` + | ||
225 | 59 | `"Update":true,` + | ||
226 | 60 | `"Rollback":true` + | ||
227 | 61 | `}` | ||
228 | 62 | } | ||
229 | 63 | |||
230 | 64 | func (s *ConfigSuite) TestWriteConfig(c *check.C) { | ||
231 | 65 | // Do not print to stdout. | ||
232 | 66 | devnull, err := os.Open(os.DevNull) | ||
233 | 67 | c.Assert(err, check.IsNil) | ||
234 | 68 | oldStdout := os.Stdout | ||
235 | 69 | os.Stdout = devnull | ||
236 | 70 | defer func() { | ||
237 | 71 | os.Stdout = oldStdout | ||
238 | 72 | }() | ||
239 | 73 | configFileName := testConfigFileName(c) | ||
240 | 74 | |||
241 | 75 | cfg := testConfigStruct(configFileName) | ||
242 | 76 | cfg.Write() | ||
243 | 77 | |||
244 | 78 | writtenConfig, err := ioutil.ReadFile(configFileName) | ||
245 | 79 | c.Assert(err, check.IsNil, check.Commentf("Error reading config: %v", err)) | ||
246 | 80 | c.Assert(string(writtenConfig), check.Equals, testConfigContents(configFileName)) | ||
247 | 81 | } | ||
248 | 82 | |||
249 | 83 | func (s *ConfigSuite) TestReadConfig(c *check.C) { | ||
250 | 84 | configFileName := testConfigFileName(c) | ||
251 | 85 | |||
252 | 86 | configContents := testConfigContents(configFileName) | ||
253 | 87 | ioutil.WriteFile(configFileName, []byte(configContents), 0644) | ||
254 | 88 | |||
255 | 89 | cfg, err := ReadConfig(configFileName) | ||
256 | 90 | |||
257 | 91 | c.Assert(err, check.IsNil, check.Commentf("Error reading config: %v", err)) | ||
258 | 92 | c.Assert(cfg, check.DeepEquals, testConfigStruct(configFileName)) | ||
259 | 93 | } | ||
260 | 0 | 94 | ||
261 | === renamed directory '_integration-tests/image' => '_integration-tests/helpers/image' | |||
262 | === modified file '_integration-tests/helpers/image/image.go' | |||
263 | --- _integration-tests/image/image.go 2015-07-22 15:12:24 +0000 | |||
264 | +++ _integration-tests/helpers/image/image.go 2015-07-22 19:10:34 +0000 | |||
265 | @@ -24,7 +24,7 @@ | |||
266 | 24 | "path/filepath" | 24 | "path/filepath" |
267 | 25 | "strings" | 25 | "strings" |
268 | 26 | 26 | ||
270 | 27 | utils "../utils" | 27 | "launchpad.net/snappy/_integration-tests/helpers/utils" |
271 | 28 | ) | 28 | ) |
272 | 29 | 29 | ||
273 | 30 | // Image type encapsulates image actions | 30 | // Image type encapsulates image actions |
274 | 31 | 31 | ||
275 | === renamed directory '_integration-tests/utils' => '_integration-tests/helpers/utils' | |||
276 | === modified file '_integration-tests/main.go' | |||
277 | --- _integration-tests/main.go 2015-07-22 19:10:34 +0000 | |||
278 | +++ _integration-tests/main.go 2015-07-22 19:10:34 +0000 | |||
279 | @@ -28,9 +28,9 @@ | |||
280 | 28 | "strconv" | 28 | "strconv" |
281 | 29 | "text/template" | 29 | "text/template" |
282 | 30 | 30 | ||
286 | 31 | config "./config" | 31 | "launchpad.net/snappy/_integration-tests/helpers/config" |
287 | 32 | image "./image" | 32 | "launchpad.net/snappy/_integration-tests/helpers/image" |
288 | 33 | utils "./utils" | 33 | "launchpad.net/snappy/_integration-tests/helpers/utils" |
289 | 34 | ) | 34 | ) |
290 | 35 | 35 | ||
291 | 36 | const ( | 36 | const ( |
292 | 37 | 37 | ||
293 | === modified file '_integration-tests/tests/apt_test.go' | |||
294 | --- _integration-tests/tests/apt_test.go 2015-07-22 19:10:34 +0000 | |||
295 | +++ _integration-tests/tests/apt_test.go 2015-07-22 19:10:34 +0000 | |||
296 | @@ -20,7 +20,7 @@ | |||
297 | 20 | package tests | 20 | package tests |
298 | 21 | 21 | ||
299 | 22 | import ( | 22 | import ( |
301 | 23 | . "launchpad.net/snappy/_integration-tests/common" | 23 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
302 | 24 | 24 | ||
303 | 25 | check "gopkg.in/check.v1" | 25 | check "gopkg.in/check.v1" |
304 | 26 | ) | 26 | ) |
305 | 27 | 27 | ||
306 | === modified file '_integration-tests/tests/build_test.go' | |||
307 | --- _integration-tests/tests/build_test.go 2015-07-22 19:10:34 +0000 | |||
308 | +++ _integration-tests/tests/build_test.go 2015-07-22 19:10:34 +0000 | |||
309 | @@ -24,7 +24,7 @@ | |||
310 | 24 | "os" | 24 | "os" |
311 | 25 | "os/exec" | 25 | "os/exec" |
312 | 26 | 26 | ||
314 | 27 | . "launchpad.net/snappy/_integration-tests/common" | 27 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
315 | 28 | 28 | ||
316 | 29 | . "gopkg.in/check.v1" | 29 | . "gopkg.in/check.v1" |
317 | 30 | ) | 30 | ) |
318 | 31 | 31 | ||
319 | === modified file '_integration-tests/tests/failover_rclocal_crash_test.go' | |||
320 | --- _integration-tests/tests/failover_rclocal_crash_test.go 2015-07-22 19:10:34 +0000 | |||
321 | +++ _integration-tests/tests/failover_rclocal_crash_test.go 2015-07-22 19:10:34 +0000 | |||
322 | @@ -22,7 +22,7 @@ | |||
323 | 22 | import ( | 22 | import ( |
324 | 23 | "fmt" | 23 | "fmt" |
325 | 24 | 24 | ||
327 | 25 | . "launchpad.net/snappy/_integration-tests/common" | 25 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
328 | 26 | 26 | ||
329 | 27 | check "gopkg.in/check.v1" | 27 | check "gopkg.in/check.v1" |
330 | 28 | ) | 28 | ) |
331 | 29 | 29 | ||
332 | === modified file '_integration-tests/tests/failover_systemd_loop_test.go' | |||
333 | --- _integration-tests/tests/failover_systemd_loop_test.go 2015-07-22 19:10:34 +0000 | |||
334 | +++ _integration-tests/tests/failover_systemd_loop_test.go 2015-07-22 19:10:34 +0000 | |||
335 | @@ -22,7 +22,7 @@ | |||
336 | 22 | import ( | 22 | import ( |
337 | 23 | "fmt" | 23 | "fmt" |
338 | 24 | 24 | ||
340 | 25 | . "launchpad.net/snappy/_integration-tests/common" | 25 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
341 | 26 | 26 | ||
342 | 27 | check "gopkg.in/check.v1" | 27 | check "gopkg.in/check.v1" |
343 | 28 | ) | 28 | ) |
344 | 29 | 29 | ||
345 | === modified file '_integration-tests/tests/failover_test.go' | |||
346 | --- _integration-tests/tests/failover_test.go 2015-07-22 19:10:34 +0000 | |||
347 | +++ _integration-tests/tests/failover_test.go 2015-07-22 19:10:34 +0000 | |||
348 | @@ -22,7 +22,7 @@ | |||
349 | 22 | import ( | 22 | import ( |
350 | 23 | check "gopkg.in/check.v1" | 23 | check "gopkg.in/check.v1" |
351 | 24 | 24 | ||
353 | 25 | . "launchpad.net/snappy/_integration-tests/common" | 25 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
354 | 26 | ) | 26 | ) |
355 | 27 | 27 | ||
356 | 28 | var _ = check.Suite(&failoverSuite{}) | 28 | var _ = check.Suite(&failoverSuite{}) |
357 | 29 | 29 | ||
358 | === modified file '_integration-tests/tests/failover_zero_size_file_test.go' | |||
359 | --- _integration-tests/tests/failover_zero_size_file_test.go 2015-07-22 19:10:34 +0000 | |||
360 | +++ _integration-tests/tests/failover_zero_size_file_test.go 2015-07-22 19:10:34 +0000 | |||
361 | @@ -25,7 +25,7 @@ | |||
362 | 25 | "path/filepath" | 25 | "path/filepath" |
363 | 26 | "strings" | 26 | "strings" |
364 | 27 | 27 | ||
366 | 28 | . "launchpad.net/snappy/_integration-tests/common" | 28 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
367 | 29 | 29 | ||
368 | 30 | check "gopkg.in/check.v1" | 30 | check "gopkg.in/check.v1" |
369 | 31 | ) | 31 | ) |
370 | 32 | 32 | ||
371 | === modified file '_integration-tests/tests/info_test.go' | |||
372 | --- _integration-tests/tests/info_test.go 2015-07-22 19:10:34 +0000 | |||
373 | +++ _integration-tests/tests/info_test.go 2015-07-22 19:10:34 +0000 | |||
374 | @@ -22,7 +22,7 @@ | |||
375 | 22 | import ( | 22 | import ( |
376 | 23 | "fmt" | 23 | "fmt" |
377 | 24 | 24 | ||
379 | 25 | . "launchpad.net/snappy/_integration-tests/common" | 25 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
380 | 26 | 26 | ||
381 | 27 | check "gopkg.in/check.v1" | 27 | check "gopkg.in/check.v1" |
382 | 28 | ) | 28 | ) |
383 | @@ -37,7 +37,7 @@ | |||
384 | 37 | infoOutput := ExecCommand(c, "snappy", "info") | 37 | infoOutput := ExecCommand(c, "snappy", "info") |
385 | 38 | 38 | ||
386 | 39 | expected := "(?ms)" + | 39 | expected := "(?ms)" + |
388 | 40 | fmt.Sprintf("^release: ubuntu-core/%s/%s\n", Config["release"], Config["channel"]) + | 40 | fmt.Sprintf("^release: ubuntu-core/%s/%s\n", Cfg.Release, Cfg.Channel) + |
389 | 41 | ".*" | 41 | ".*" |
390 | 42 | 42 | ||
391 | 43 | c.Assert(infoOutput, check.Matches, expected) | 43 | c.Assert(infoOutput, check.Matches, expected) |
392 | 44 | 44 | ||
393 | === modified file '_integration-tests/tests/installApp_test.go' | |||
394 | --- _integration-tests/tests/installApp_test.go 2015-07-22 19:10:34 +0000 | |||
395 | +++ _integration-tests/tests/installApp_test.go 2015-07-22 19:10:34 +0000 | |||
396 | @@ -24,7 +24,7 @@ | |||
397 | 24 | "os/exec" | 24 | "os/exec" |
398 | 25 | "time" | 25 | "time" |
399 | 26 | 26 | ||
401 | 27 | . "launchpad.net/snappy/_integration-tests/common" | 27 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
402 | 28 | 28 | ||
403 | 29 | check "gopkg.in/check.v1" | 29 | check "gopkg.in/check.v1" |
404 | 30 | ) | 30 | ) |
405 | 31 | 31 | ||
406 | === modified file '_integration-tests/tests/installFramework_test.go' | |||
407 | --- _integration-tests/tests/installFramework_test.go 2015-07-22 19:10:34 +0000 | |||
408 | +++ _integration-tests/tests/installFramework_test.go 2015-07-22 19:10:34 +0000 | |||
409 | @@ -23,7 +23,7 @@ | |||
410 | 23 | "fmt" | 23 | "fmt" |
411 | 24 | "regexp" | 24 | "regexp" |
412 | 25 | 25 | ||
414 | 26 | . "launchpad.net/snappy/_integration-tests/common" | 26 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
415 | 27 | 27 | ||
416 | 28 | check "gopkg.in/check.v1" | 28 | check "gopkg.in/check.v1" |
417 | 29 | ) | 29 | ) |
418 | 30 | 30 | ||
419 | === modified file '_integration-tests/tests/list_test.go' | |||
420 | --- _integration-tests/tests/list_test.go 2015-07-22 19:10:34 +0000 | |||
421 | +++ _integration-tests/tests/list_test.go 2015-07-22 19:10:34 +0000 | |||
422 | @@ -23,7 +23,7 @@ | |||
423 | 23 | "fmt" | 23 | "fmt" |
424 | 24 | "os" | 24 | "os" |
425 | 25 | 25 | ||
427 | 26 | . "launchpad.net/snappy/_integration-tests/common" | 26 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
428 | 27 | 27 | ||
429 | 28 | "github.com/mvo5/goconfigparser" | 28 | "github.com/mvo5/goconfigparser" |
430 | 29 | check "gopkg.in/check.v1" | 29 | check "gopkg.in/check.v1" |
431 | 30 | 30 | ||
432 | === modified file '_integration-tests/tests/rollback_test.go' | |||
433 | --- _integration-tests/tests/rollback_test.go 2015-07-22 19:10:34 +0000 | |||
434 | +++ _integration-tests/tests/rollback_test.go 2015-07-22 19:10:34 +0000 | |||
435 | @@ -22,7 +22,7 @@ | |||
436 | 22 | import ( | 22 | import ( |
437 | 23 | "strconv" | 23 | "strconv" |
438 | 24 | 24 | ||
440 | 25 | . "launchpad.net/snappy/_integration-tests/common" | 25 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
441 | 26 | 26 | ||
442 | 27 | check "gopkg.in/check.v1" | 27 | check "gopkg.in/check.v1" |
443 | 28 | ) | 28 | ) |
444 | 29 | 29 | ||
445 | === modified file '_integration-tests/tests/search_test.go' | |||
446 | --- _integration-tests/tests/search_test.go 2015-07-22 19:10:34 +0000 | |||
447 | +++ _integration-tests/tests/search_test.go 2015-07-22 19:10:34 +0000 | |||
448 | @@ -20,7 +20,7 @@ | |||
449 | 20 | package tests | 20 | package tests |
450 | 21 | 21 | ||
451 | 22 | import ( | 22 | import ( |
453 | 23 | . "launchpad.net/snappy/_integration-tests/common" | 23 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
454 | 24 | 24 | ||
455 | 25 | . "gopkg.in/check.v1" | 25 | . "gopkg.in/check.v1" |
456 | 26 | ) | 26 | ) |
457 | 27 | 27 | ||
458 | === modified file '_integration-tests/tests/update_test.go' | |||
459 | --- _integration-tests/tests/update_test.go 2015-07-22 19:10:34 +0000 | |||
460 | +++ _integration-tests/tests/update_test.go 2015-07-22 19:10:34 +0000 | |||
461 | @@ -20,7 +20,7 @@ | |||
462 | 20 | package tests | 20 | package tests |
463 | 21 | 21 | ||
464 | 22 | import ( | 22 | import ( |
466 | 23 | . "launchpad.net/snappy/_integration-tests/common" | 23 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
467 | 24 | 24 | ||
468 | 25 | check "gopkg.in/check.v1" | 25 | check "gopkg.in/check.v1" |
469 | 26 | ) | 26 | ) |
470 | 27 | 27 | ||
471 | === modified file '_integration-tests/tests/writablePaths_test.go' | |||
472 | --- _integration-tests/tests/writablePaths_test.go 2015-07-22 19:10:34 +0000 | |||
473 | +++ _integration-tests/tests/writablePaths_test.go 2015-07-22 19:10:34 +0000 | |||
474 | @@ -27,7 +27,7 @@ | |||
475 | 27 | "path/filepath" | 27 | "path/filepath" |
476 | 28 | "strings" | 28 | "strings" |
477 | 29 | 29 | ||
479 | 30 | . "launchpad.net/snappy/_integration-tests/common" | 30 | . "launchpad.net/snappy/_integration-tests/helpers/common" |
480 | 31 | 31 | ||
481 | 32 | check "gopkg.in/check.v1" | 32 | check "gopkg.in/check.v1" |
482 | 33 | ) | 33 | ) |
483 | 34 | 34 | ||
484 | === modified file 'run-checks' | |||
485 | --- run-checks 2015-07-22 19:10:34 +0000 | |||
486 | +++ run-checks 2015-07-22 19:10:34 +0000 | |||
487 | @@ -1,5 +1,5 @@ | |||
488 | 1 | #!/bin/sh | 1 | #!/bin/sh |
490 | 2 | 2 | 1;3803;0c | |
491 | 3 | set -ev | 3 | set -ev |
492 | 4 | 4 | ||
493 | 5 | if which goctest >/dev/null; then | 5 | if which goctest >/dev/null; then |
494 | @@ -46,10 +46,11 @@ | |||
495 | 46 | echo Running vet | 46 | echo Running vet |
496 | 47 | go vet ./... | 47 | go vet ./... |
497 | 48 | go vet ./_integration-tests/tests/... | 48 | go vet ./_integration-tests/tests/... |
498 | 49 | go vet ./_integration-tests/helpers/... | ||
499 | 49 | 50 | ||
500 | 50 | # golint | 51 | # golint |
501 | 51 | echo Running lint | 52 | echo Running lint |
503 | 52 | lint=$(golint ./... && golint ./_integration-tests/tests/...) | 53 | lint=$(golint ./... && golint ./_integration-tests/helpers/... && golint ./_integration-tests/tests/...) |
504 | 53 | if [ -n "$lint" ]; then | 54 | if [ -n "$lint" ]; then |
505 | 54 | echo "Lint complains:" | 55 | echo "Lint complains:" |
506 | 55 | echo $lint | 56 | echo $lint |
507 | @@ -72,7 +73,7 @@ | |||
508 | 72 | 73 | ||
509 | 73 | # the rabbit hole | 74 | # the rabbit hole |
510 | 74 | echo Running the tests for the integration helpers | 75 | echo Running the tests for the integration helpers |
512 | 75 | $goctest -v -cover ./_integration-tests/common/... | 76 | $goctest -v -cover ./_integration-tests/helpers/... |
513 | 76 | 77 | ||
514 | 77 | # integration suite in kvm | 78 | # integration suite in kvm |
515 | 78 | if which adt-run >/dev/null 2>&1; then | 79 | if which adt-run >/dev/null 2>&1; then |
Great! Very good idea the config encapsulation and the helpers folder =)