|
|
|
@@ -34,7 +34,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 1.11
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for a single filter on a view" $ do
|
|
|
|
|
r <- request methodGet "/projects_view?id=gt.2"
|
|
|
|
@@ -47,7 +47,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
liftIO $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 1.1
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs blocks info when using the buffers option" $ do
|
|
|
|
|
r <- request methodGet "/projects" (acceptHdrs "application/vnd.pgrst.plan+json; options=buffers") ""
|
|
|
|
@@ -139,7 +139,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 0.06
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for an update" $ do
|
|
|
|
|
r <- request methodPatch "/projects?id=eq.3"
|
|
|
|
@@ -153,7 +153,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 1.13
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for a delete" $ do
|
|
|
|
|
r <- request methodDelete "/projects?id=in.(1,2,3)"
|
|
|
|
@@ -167,7 +167,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 1.16
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for a single upsert" $ do
|
|
|
|
|
r <- request methodPut "/tiobe_pls?name=eq.Go"
|
|
|
|
@@ -182,7 +182,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 3.55
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for 2 upserts" $ do
|
|
|
|
|
r <- request methodPost "/tiobe_pls"
|
|
|
|
@@ -197,7 +197,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 5.53
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for an upsert with 10 rows" $ do
|
|
|
|
|
r <- request methodPost "/tiobe_pls"
|
|
|
|
@@ -211,7 +211,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
liftIO $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 5.53
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for an upsert with 100 rows" $ do
|
|
|
|
|
r <- request methodPost "/tiobe_pls"
|
|
|
|
@@ -225,7 +225,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
liftIO $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 5.53
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the total cost for an upsert with 1000 rows" $ do
|
|
|
|
|
r <- request methodPost "/tiobe_pls"
|
|
|
|
@@ -239,7 +239,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
liftIO $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 5.53
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
it "outputs the plan for application/vnd.pgrst.object" $ do
|
|
|
|
|
r <- request methodDelete "/projects?id=eq.6"
|
|
|
|
@@ -266,7 +266,7 @@ spec withConfig = withConfig (baseCfg { configDbPlanEnabled = True }) $ do
|
|
|
|
|
resHeaders `shouldSatisfy` elem ("Content-Type", "application/vnd.pgrst.plan+json; for=\"application/json\"; charset=utf-8")
|
|
|
|
|
resHeaders `shouldSatisfy` notZeroContentLength
|
|
|
|
|
resStatus `shouldBe` Status { statusCode = 200, statusMessage="OK" }
|
|
|
|
|
totalCost `shouldBe` 68.56
|
|
|
|
|
totalCost `shouldSatisfy` (> 0)
|
|
|
|
|
|
|
|
|
|
describe "text format" $ do
|
|
|
|
|
it "outputs the total cost for a function call" $ do
|
|
|
|
|