mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
nixos/tests/nextcloud: fix redis cache non empty tests
This patch changes the implementation of the subtests to check for redis' cache being non empty to only run redis-cli and jq in a shell and assert the returned length in python. This fixes jq "len" simply not compiling and makes sure regressions get noticed.
This commit is contained in:
parent
18de1c264e
commit
549d8a6d44
2 changed files with 7 additions and 2 deletions
|
@ -102,7 +102,9 @@ runTest (
|
||||||
test-helpers.extraTests = ''
|
test-helpers.extraTests = ''
|
||||||
with subtest("non-empty redis cache"):
|
with subtest("non-empty redis cache"):
|
||||||
# redis cache should not be empty
|
# redis cache should not be empty
|
||||||
nextcloud.fail('test 0 -lt "$(redis-cli --pass secret --json KEYS "*" | jq "len")"')
|
assert nextcloud.succeed('redis-cli --pass secret --json KEYS "*" | jq length').strip() != "0", """
|
||||||
|
redis-cli for keys * returned 0 entries
|
||||||
|
"""
|
||||||
|
|
||||||
with subtest("notify-push"):
|
with subtest("notify-push"):
|
||||||
client.execute("${lib.getExe pkgs.nextcloud-notify_push.passthru.test_client} http://nextcloud ${config.adminuser} ${config.adminpass} >&2 &")
|
client.execute("${lib.getExe pkgs.nextcloud-notify_push.passthru.test_client} http://nextcloud ${config.adminuser} ${config.adminpass} >&2 &")
|
||||||
|
|
|
@ -29,6 +29,7 @@ runTest (
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
environment.systemPackages = [ pkgs.jq ];
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
caching = {
|
caching = {
|
||||||
apcu = false;
|
apcu = false;
|
||||||
|
@ -73,7 +74,9 @@ runTest (
|
||||||
|
|
||||||
with subtest("Redis is used for caching"):
|
with subtest("Redis is used for caching"):
|
||||||
# redis cache should not be empty
|
# redis cache should not be empty
|
||||||
nextcloud.fail('test "[]" = "$(redis-cli --json KEYS "*")"')
|
assert nextcloud.succeed('redis-cli --json KEYS "*" | jq length').strip() != "0", """
|
||||||
|
redis-cli for keys * returned 0 entries
|
||||||
|
"""
|
||||||
|
|
||||||
with subtest("No code is returned when requesting PHP files (regression test)"):
|
with subtest("No code is returned when requesting PHP files (regression test)"):
|
||||||
nextcloud.fail("curl -f http://nextcloud/nix-apps/notes/lib/AppInfo/Application.php")
|
nextcloud.fail("curl -f http://nextcloud/nix-apps/notes/lib/AppInfo/Application.php")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue