File tree Expand file tree Collapse file tree 6 files changed +29
-18
lines changed Expand file tree Collapse file tree 6 files changed +29
-18
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ defaults:
1212jobs :
1313 build :
1414 name : Run Kotlin Example Tests
15- runs-on : macos-latest
15+ runs-on : ubuntu-latest
16+ strategy :
17+ matrix :
18+ mongodb-version : ['6.0']
1619
1720 steps :
1821 - uses : actions/checkout@v3
2124 with :
2225 distribution : ' zulu'
2326 java-version : 11
24- - name : Run Kotlin tests
27+
28+ - name : Start MongoDB
29+ uses :
supercharge/[email protected] 30+ with :
31+ mongodb-version : ${{ matrix.mongodb-version }}
32+ mongodb-replica-set : test-rs
33+
34+ - name : Validate Gradle Wrapper
35+ uses : gradle/wrapper-validation-action@v1
36+
37+ - name : Run Tests
2538 run : ./gradlew test --stacktrace --info
2639 env :
2740 CI : true
28- CONNECTION_URI : ${{ secrets.CONNECTION_URI }}
41+ CONNECTION_URI : " mongodb://localhost:27017 "
Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ internal class BuildersTest {
5656 client.close()
5757 }
5858 }
59-
6059 }
6160
6261 @Test
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ internal class ChangeTest {
5353 }
5454 }
5555 }
56+
5657 @Test
5758 fun updateOneTest () = runBlocking {
5859 // :snippet-start: update-one
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ internal class ConnectionTest {
6363 }
6464 // :snippet-end:
6565 higherScopedClient = mongoClient
66- assertEquals(1 , higherScopedCommandResult[" ok" ])
66+ assertEquals(1.0 , higherScopedCommandResult[" ok" ].toString().toDouble() )
6767 }
6868
6969 @Test
Original file line number Diff line number Diff line change @@ -11,18 +11,18 @@ import org.junit.jupiter.api.BeforeAll
1111import org.junit.jupiter.api.TestInstance
1212import kotlin.test.*
1313
14- // :snippet-start: data-model
15- data class Book (
16- @BsonId val id : Int ,
17- val title : String ,
18- val author : String ,
19- val length : Int
20- )
21- // :snippet-end:
22-
2314@TestInstance(TestInstance .Lifecycle .PER_CLASS )
2415internal class LimitTest {
2516
17+ // :snippet-start: data-model
18+ data class Book (
19+ @BsonId val id : Int ,
20+ val title : String ,
21+ val author : String ,
22+ val length : Int
23+ )
24+ // :snippet-end:
25+
2626 companion object {
2727 val config = getConfig()
2828 val client = MongoClient .create(config.connectionUri)
Original file line number Diff line number Diff line change 1-
2-
3- // :snippet-start: slf4j-import
4- // :snippet-end:
51import InsertTest.Companion.client
62import com.mongodb.kotlin.client.coroutine.MongoClient
73import config.getConfig
@@ -11,7 +7,9 @@ import org.bson.Document
117import org.junit.jupiter.api.AfterAll
128import org.junit.jupiter.api.Assertions.*
139import org.junit.jupiter.api.TestInstance
10+ // :snippet-start: slf4j-import
1411import org.slf4j.LoggerFactory
12+ // :snippet-end:
1513import java.util.*
1614import kotlin.test.*
1715
You can’t perform that action at this time.
0 commit comments