Skip to content

Commit 5b99915

Browse files
chore: execute mongo test only on linux
1 parent 4a6e62e commit 5b99915

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

src/test/kotlin/infrastructure/database/TestMongo.kt

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package infrastructure.database
1010

11+
import com.sun.jna.Platform
1112
import entity.healthprofessional.HealthProfessionalData
1213
import entity.user.User
1314
import io.kotest.core.extensions.install
@@ -31,40 +32,54 @@ class TestMongo : StringSpec({
3132
)
3233
val mongoClient = MongoClient("mongodb://localhost:27017")
3334

34-
install(TestContainerExtension("mongo:latest")) {
35-
withExposedPorts(27017)
36-
}.start()
35+
if (Platform.getOSType() == Platform.LINUX) {
36+
install(TestContainerExtension("mongo:latest")) {
37+
withExposedPorts(27017)
38+
}.start()
39+
}
3740

3841
beforeAny {
3942
mongoClient.getDatabase("user_management").drop()
4043
}
4144

42-
"test the creation of a user in the database" {
45+
"test the creation of a user in the database".config(
46+
enabled = Platform.getOSType() == Platform.LINUX
47+
) {
4348
mongoClient.createUser(mockUser) shouldNotBe null
4449
}
4550

46-
"test the creation of a health professional in the database" {
51+
"test the creation of a health professional in the database".config(
52+
enabled = Platform.getOSType() == Platform.LINUX
53+
) {
4754
mongoClient.createHealthProfessional(mockHealthProfessional) shouldNotBe null
4855
}
4956

50-
"test the retrieve of a user in the database" {
57+
"test the retrieve of a user in the database".config(
58+
enabled = Platform.getOSType() == Platform.LINUX
59+
) {
5160
mongoClient.createUser(mockUser)
5261
mongoClient.getUser(mockUser.userId) shouldNotBe null
5362
}
5463

55-
"test the retrieve of a health professional in the database" {
64+
"test the retrieve of a health professional in the database".config(
65+
enabled = Platform.getOSType() == Platform.LINUX
66+
) {
5667
mongoClient.createHealthProfessional(mockHealthProfessional)
5768
mongoClient.getHealthProfessional(mockHealthProfessional.healthProfessionalId) shouldNotBe null
5869
}
5970

60-
"test the delete of a user in the database" {
71+
"test the delete of a user in the database".config(
72+
enabled = Platform.getOSType() == Platform.LINUX
73+
) {
6174
mongoClient.createUser(mockUser)
6275
mongoClient.getUser(mockUser.userId) shouldNotBe null
6376
mongoClient.deleteUser(mockUser.userId)
6477
mongoClient.getUser(mockUser.userId) shouldBe null
6578
}
6679

67-
"test the delete of a health professional in the database" {
80+
"test the delete of a health professional in the database".config(
81+
enabled = Platform.getOSType() == Platform.LINUX
82+
) {
6883
mongoClient.createHealthProfessional(mockHealthProfessional)
6984
mongoClient.getHealthProfessional(mockHealthProfessional.healthProfessionalId) shouldNotBe null
7085
mongoClient.deleteHealthProfessional(mockHealthProfessional.healthProfessionalId)

0 commit comments

Comments
 (0)