Skip to content

ZKAPAuthorizer tests failing due to KeyError #487

@crwood

Description

@crwood

Observed previously by @hacklschorsch after updating dependencies and running python -m twisted.trial _zkapauthorizer.tests.test_tahoe_lafs_integration.IntegrationTests.test_upload_download_mutable :

Traceback (most recent call last):
  File "/nix/store/vlllcjn79adpi9z09in631kh1x0i82k2-python3-3.12.5-env/lib/python3.12/site-packages/twisted/internet/defer.py", line 2003, in _inlineCallbacks
    result = context.run(gen.send, result)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/flo/Repositories/ZKAPAuthorizer_/src/_zkapauthorizer/tests/test_tahoe_lafs_integration.py", line 141, in test_upload_download_immutable
    await self.add_zkaps()
  File "/home/flo/Repositories/ZKAPAuthorizer_/src/_zkapauthorizer/tests/test_tahoe_lafs_integration.py", line 125, in add_zkaps
    await add_zkaps(self.http_client, api_root, self.grid.client.authorization)
  File "/home/flo/Repositories/ZKAPAuthorizer_/src/_zkapauthorizer/tests/test_tahoe_lafs_integration.py", line 73, in add_zkaps
    if body["state"]["counter"] > 0:
       ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'counter'

Possibly related, from the eliot logs:

    ├── eliot:destination_failure/3 2024-11-07 16:39:11Z
    │   ├── exception: builtins.TypeError
    │   ├── message: {"'server_id'": "b'v0-ecscj36dh3kipel4niddwhms5mzxv3pjq4mz7t4p2vbrgs3docya'", "'action_status'": "'started'", "'timestamp'"
: '1730997551.2695453', "'task_uuid'": "'265b2269-1260-4493-9614-0acd8edc01cd'", "'action_type'": "'storage-client:broker:make-storage-server'",
 "'task_level'": '[2, 1]'}
    │   └── reason: Type is not JSON serializable: bytes

While debugging the above, @hacklschorsch observed that the ZKAPAuthorizer sqlite database was empty when he thought it should not be (however, I don't have the details regarding this; perhaps @hacklschorsch could provide these later).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions