Cleaned up tests

This commit is contained in:
nathan 2020-08-27 13:55:32 +02:00
parent 59d58f27e8
commit 46bee0b977
2 changed files with 10 additions and 7 deletions

View File

@ -30,7 +30,6 @@ import java.io.IOException
import java.util.concurrent.atomic.AtomicLong
class RmiDelayedInvocationSpamTest : BaseTest() {
private val totalRuns = 1000000
private val counter = AtomicLong(0)
private val RMI_ID = 12251
@ -62,12 +61,17 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
fun rmi(config: (Configuration) -> Unit = {}) {
val server: Server<Connection>
val async = false
val mod = if (async) 10_000L else 200L
val totalRuns = if (async) 1_000_000 else 70_000
run {
val configuration = serverConfig()
config(configuration)
register(configuration.serialization)
server = Server<Connection>(configuration)
server = Server(configuration)
addEndPoint(server)
server.saveGlobalObject(TestObjectImpl(counter), RMI_ID)
@ -87,10 +91,9 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
addEndPoint(client)
client.onConnect { connection ->
val remoteObject = connection.getGlobalObject<TestObject>(RMI_ID)
val obj = remoteObject as RemoteObject
obj.async = true
obj.async = async
var started = false
for (i in 0 until totalRuns) {
@ -99,7 +102,7 @@ class RmiDelayedInvocationSpamTest : BaseTest() {
System.err.println("Running for $totalRuns iterations....")
}
if (i % 10000L == 0L) {
if (i % mod == 0L) {
// this doesn't always output to the console. weird.
client.logger.error("$i")
}

View File

@ -82,7 +82,7 @@ class RmiDelayedInvocationTest : BaseTest() {
client.onConnect { connection ->
val remoteObject = connection.getGlobalObject<TestObject>(OBJ_ID)
val totalRuns = 1000
val totalRuns = 100
var abort = false
System.err.println("Running for $totalRuns iterations....")
@ -90,7 +90,7 @@ class RmiDelayedInvocationTest : BaseTest() {
if (abort) {
break
}
if (i % 10000 == 0) {
if (i % 10 == 0) {
System.err.println(i)
}