mirror of
https://github.com/openflocon/Flocon.git
synced 2026-05-14 14:09:20 +00:00
feat: [NETWORK] bad connection (#112)
* feat: [NETWORK] bad connection * feat: [NETWORK] bad connection * feat: [NETWORK] bad connection * added domain and data / desktop * added domain and data / desktop * added tmp screen * quick save * merged with main * merged with main * quick save * works --------- Co-authored-by: Florent Champigny <florent@bere.al>
This commit is contained in:
parent
0fe9d4e60b
commit
7aac7b86dc
40 changed files with 1445 additions and 53 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package io.github.openflocon.flocon.plugins.network
|
||||
|
||||
import io.github.openflocon.flocon.core.FloconPlugin
|
||||
import io.github.openflocon.flocon.plugins.network.model.BadQualityConfig
|
||||
import io.github.openflocon.flocon.plugins.network.model.FloconNetworkCall
|
||||
import io.github.openflocon.flocon.plugins.network.model.FloconNetworkCallRequest
|
||||
import io.github.openflocon.flocon.plugins.network.model.FloconNetworkCallResponse
|
||||
|
|
@ -10,7 +11,8 @@ import io.github.openflocon.flocon.plugins.network.model.MockNetworkResponse
|
|||
|
||||
interface FloconNetworkPlugin : FloconPlugin {
|
||||
val mocks: Collection<MockNetworkResponse>
|
||||
val badQualityConfig: BadQualityConfig?
|
||||
|
||||
fun logRequest(request: FloconNetworkCallRequest)
|
||||
fun logResponse(response: FloconNetworkCallResponse)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package io.github.openflocon.flocon.plugins.network.model
|
||||
|
||||
data class BadQualityConfig(
|
||||
val latency: LatencyConfig,
|
||||
val errorProbability: Double, // chance of triggering an error
|
||||
val errors: List<Error>, // list of errors
|
||||
) {
|
||||
class LatencyConfig(
|
||||
val latencyTriggerProbability: Float,
|
||||
val minLatencyMs: Long,
|
||||
val maxLatencyMs: Long,
|
||||
)
|
||||
class Error(
|
||||
val weight: Float, // increase the probability of being triggered vs all others errors
|
||||
val errorCode: Int,
|
||||
val errorBody: String,
|
||||
val errorContentType: String, // "application/json"
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue