diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dd070ee..63194bc5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: - name: Start MongoDB uses: supercharge/mongodb-github-action@1.7.0 with: - mongodb-version: 4.4 + mongodb-version: 6.0 mongodb-port: 27017 mongodb-db: wildduck-test @@ -39,7 +39,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - run: which mongo + - run: which mongosh - run: npm install - name: Run tests run: npm run runtest diff --git a/imap-core/test/prepare.sh b/imap-core/test/prepare.sh index ad4121a7..c5ce9ed4 100755 --- a/imap-core/test/prepare.sh +++ b/imap-core/test/prepare.sh @@ -6,7 +6,7 @@ which mongo DBNAME="$1" echo "Clearing DB" -mongo "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null +mongosh "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null echo "Creating user" USERRESPONSE=`curl --silent -XPOST http://127.0.0.1:8080/users \ @@ -69,7 +69,7 @@ subject: test6 hello 6 " -mongo "$DBNAME" --eval "db.mailboxes.updateOne({_id: ObjectId('$INBOXID')}, {\$set:{modifyIndex: 5000, uidNext: 1000}}); +mongosh "$DBNAME" --eval "db.mailboxes.updateOne({_id: ObjectId('$INBOXID')}, {\$set:{modifyIndex: 5000, uidNext: 1000}}); db.messages.updateOne({mailbox: ObjectId('$INBOXID'), uid:1}, {\$set:{modseq: 100}}); db.messages.updateOne({mailbox: ObjectId('$INBOXID'), uid:2}, {\$set:{modseq: 5000}}); db.messages.updateMany({}, {\$inc:{uid: 100}});" > /dev/null diff --git a/imap-core/test/protocol-test.js b/imap-core/test/protocol-test.js index 3081f86d..aaba0330 100644 --- a/imap-core/test/protocol-test.js +++ b/imap-core/test/protocol-test.js @@ -35,8 +35,8 @@ describe('IMAP Protocol integration tests', function () { }); after(function (done) { - //mongo "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null - exec('mongo ' + config.dbs.dbname + ' --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})"', err => { + //mongosh "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null + exec('mongosh ' + config.dbs.dbname + ' --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})"', err => { if (err) { return done(err); } diff --git a/package.json b/package.json index 2d863309..45beec54 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "IMAP/POP3 server built with Node.js and MongoDB", "main": "server.js", "scripts": { - "test": "mongo --eval 'db.dropDatabase()' wildduck-test && redis-cli -n 13 flushdb && npm run runtest", + "test": "mongosh --eval 'db.dropDatabase()' wildduck-test && redis-cli -n 13 flushdb && npm run runtest", "test:proto": "NODE_ENV=test grunt proto", "printconf": "NODE_CONFIG_ONLY=true npm start", "runtest": "NODE_ENV=test grunt",