From 96976fbc0e263658e55281472b3fd04b77defc1b Mon Sep 17 00:00:00 2001 From: Debdut Chakraborty Date: Tue, 12 Nov 2024 12:38:43 +0530 Subject: [PATCH] snap: use JSON.stringify instead of printjson with `mongosh`, printjson is just an alias to print, causing outputs to not be in JSON, thus `jq` failing. See `printjson.help`, `print.help`. --- snap/snap.bats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snap/snap.bats b/snap/snap.bats index 2220624..1f1e0d6 100644 --- a/snap/snap.bats +++ b/snap/snap.bats @@ -66,7 +66,7 @@ setup_file() { assert_success wait_for_server run --separate-stderr /snap/rocketchat-server/current/usr/bin/mongosh --quiet --eval ' - printjson( + print(JSON.stringify( db.getSiblingDB("parties").rocketchat_settings.findOne({ _id: "Accounts_TwoFactorAuthentication_Enabled" }, { @@ -75,7 +75,7 @@ setup_file() { processEnvValue: 1, _id: 0 }) - ) + )) ' assert_success assert_field_equal value 'false' @@ -90,7 +90,7 @@ setup_file() { run --separate-stderr /snap/rocketchat-server/current/usr/bin/mongosh --quiet --eval ' config = db.getSiblingDB("local").system.replset.findOne( { "_id": "rs0" } ); config.members[0].host = "localhost:27018"; - db.getSiblingDB("local").system.replset.updateOne( { "_id": "rs0" }, { $set: config } ); + print(JSON.stringify(db.getSiblingDB("local").system.replset.updateOne( { "_id": "rs0" }, { $set: config } ))); ' assert_success assert_field_equal acknowledged 'true'