test: sanity tests for primary and replica
* new --replica option to `postgrest-with-postgresql-*` * new command `postgrest-test-replica` * new sanity tests on test_replica.py * add postgrest-test-replica to postgrest-check and postgrest-coverage
This commit is contained in:
committed by
Steve Chavez
parent
cdb877135b
commit
d9a51f23ce
@@ -0,0 +1,28 @@
|
||||
"IO tests for PostgREST started on replicas"
|
||||
|
||||
import pytest
|
||||
|
||||
from config import *
|
||||
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}]'
|
||||
Reference in New Issue
Block a user