FaunaClient Error and best practices

Hi all,

New to Fauna.

In test cases we are injecting a (connected) FaunaClient into the test classes. The first test runs fine but the second always fails with the error:

Caused by: com.faunadb.client.errors.UnauthorizedException at FaunaClient.java:367

Any thoughts on what causes the error ?

Running individual test works fine.

What is the best practice for sharing faunaclient across tests , threads , connection pooling ?

regards

MJ

@mjplan, moving the conversation from Slack to here. You can have faunaclient per thread or shared across threads. Are you still seeing Unauthorized exception ? What in in your test run ? Any creation/deletion of schema objects ?

@Jay The issue was resolved when the code was changed to ensure that the FaunaClient was a singleton and then passed between testcases. First time, yes there is creation/deletion of schema objects.

regards

1 Like