Skip to content
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

fix: Fix dry run #2110

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions test_runner/src/main/kotlin/ftl/mock/MockServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.net.BindException
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Files
import java.nio.file.Paths
import java.util.concurrent.atomic.AtomicInteger
import java.util.zip.GZIPInputStream

Expand All @@ -83,9 +81,9 @@ object MockServer {
private var isStarted: Boolean = false

private inline fun <reified T> loadCatalog(fileName: String): T {
val jsonPath = Paths.get("./src/test/kotlin/ftl/fixtures/$fileName")
if (!Files.exists(jsonPath)) throw FlankGeneralError("Path doesn't exist: $fileName")
return JSON_FACTORY.fromReader(Files.newBufferedReader(jsonPath), T::class.java)
val jsonPath = {}.javaClass.classLoader.getResourceAsStream(fileName)
?: throw FlankGeneralError("File doesn't exist: $fileName")
return JSON_FACTORY.fromReader(jsonPath.bufferedReader(), T::class.java)
}

private val androidCatalog by lazy { loadCatalog<AndroidDeviceCatalog>("android_catalog.json") }
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/task/UpdateCatalogFixtures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.nio.file.Files
import java.nio.file.Paths

object UpdateCatalogFixtures {
private const val root = "./test_runner/src/test/kotlin/ftl/fixtures/"
private const val root = "./test_runner/src/main/resources/"

private fun write(fileName: String, content: GenericJson) {
Files.write(Paths.get(root, fileName), content.toPrettyString().toByteArray())
Expand Down