mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
e3152f80bf
This was always upstream's default but they also change the internal port, i.e. behind the reverse proxy, to 2283 in https://github.com/immich-app/immich/pull/13185.
52 lines
1.6 KiB
Nix
52 lines
1.6 KiB
Nix
import ../make-test-python.nix (
|
|
{ ... }:
|
|
{
|
|
name = "immich-nixos";
|
|
|
|
nodes.machine =
|
|
{ pkgs, ... }:
|
|
{
|
|
# These tests need a little more juice
|
|
virtualisation = {
|
|
cores = 2;
|
|
memorySize = 2048;
|
|
diskSize = 4096;
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [ immich-cli ];
|
|
|
|
services.immich = {
|
|
enable = true;
|
|
environment.IMMICH_LOG_LEVEL = "verbose";
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
import json
|
|
|
|
machine.wait_for_unit("immich-server.service")
|
|
|
|
machine.wait_for_open_port(2283) # Server
|
|
machine.wait_for_open_port(3003) # Machine learning
|
|
machine.succeed("curl --fail http://localhost:2283/")
|
|
|
|
machine.succeed("""
|
|
curl -H 'Content-Type: application/json' --data '{ "email": "test@example.com", "name": "Admin", "password": "admin" }' -X POST http://localhost:2283/api/auth/admin-sign-up
|
|
""")
|
|
res = machine.succeed("""
|
|
curl -H 'Content-Type: application/json' --data '{ "email": "test@example.com", "password": "admin" }' -X POST http://localhost:2283/api/auth/login
|
|
""")
|
|
token = json.loads(res)['accessToken']
|
|
|
|
res = machine.succeed("""
|
|
curl -H 'Content-Type: application/json' -H 'Cookie: immich_access_token=%s' --data '{ "name": "API Key", "permissions": ["all"] }' -X POST http://localhost:2283/api/api-keys
|
|
""" % token)
|
|
key = json.loads(res)['secret']
|
|
|
|
machine.succeed(f"immich login http://localhost:2283/api {key}")
|
|
res = machine.succeed("immich server-info")
|
|
print(res)
|
|
'';
|
|
}
|
|
)
|