Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions start-ferretdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
FERRETDB_VERSION=$1
FERRETDB_PORT=$2
FERRETDB_TELEMETRY=$3
USE_POSTGRES=$4

echo "Starting FerretDB version ${FERRETDB_VERSION} on port ${FERRETDB_PORT}"

Expand All @@ -12,13 +11,14 @@ docker network create ferretdb
docker run --network ferretdb --name postgres \
-e POSTGRES_USER=username \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=ferretdb \
-e POSTGRES_DB=postgres \
-d ghcr.io/ferretdb/postgres-documentdb:latest

docker run --network ferretdb --name ferretdb \
-p $FERRETDB_PORT:27017 \
-e FERRETDB_POSTGRESQL_URL=postgres://username:password@postgres:5432/ferretdb?pool_max_conns=40 \
-e FERRETDB_POSTGRESQL_URL=postgres://username:password@postgres:5432/postgres?pool_max_conns=40 \
-e FERRETDB_TELEMETRY=$FERRETDB_TELEMETRY \
-e FERRETDB_AUTH=false \
-d ghcr.io/ferretdb/ferretdb:$FERRETDB_VERSION

if [ $? -ne 0 ]; then
Expand Down
9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ test("connects to FerretDB", async () => {
await connection.close()
})

test("creates a collection and record", async () => {
const connection = await Mongoose.createConnection(`mongodb://localhost:${PORT}`).asPromise()

const collection = await connection.createCollection("TestCollection")
await collection.insertOne({ name: "Test Document" })

await connection.close()
})

test("fails to connect to non-existent FerretDB instance", async () => {
await expect(
Mongoose.connect(`mongodb://localhost:${parseInt(PORT) + 1}`, {
Expand Down