nixos/tests/glitchtip: test sourcemap uploads

This commit is contained in:
Defelo
2025-08-31 18:01:10 +02:00
parent b24caa9c50
commit e9de9b50ce

View File

@@ -42,7 +42,9 @@ in
];
};
testScript = ''
testScript =
{ nodes, ... }: # python
''
import json
import re
import time
@@ -99,5 +101,14 @@ in
assert len(resp) == 1
assert resp[0]["title"] == "hello world"
assert int(resp[0]["count"]) == 1
# create api token
csrf_token = machine.succeed(f"grep csrftoken {cookie_jar_path} | cut -f7").rstrip()
resp = json.loads(machine.succeed(f"{curl} {origin_url}/api/0/api-tokens/ -s -H 'X-Csrftoken: {csrf_token}' -H 'Content-Type: application/json' -d '{{\"label\":\"token\",\"scopes\":[\"project:write\"]}}'"))
token = resp["token"]
# upload sourcemaps
machine.succeed(f"sentry-cli --url {origin_url} --auth-token {token} sourcemaps upload --org main --project test ${nodes.machine.services.glitchtip.package.frontend}/*.map")
assert machine.succeed("ls /var/lib/glitchtip/uploads/file_blobs/").strip()
'';
}