There are a few benefits for this:
- All fixtures in one module, so single source of truth.
- The fixtures are automatically imported and injected by pytest
so no explicit imports needed for these.
- Linters won't complain about redefinition of outer scope objects.
Co-authored-by: Jens Troeger <jens.troeger@light-speed.de>
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
26 lines
875 B
Python
26 lines
875 B
Python
"IO tests for PostgREST started on replicas"
|
|
|
|
from util import *
|
|
from postgrest import *
|
|
|
|
|
|
def test_sanity_replica(replicaenv):
|
|
"Test that primary and replica are working as intended"
|
|
|
|
with run(env=replicaenv["primary"]) as postgrest:
|
|
response = postgrest.session.get("/rpc/is_replica")
|
|
assert response.text == "false"
|
|
|
|
response = postgrest.session.get("/rpc/get_replica_slot")
|
|
assert response.text == '"' + replicaenv["replica"]["PGREPLICASLOT"] + '"'
|
|
|
|
response = postgrest.session.get("/items?select=count")
|
|
assert response.text == '[{"count":10}]'
|
|
|
|
with run(env=replicaenv["replica"]) as postgrest:
|
|
response = postgrest.session.get("/rpc/is_replica")
|
|
assert response.text == "true"
|
|
|
|
response = postgrest.session.get("/items?select=count")
|
|
assert response.text == '[{"count":10}]'
|