Skip to content

Commit

Permalink
Use mongo6 for github action test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Jan 23, 2024
1 parent 76d0e8f commit e17f37f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ jobs:
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 4.4
mongodb-version: 6.0
mongodb-port: 27017
mongodb-db: wildduck-test

- name: Use Node.js ${{ matrix.node }}
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
Expand Down
4 changes: 2 additions & 2 deletions imap-core/test/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions imap-core/test/protocol-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e17f37f

Please sign in to comment.