Tests Failing Occasionally because of Invalid Absinthe Schema

I have an application using Absinthe, and recently some of our tests around Absinthe are failing with similar errors. Even when re-running tests with the same seed, the failures don’t always happen. So far, all errors stem from a similar stack trace:

       (absinthe_plug 1.4.7) lib/absinthe/plug.ex:193: Absinthe.Plug.init/1
       (phoenix 1.4.14) lib/phoenix/router/route.ex:40: Phoenix.Router.Route.call/2
       (phoenix 1.4.14) lib/phoenix/router.ex:288: Phoenix.Router.__call__/2
       (myapp 0.5.1) lib/plug/error_handler.ex:64: MyAppWeb.Router.call/2
       (myapp 0.5.1) lib/myapp/endpoint.ex:1: MyAppWeb.Endpoint.plug_builder_call/2
       (myapp0.5.1) lib/myapp/endpoint.ex:1: MyAppWeb.Endpoint.call/2
       (phoenix 1.4.14) lib/phoenix/test/conn_test.ex:235: Phoenix.ConnTest.dispatch/5
       test/.../test.exs:100: (test)

** (ArgumentError) The supplied schema: MyAppWeb.Schema is not a valid Absinthe Schema

I’ve tried to dig into why the schema is seen as invalid, and every time it seems to be linked to the Absinthe.Subscriptions module. It’s always been one of two functions, either add_middleware/1 or call/2.

As well, I tried adding Absinthe.Test.prime(MyAppWeb.Schema) to my test_helpers.exs (which I didn’t have before, but will keep now), however, it doesn’t seem to help.

Has anyone experienced anything like this before? Is there any way we can mitigate this? When running with mix test --trace, there haven’t been any errors.