-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CentralDogmaExtension
after test listener not waiting server to stop
#854
Comments
HI! |
package flagma.server.app
import com.linecorp.centraldogma.client.CentralDogma
import com.linecorp.centraldogma.testing.junit.CentralDogmaExtension
import flagma.server.Config
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.core.spec.style.FunSpec
import io.kotest.core.test.TestCaseOrder
import io.kotest.extensions.junit5.JUnitExtensionAdapter
import io.kotest.koin.KoinExtension
import io.kotest.matchers.collections.shouldBeEmpty
import io.kotest.matchers.collections.shouldContain
import io.kotest.matchers.collections.shouldExist
import org.koin.dsl.module
import org.koin.test.KoinTest
class InitializerTest : KoinTest, FunSpec({
val centralDogmaExtension = CentralDogmaExtension()
val koinTestExtension = KoinExtension(
modules = listOf(
module { single<CentralDogma> { centralDogmaExtension.client() } },
Modules.repositoryModules,
)
)
testOrder = TestCaseOrder.Sequential
extensions(
koinTestExtension,
JUnitExtensionAdapter(centralDogmaExtension),
)
test("app should initialize") {
// Dogma should be clean
centralDogmaExtension.client()
.listProjects().join()
.shouldBeEmpty()
Initializer.initializeProject(centralDogmaExtension.client())
centralDogmaExtension.client()
.listProjects().join()
.shouldExist { it == Config.CentralDogma.PROJECT_NAME }
centralDogmaExtension.client()
.listRepositories(Config.CentralDogma.PROJECT_NAME).join()
.keys.shouldContain(Config.CentralDogma.PROJECTS_REPOSITORY_NAME)
}
test("app should initialize if already initialized") {
shouldNotThrowAny {
Initializer.initializeProject(centralDogmaExtension.client())
}
}
})
Maybe timeout for |
This is a local test so I think it is enough. |
Should be the latest:
Not sure where exactly the exception is realized, stack trace is messy. I will do some debug logging. |
Let us know if you find something. 👍 |
centraldogma/testing/junit/src/main/java/com/linecorp/centraldogma/testing/junit/CentralDogmaExtension.java
Lines 108 to 117 in 69572e1
I don't see a
join()
here. I am seeing a flaky test, when I try to useCentralDogmaExtension
in two tests back-to-back, I am seeing a connection error (around 1 in 5 runs).I feel like the
join
is forgotten here and this error can happen rarely.The text was updated successfully, but these errors were encountered: