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

feat(monkeys): Add new configuration attributes for the next milestone [WPB-3353] #1911

Merged
merged 3 commits into from
Jul 24, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,93 @@
*/
package com.wire.kalium.monkeys.importer

import com.wire.kalium.logic.data.conversation.ConversationOptions
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TestDataJsonModel(
@SerialName("backends")
val backends: List<BackendDataJsonModel>
@SerialName("testCases") val testCases: List<TestCase>,
@SerialName("backends") val backends: List<BackendDataJsonModel>
)

@Serializable
data class TestCase(
@SerialName("name") val name: String,
@SerialName("conversationDistribution") val conversationDistribution: Map<String, GroupConfig>,
@SerialName("setup") val setup: List<Action> = listOf(),
@SerialName("actions") val actions: List<Action>
)

@Serializable
sealed class UserCount {
@Serializable
@SerialName("PERCENTAGE")
data class Percentage(@SerialName("value") val value: UInt) : UserCount()

@Serializable
@SerialName("FIXED_COUNT")
data class FixedCount(@SerialName("value") val value: UInt) : UserCount()
}
Comment on lines +38 to +47
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a heads up, this will require an implicit type field in order for Kotlinx-serialization to select which one is being deserialized.

"userCount": {
    "type": "PERCENTAGE",
    "value": 48
}
"userCount": {
    "type": "FIXED_COUNT",
    "value": 1000
}

I like it :)


@Serializable
data class GroupConfig(
@SerialName("userCount") val userCount: UserCount,
@SerialName("protocol") val protocol: ConversationOptions.Protocol = ConversationOptions.Protocol.MLS,
@SerialName("groupCount") val groupCount: UInt = 1u
)

@Serializable
data class Action(
@SerialName("description") val description: String,
@SerialName("type") val type: ActionType,
@SerialName("count") val count: UserCount,
@SerialName("repeatDuration") val repeatDuration: UInt
)

@Serializable
sealed class ActionType {
@Serializable
data class Login(@SerialName("duration") val duration: UInt = 0u) : ActionType()

@Serializable
data class Reconnect(@SerialName("durationOffline") val durationOffline: UInt) : ActionType()

@Serializable
data class SendMessage(
@SerialName("count") val count: UInt,
@SerialName("targets") val targets: List<String> = listOf()
) : ActionType()

@Serializable
data class CreateConversation(@SerialName("userCount") val userCount: UserCount) : ActionType()

@Serializable
data class LeaveConversation(@SerialName("userCount") val userCount: UserCount) : ActionType()

@Serializable
data class DestroyConversation(@SerialName("count") val count: UInt) : ActionType()

@Serializable
data class SendRequest(@SerialName("userCount") val userCount: UInt) : ActionType()
}

@Serializable
data class BackendDataJsonModel(
@SerialName("api")
val api: String,
@SerialName("accounts")
val accounts: String,
@SerialName("webSocket")
val webSocket: String,
@SerialName("blackList")
val blackList: String,
@SerialName("teams")
val teams: String,
@SerialName("website")
val website: String,
@SerialName("title")
val title: String,
@SerialName("passwordForUsers")
val passwordForUsers: String,
@SerialName("domain")
val domain: String,
@SerialName("users")
val users: List<UserAccountDataJsonModel>
@SerialName("api") val api: String,
@SerialName("accounts") val accounts: String,
@SerialName("webSocket") val webSocket: String,
@SerialName("blackList") val blackList: String,
@SerialName("teams") val teams: String,
@SerialName("website") val website: String,
@SerialName("title") val title: String,
@SerialName("passwordForUsers") val passwordForUsers: String,
@SerialName("domain") val domain: String,
@SerialName("users") val users: List<UserAccountDataJsonModel>
)

@Serializable
data class UserAccountDataJsonModel(
@SerialName("email")
val email: String,
@SerialName("id")
val unqualifiedId: String
@SerialName("email") val email: String,
@SerialName("id") val unqualifiedId: String
)
Loading