why-not-try-calmer / test-mongo

Investigating a painful bug on the Haskell MongoDB community driver
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

test-mongo

Setup

There is a Docker image available for testing.

docker pull ghcr.io/why-not-try-calmer/test-mongo:master
docker run -it -t test-mongo --rm --env-file ./ENVARS.txt

NB:--env-file must reference a file containing the credentials to be passed as environment variables to the container -- see ENVARS.txt in the present repository.

For example, this tries to connect to a ReplicaSet:

is_replica_set=true
hname=cluster0.xpugk.mongodb.net
dname=test-db
uname=tester
pword=95BqF22T78gUUanH
coll=test-collection

while this tries to connect to a standard Mongo database server:

is_replica_set=false
hname=127.0.0.1
dname=test-db
uname=tester
pword=95BqF22T78gUUanH
coll=test-collection

Testing

The test will ensure two preliminaies:

  1. It will parse the strings passed in ENVARS.txt, instantiate a Config, try to connect and authenticate.
  2. It will delete all items on the target collection.

At this point the test will exist if (1) failed, but nothing will be reported regarding (2).

  1. It will test writes, reads and deletions. At this stage each failure or success is reported independently.

Building

After cloning and cd-ing to the direct, build with:

docker build -t test-mongo

See "Testing" above to run the tests.