Skip to content

Commit

Permalink
Run command test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill5k committed Apr 9, 2024
1 parent 318606b commit 6afd76b
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import cats.effect.IO
import cats.effect.unsafe.IORuntime
import com.mongodb.{ReadConcern, ReadPreference, WriteConcern}
import mongo4cats.bson.Document
import mongo4cats.bson.syntax._
import mongo4cats.client.MongoClient
import mongo4cats.models.database.CreateCollectionOptions
import mongo4cats.embedded.EmbeddedMongo
Expand Down Expand Up @@ -128,6 +129,17 @@ class MongoDatabaseSpec extends AsyncWordSpec with Matchers with EmbeddedMongo {
}
}
}

"runCommand" should {
"run a specific command" in withEmbeddedMongoClient { client =>
val result = for {
db <- client.getDatabase("admin")
_ <- db.runCommand(Document("setParameter" := 1, "cursorTimeoutMillis" := 300000L))
} yield ()

result.map(_ mustBe ())
}
}
}

def withEmbeddedMongoClient[A](test: MongoClient[IO] => IO[A]): Future[A] =
Expand Down

0 comments on commit 6afd76b

Please sign in to comment.