Skip to content

Commit

Permalink
refactor(alchemist-grid): simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-olaiya committed Sep 13, 2023
1 parent 359530e commit 5ef2e7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import it.unibo.alchemist.boundary.grid.cluster.ClusterImpl
import it.unibo.alchemist.test.utils.DistributionTestUtils
import it.unibo.alchemist.test.utils.DistributionTestUtils.startServers
import it.unibo.alchemist.test.utils.DistributionTestUtils.use
import it.unibo.alchemist.test.utils.TestConstants.BATCH_SIZE
import it.unibo.alchemist.test.utils.TestConstants.SERVERS_TO_LAUNCH
import it.unibo.alchemist.test.utils.TestConstants.SIMULATION_BATCH_SIZE
import it.unibo.alchemist.test.utils.TestConstants.clientConfigFile
import it.unibo.alchemist.test.utils.TestConstants.composeFilePath
import it.unibo.alchemist.test.utils.TestConstants.registry
Expand All @@ -39,7 +39,7 @@ class DistributionTest : StringSpec({
registry.simulations().size == 1
}
val simulationID = registry.simulations().first()
registry.simulationJobs(simulationID) shouldHaveSize BATCH_SIZE
registry.simulationJobs(simulationID) shouldHaveSize SIMULATION_BATCH_SIZE
}
}
}
Expand All @@ -57,7 +57,7 @@ class DistributionTest : StringSpec({
servers.first().close()
eventually(15.seconds) {
registry.simulationAssignments(simulationID).keys shouldHaveSize SERVERS_TO_LAUNCH - 1
registry.assignedJobs(registry.nodes.first().serverID) shouldHaveSize BATCH_SIZE
registry.assignedJobs(registry.nodes.first().serverID) shouldHaveSize SIMULATION_BATCH_SIZE
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ import java.nio.file.Path

object TestConstants {
const val SERVERS_TO_LAUNCH = 2
private val ETCD_SERVER_ENDPOINTS =
listOf("http://localhost:10001", "http://localhost:10003", "http://localhost:10003")
private val etcdKVStore = EtcdKVStore(ETCD_SERVER_ENDPOINTS)
val registry = ObservableClusterRegistry(etcdKVStore)
val registry = ObservableClusterRegistry(
EtcdKVStore(listOf("http://localhost:10001", "http://localhost:10003", "http://localhost:10003")),
)
val serverConfigFile = Path.of("src", "test", "resources", "server-config.yml").toString()
val clientConfigFile = Path.of("src", "test", "resources", "client-config.yml").toString()
const val SIMULATION_BATCH_SIZE = 4
val distributionConfigurationFile =
Path.of("src", "test", "resources", "distribution-config.yml").toString()
val composeFilePath = Path.of("src", "test", "resources", "docker-compose.yml").toString()
const val BATCH_SIZE = 4
}

0 comments on commit 5ef2e7b

Please sign in to comment.