Skip to content

Commit

Permalink
fix: revert some changes due to GH Windows agents #405
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jan 18, 2023
1 parent af634ce commit edb04a4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ class KTorMockServer @JvmOverloads constructor(
override fun getUrl(): String {
val address = socketAddress()
return if (address != null) {
"${config.scheme}://${address.hostname}:${address.port}"
// Stupid GitHub Windows agents
val host = if (address.hostname.lowercase() == "miningmadness.com") {
config.hostname
} else {
address.hostname
}
"${config.scheme}://$host:${address.port}"
} else {
val connectorConfig = server.environment.connectors.first()
"${config.scheme}://${connectorConfig.host}:${connectorConfig.port}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.sun.net.httpserver.HttpExchange
import com.sun.net.httpserver.HttpHandler
import com.sun.net.httpserver.HttpServer
import com.sun.net.httpserver.HttpsServer
import io.ktor.util.network.hostname
import io.pact.plugins.jvm.core.CatalogueEntry
import io.pact.plugins.jvm.core.CatalogueEntryProviderType
import io.pact.plugins.jvm.core.CatalogueEntryType
Expand Down Expand Up @@ -334,7 +335,15 @@ abstract class BaseJdkMockServer(
initServer()
}

override fun getUrl() = "${config.scheme}://${server.address.hostName}:${server.address.port}"
override fun getUrl(): String {
// Stupid GitHub Windows agents
val host = if (server.address.hostName.lowercase() == "miningmadness.com") {
config.hostname
} else {
server.address.hostName
}
return "${config.scheme}://$host:${server.address.port}"
}

override fun getPort(): Int = server.address.port

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ open class MockProviderConfig @JvmOverloads constructor (
open val transportRegistryEntry: String = ""
) {

fun url() = "$scheme://$hostname:$port"
fun url(): String {
val address = address()
// Stupid GitHub Windows agents
val host = if (address.hostname.lowercase() == "miningmadness.com") {
hostname
} else {
address.hostname
}
return "$scheme://$host:${address.port}"
}

fun address() = InetSocketAddress(hostname, port)

Expand Down

0 comments on commit edb04a4

Please sign in to comment.