|
21 | 21 | def find_in_logs(unit, text):
|
22 | 22 | return server.systemctl("status {}".format(unit))[1].find(text) != -1
|
23 | 23 |
|
24 |
| - with subtest("cron job succeeds"): |
25 |
| - # This calls blocks until the service is done. |
26 |
| - server.systemctl("start nextcloud-cron.service") |
27 |
| -
|
28 |
| - # If the service failed, then we're not happy. |
29 |
| - status = "active" |
30 |
| - while status == "active": |
31 |
| - status = server.get_unit_info("nextcloud-cron")["ActiveState"] |
32 |
| - time.sleep(5) |
33 |
| - if status != "inactive": |
34 |
| - raise Exception("Cron job did not finish correctly") |
35 |
| -
|
36 |
| - if not find_in_logs("nextcloud-cron", "nextcloud-cron.service: Deactivated successfully."): |
37 |
| - raise Exception("Nextcloud cron job did not finish successfully.") |
| 24 | + with subtest("cron job starts"): |
| 25 | + # This call does not block until the service is done. |
| 26 | + server.succeed("systemctl start nextcloud-cron.service&") |
38 | 27 |
|
39 | 28 | with subtest("fails with incorrect authentication"):
|
40 | 29 | client.fail(
|
|
106 | 95 | )
|
107 | 96 | if content != "hello\n":
|
108 | 97 | raise Exception("Got incorrect content for file, expected 'hello\n' but got:\n{}".format(content))
|
| 98 | +
|
| 99 | + with subtest("cron job succeeds"): |
| 100 | + # If the service failed, then we're not happy. |
| 101 | + status = "active" |
| 102 | + while status == "active": |
| 103 | + status = server.get_unit_info("nextcloud-cron")["ActiveState"] |
| 104 | + time.sleep(5) |
| 105 | + if status != "inactive": |
| 106 | + raise Exception("Cron job did not finish correctly") |
| 107 | +
|
| 108 | + if not find_in_logs("nextcloud-cron", "nextcloud-cron.service: Deactivated successfully."): |
| 109 | + raise Exception("Nextcloud cron job did not finish successfully.") |
109 | 110 | '';
|
110 | 111 | };
|
111 | 112 |
|
112 | 113 | basic = { config, ... }: {
|
| 114 | + imports = [ |
| 115 | + testLib.baseModule |
| 116 | + ../../modules/services/nextcloud-server.nix |
| 117 | + ]; |
| 118 | + |
113 | 119 | test = {
|
114 | 120 | subdomain = "n";
|
115 | 121 | };
|
|
136 | 142 | };
|
137 | 143 | };
|
138 | 144 |
|
| 145 | + clientLogin = { config, ... }: { |
| 146 | + imports = [ |
| 147 | + testLib.baseModule |
| 148 | + testLib.clientLoginModule |
| 149 | + ]; |
| 150 | + virtualisation.memorySize = 4096; |
| 151 | + |
| 152 | + test = { |
| 153 | + subdomain = "n"; |
| 154 | + }; |
| 155 | + |
| 156 | + test.login = { |
| 157 | + startUrl = "http://${config.test.fqdn}"; |
| 158 | + usernameFieldLabelRegex = "[Uu]sername"; |
| 159 | + passwordFieldLabelRegex = "^ *[Pp]assword"; |
| 160 | + loginButtonNameRegex = "[Ll]og [Ii]n"; |
| 161 | + testLoginWith = [ |
| 162 | + { username = adminUser; password = adminPass; nextPageExpect = [ |
| 163 | + "expect(page.get_by_text('Wrong username or password')).not_to_be_visible()" |
| 164 | + "expect(page.get_by_role('button', name=re.compile('[Ll]og [Ii]n'))).not_to_be_visible()" |
| 165 | + "expect(page).to_have_title(re.compile('Dashboard'))" |
| 166 | + ]; } |
| 167 | + # Failure is after so we're not throttled too much. |
| 168 | + { username = adminUser; password = adminPass + "oops"; nextPageExpect = [ |
| 169 | + "expect(page.get_by_text('Wrong username or password')).to_be_visible()" |
| 170 | + ]; } |
| 171 | + ]; |
| 172 | + }; |
| 173 | + }; |
| 174 | + |
139 | 175 | https = { config, ...}: {
|
140 | 176 | shb.nextcloud = {
|
141 | 177 | ssl = config.shb.certs.certs.selfsigned.n;
|
|
234 | 270 | basic = pkgs.testers.runNixOSTest {
|
235 | 271 | name = "nextcloud_basic";
|
236 | 272 |
|
| 273 | + nodes.client = { |
| 274 | + imports = [ |
| 275 | + clientLogin |
| 276 | + ]; |
| 277 | + }; |
237 | 278 | nodes.server = {
|
238 | 279 | imports = [
|
239 |
| - testLib.baseModule |
240 |
| - ../../modules/services/nextcloud-server.nix |
241 | 280 | basic
|
242 | 281 | ];
|
243 | 282 | };
|
|
252 | 291 |
|
253 | 292 | nodes.server = { config, ... }: {
|
254 | 293 | imports = [
|
255 |
| - testLib.baseModule |
256 |
| - ../../modules/services/nextcloud-server.nix |
257 | 294 | basic
|
258 | 295 | (testLib.backup config.shb.nextcloud.backup)
|
259 | 296 | ];
|
|
269 | 306 |
|
270 | 307 | nodes.server = {
|
271 | 308 | imports = [
|
272 |
| - testLib.baseModule |
273 |
| - ../../modules/services/nextcloud-server.nix |
274 |
| - testLib.certs |
275 | 309 | basic
|
| 310 | + testLib.certs |
276 | 311 | https
|
277 | 312 | ];
|
278 | 313 | };
|
|
288 | 323 |
|
289 | 324 | nodes.server = {
|
290 | 325 | imports = [
|
291 |
| - testLib.baseModule |
292 |
| - ../../modules/services/nextcloud-server.nix |
293 |
| - testLib.certs |
294 | 326 | basic
|
| 327 | + testLib.certs |
295 | 328 | https
|
296 | 329 | previewgenerator
|
297 | 330 | ];
|
|
307 | 340 |
|
308 | 341 | nodes.server = {
|
309 | 342 | imports = [
|
310 |
| - testLib.baseModule |
311 |
| - ../../modules/services/nextcloud-server.nix |
312 |
| - testLib.certs |
313 | 343 | basic
|
| 344 | + testLib.certs |
314 | 345 | https
|
315 | 346 | externalstorage
|
316 | 347 | ];
|
|
326 | 357 |
|
327 | 358 | nodes.server = { config, ... }: {
|
328 | 359 | imports = [
|
329 |
| - testLib.baseModule |
330 |
| - ../../modules/services/nextcloud-server.nix |
331 |
| - testLib.certs |
332 | 360 | basic
|
| 361 | + testLib.certs |
333 | 362 | https
|
334 | 363 | testLib.ldap
|
335 | 364 | ldap
|
|
346 | 375 |
|
347 | 376 | nodes.server = { config, ... }: {
|
348 | 377 | imports = [
|
349 |
| - testLib.baseModule |
350 |
| - ../../modules/services/nextcloud-server.nix |
351 |
| - testLib.certs |
352 | 378 | basic
|
| 379 | + testLib.certs |
353 | 380 | https
|
354 | 381 | testLib.ldap
|
355 | 382 | ldap
|
|
368 | 395 |
|
369 | 396 | nodes.server = { config, ... }: {
|
370 | 397 | imports = [
|
371 |
| - testLib.baseModule |
372 |
| - ../../modules/services/nextcloud-server.nix |
373 | 398 | basic
|
374 | 399 | prometheus
|
375 | 400 | ];
|
|
0 commit comments