Fixed integration tests depending on the remote repo

This commit is contained in:
Abdelilah El Aissaoui 2022-05-31 16:20:56 +02:00
parent 969233ec99
commit a6c496d866

View File

@ -3,6 +3,9 @@ package app.git
import app.credentials.GProcess import app.credentials.GProcess
import app.credentials.GRemoteSession import app.credentials.GRemoteSession
import app.credentials.GSessionManager import app.credentials.GSessionManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.extension.AfterAllCallback import org.junit.jupiter.api.extension.AfterAllCallback
import org.junit.jupiter.api.extension.BeforeAllCallback import org.junit.jupiter.api.extension.BeforeAllCallback
@ -24,18 +27,20 @@ class BeforeRepoAllTestsExtension : BeforeAllCallback, AfterAllCallback {
repoDir = File(tempDir, "repo") repoDir = File(tempDir, "repo")
started = true started = true
// Your "before all tests" startup logic goes here
// The following line registers a callback hook when the root test context is shut down // The following line registers a callback hook when the root test context is shut down
context.root.getStore(GLOBAL).put("any unique name", this) context.root.getStore(GLOBAL).put("gitnuro_tests", this)
val remoteOperationsManager = RemoteOperationsManager(GSessionManager { GRemoteSession { GProcess() } }) val remoteOperationsManager = RemoteOperationsManager(GSessionManager { GRemoteSession { GProcess() } })
remoteOperationsManager.clone(repoDir, REPO_URL) remoteOperationsManager.clone(repoDir, REPO_URL)
.flowOn(Dispatchers.IO)
.collect { newCloneStatus ->
println("Clonning test repository: $newCloneStatus")
}
} }
} }
override fun afterAll(context: ExtensionContext?) { override fun afterAll(context: ExtensionContext?) {
// Your "after all tests" logic goes here
tempDir.deleteRecursively() tempDir.deleteRecursively()
} }
} }