# Testing, busted, postgres

**URL:** <https://discuss.konghq.com/t/testing-busted-postgres/7465>\
**Category:** Questions\
**Created:** [November 17, 2020, 11:24pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465 "2020-11-17T23:24:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krisk](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@krisk](https://discuss.konghq.com/u/krisk)\
**Post date:** [November 17, 2020, 11:24pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465/1 "2020-11-17T23:24:33Z")

</div>

Following the example from _[Plugin Development - Writing tests - v2.2.x | Kong Docs](https://docs.konghq.com/2.2.x/plugin-development/tests/)_  
I am successfully running tests using Cassandra DB;

Is it possible to run these test using Postgres DB ?

When I set KONG\_DATABASE=postgres , that value is nil inside the helper.lua and my code enumerate the default set (postgres, cassandra) failing on non existing strategy=cassandra. If I change the name of env variable to anything but KONG\_DATABASE , everything works perfectly; for example KKONG\_DATABASE=postgres? But that requires me to change the _helpers.lua_ code?

I have notice that in case of tests setup with cassandra; following code also enumerates strategies \<postgres, cassandra\> but somehow postgres is ignored and tests are succeeding?

> local helpers = require “spec.helpers”
> 
> for \_, strategy in helpers.each\_strategy() do  
> describe(“my plugin”, function()

---

<div class="post-metadata">

**Author:** ![vinicius.mignot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/vinicius.mignot/32/3442_2.png) [@vinicius.mignot](https://discuss.konghq.com/u/vinicius.mignot)\
**Post date:** [November 18, 2020, 3:42pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465/2 "2020-11-18T15:42:22Z")

</div>

Can you paste the command line you are using to run the tests, please?

When running with `busted` both Cassandra and Postgres strategies should be tested, by default. To ease the process, you can use [kong-tests-compose](https://github.com/thibaultcha/kong-tests-compose) to run all the dependencies needed.

---

<div class="post-metadata">

**Author:** ![krisk](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@krisk](https://discuss.konghq.com/u/krisk)\
**Post date:** [November 18, 2020, 3:58pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465/3 "2020-11-18T15:58:40Z")

</div>

I want to restrict it only to postgres

cd /home/kong-api-gateway-plugins/_build_/kong-src-2.1.3 && DIGEST\_USER=x DIGEST\_PASSWORD=x **KONG\_DATABASE** =postgres ANONYMOUS\_USER\_ID=x KONG\_SPEC\_TEST\_CONF\_PATH=/home/kong-api-gateway-plugins/_build_/spec/kong.conf /home/kong-api-gateway-plugins/_build_/kong-src-2.1.3/bin/busted -v -o gtest -C /home/kong-api-gateway-plugins/_build_/kong-src-2.1.3 --coverage --lpath=’?.lua;./src/?.lua;./src/?/?.lua;./src/?/init.lua’ --cpath=’./csrc/?.so;./csrc/?/?.so;;’ /home/kong-api-gateway-plugins/spec/plugins/test-plugin -o gtest;

---

<div class="post-metadata">

**Author:** ![vinicius.mignot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/vinicius.mignot/32/3442_2.png) [@vinicius.mignot](https://discuss.konghq.com/u/vinicius.mignot)\
**Post date:** [November 18, 2020, 4:45pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465/4 "2020-11-18T16:45:10Z")

</div>

Sorry, it slipped me the var name you mentioned in the original message. The env var you want to set is `KONG_TEST_DATABASE=postgres`, that’s the one used by `busted`.

---

<div class="post-metadata">

**Author:** ![krisk](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@krisk](https://discuss.konghq.com/u/krisk)\
**Post date:** [November 18, 2020, 6:22pm UTC](https://discuss.konghq.com/t/testing-busted-postgres/7465/5 "2020-11-18T18:22:25Z")

</div>

Thank you very much , that resolved my issue
