diff --git a/start-ferretdb.sh b/start-ferretdb.sh index 05c8fbc..855f0b1 100644 --- a/start-ferretdb.sh +++ b/start-ferretdb.sh @@ -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}" @@ -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 diff --git a/test/test.js b/test/test.js index dabbc12..b3bf595 100644 --- a/test/test.js +++ b/test/test.js @@ -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}`, {