test: explain verbose reveals query identifier
This also requires enabling shared_preload_libraries=pg_stat_statements. Really we only need compute_query_id=on, but pg_stat_statements is useful for other tests and it already enables compute_query_id (since it's `auto` by default).
This commit is contained in:
committed by
Steve Chavez
parent
cb6fc55a2d
commit
ad790baefb
@@ -19,6 +19,7 @@ let
|
|||||||
autovacuum = false
|
autovacuum = false
|
||||||
listen_addresses = ''
|
listen_addresses = ''
|
||||||
log_statement = all
|
log_statement = all
|
||||||
|
shared_preload_libraries=pg_stat_statements
|
||||||
";
|
";
|
||||||
in
|
in
|
||||||
checkedShellScript
|
checkedShellScript
|
||||||
|
|||||||
@@ -94,6 +94,16 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|||||||
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; options=verbose; charset=utf-8")
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; options=verbose; charset=utf-8")
|
||||||
cols `shouldBe` Just [aesonQQ| ["projects.id", "projects.name", "projects.client_id"] |]
|
cols `shouldBe` Just [aesonQQ| ["projects.id", "projects.name", "projects.client_id"] |]
|
||||||
|
|
||||||
|
it "includes the Query Identifier field when using the verbose option" $ do
|
||||||
|
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; options=verbose") ""
|
||||||
|
|
||||||
|
let queryIdentifier = simpleBody r ^? nth 0 . key "Query Identifier"
|
||||||
|
resHeaders = simpleHeaders r
|
||||||
|
|
||||||
|
liftIO $ do
|
||||||
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; options=verbose; charset=utf-8")
|
||||||
|
queryIdentifier `shouldSatisfy` isJust
|
||||||
|
|
||||||
it "outputs the plan for application/json " $ do
|
it "outputs the plan for application/json " $ do
|
||||||
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; for=\"application/json\"; options=verbose") ""
|
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; for=\"application/json\"; options=verbose") ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user