Skip to content
Snippets Groups Projects
Commit d528d2b7 authored by Sören Henning's avatar Sören Henning
Browse files

Minor code style fixes

parent 4f79a385
No related branches found
No related tags found
No related merge requests found
Pipeline #10027 passed
...@@ -11,7 +11,7 @@ internal class ResultsTest { ...@@ -11,7 +11,7 @@ internal class ResultsTest {
@Test @Test
fun testMinRequiredInstancesWhenSuccessfulDemand() { fun testMinRequiredInstancesWhenSuccessfulDemand() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(10000, 2), true) results.setResult(Pair(10000, 2), true)
results.setResult(Pair(20000, 1), false) results.setResult(Pair(20000, 1), false)
...@@ -25,7 +25,7 @@ internal class ResultsTest { ...@@ -25,7 +25,7 @@ internal class ResultsTest {
@Test @Test
fun testGetMaxBenchmarkedLoadWhenAllSuccessfulDemand() { fun testGetMaxBenchmarkedLoadWhenAllSuccessfulDemand() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(10000, 2), true) results.setResult(Pair(10000, 2), true)
...@@ -37,7 +37,7 @@ internal class ResultsTest { ...@@ -37,7 +37,7 @@ internal class ResultsTest {
@Test @Test
fun testGetMaxBenchmarkedLoadWhenLargestNotSuccessfulDemand() { fun testGetMaxBenchmarkedLoadWhenLargestNotSuccessfulDemand() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(10000, 2), true) results.setResult(Pair(10000, 2), true)
results.setResult(Pair(20000, 1), false) results.setResult(Pair(20000, 1), false)
...@@ -50,7 +50,7 @@ internal class ResultsTest { ...@@ -50,7 +50,7 @@ internal class ResultsTest {
@Test @Test
fun testMaxRequiredInstancesWhenSuccessfulCapacity() { fun testMaxRequiredInstancesWhenSuccessfulCapacity() {
val results = Results(Metric.from("capacity")) val results = Results(Metric.CAPACITY)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(20000, 1), false) results.setResult(Pair(20000, 1), false)
results.setResult(Pair(10000, 2), true) results.setResult(Pair(10000, 2), true)
...@@ -64,7 +64,7 @@ internal class ResultsTest { ...@@ -64,7 +64,7 @@ internal class ResultsTest {
@Test @Test
fun testGetMaxBenchmarkedLoadWhenAllSuccessfulCapacity() { fun testGetMaxBenchmarkedLoadWhenAllSuccessfulCapacity() {
val results = Results(Metric.from("capacity")) val results = Results(Metric.CAPACITY)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(10000, 2), true) results.setResult(Pair(10000, 2), true)
...@@ -76,7 +76,7 @@ internal class ResultsTest { ...@@ -76,7 +76,7 @@ internal class ResultsTest {
@Test @Test
fun testGetMaxBenchmarkedLoadWhenLargestNotSuccessfulCapacity() { fun testGetMaxBenchmarkedLoadWhenLargestNotSuccessfulCapacity() {
val results = Results(Metric.from("capacity")) val results = Results(Metric.CAPACITY)
results.setResult(Pair(10000, 1), true) results.setResult(Pair(10000, 1), true)
results.setResult(Pair(20000, 1), true) results.setResult(Pair(20000, 1), true)
results.setResult(Pair(10000, 2), false) results.setResult(Pair(10000, 2), false)
......
...@@ -12,7 +12,7 @@ internal class LowerBoundRestrictionTest { ...@@ -12,7 +12,7 @@ internal class LowerBoundRestrictionTest {
@Test @Test
fun testNoPreviousResults() { fun testNoPreviousResults() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val strategy = LowerBoundRestriction(results) val strategy = LowerBoundRestriction(results)
val load = 10000 val load = 10000
val resources = listOf(1, 2, 3) val resources = listOf(1, 2, 3)
...@@ -24,7 +24,7 @@ internal class LowerBoundRestrictionTest { ...@@ -24,7 +24,7 @@ internal class LowerBoundRestrictionTest {
@Test @Test
fun testWithSuccessfulPreviousResults() { fun testWithSuccessfulPreviousResults() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(10000, 1, true) results.setResult(10000, 1, true)
results.setResult(20000, 1, false) results.setResult(20000, 1, false)
results.setResult(20000, 2, true) results.setResult(20000, 2, true)
...@@ -41,7 +41,7 @@ internal class LowerBoundRestrictionTest { ...@@ -41,7 +41,7 @@ internal class LowerBoundRestrictionTest {
@Disabled @Disabled
fun testWithNoSuccessfulPreviousResults() { fun testWithNoSuccessfulPreviousResults() {
// This test is currently not implemented this way, but might later be the desired behavior. // This test is currently not implemented this way, but might later be the desired behavior.
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(10000, 1, true) results.setResult(10000, 1, true)
results.setResult(20000, 1, false) results.setResult(20000, 1, false)
results.setResult(20000, 2, false) results.setResult(20000, 2, false)
...@@ -58,7 +58,7 @@ internal class LowerBoundRestrictionTest { ...@@ -58,7 +58,7 @@ internal class LowerBoundRestrictionTest {
@Test @Test
fun testNoPreviousResults2() { fun testNoPreviousResults2() {
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(10000, 1, true) results.setResult(10000, 1, true)
results.setResult(20000, 2, true) results.setResult(20000, 2, true)
results.setResult(10000, 1, false) results.setResult(10000, 1, false)
...@@ -74,7 +74,7 @@ internal class LowerBoundRestrictionTest { ...@@ -74,7 +74,7 @@ internal class LowerBoundRestrictionTest {
@Disabled @Disabled
fun testMinRequiredInstancesWhenNotSuccessful() { fun testMinRequiredInstancesWhenNotSuccessful() {
// This test is currently not implemented this way, but might later be the desired behavior. // This test is currently not implemented this way, but might later be the desired behavior.
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
results.setResult(10000, 1, true) results.setResult(10000, 1, true)
results.setResult(20000, 2, true) results.setResult(20000, 2, true)
results.setResult(10000, 1, false) results.setResult(10000, 1, false)
......
...@@ -29,7 +29,7 @@ class InitialGuessSearchStrategyTest { ...@@ -29,7 +29,7 @@ class InitialGuessSearchStrategyTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val guessStrategy = PrevInstanceOptGuess() val guessStrategy = PrevInstanceOptGuess()
val sloChecker = Slo() val sloChecker = Slo()
...@@ -67,7 +67,7 @@ class InitialGuessSearchStrategyTest { ...@@ -67,7 +67,7 @@ class InitialGuessSearchStrategyTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val guessStrategy = PrevInstanceOptGuess() val guessStrategy = PrevInstanceOptGuess()
val sloChecker = Slo() val sloChecker = Slo()
...@@ -105,15 +105,15 @@ class InitialGuessSearchStrategyTest { ...@@ -105,15 +105,15 @@ class InitialGuessSearchStrategyTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val guessStrategy = PrevInstanceOptGuess() val guessStrategy = PrevInstanceOptGuess()
val sloChecker = Slo() val sloChecker = Slo()
val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5)
val strategy = InitialGuessSearchStrategy(benchmarkExecutor, guessStrategy, results) val strategy = InitialGuessSearchStrategy(benchmarkExecutor, guessStrategy, results)
val actual: ArrayList<Int?> = ArrayList() val actual: MutableList<Int?> = mutableListOf()
var expected: ArrayList<Int?> = ArrayList(listOf(2, 3, 0, 4, 6)) var expected: MutableList<Int?> = ArrayList(listOf(2, 3, 0, 4, 6))
expected.add(null) expected.add(null)
expected = ArrayList(listOf(null) + expected) expected = ArrayList(listOf(null) + expected)
......
...@@ -27,7 +27,7 @@ class RestrictionSearchTest { ...@@ -27,7 +27,7 @@ class RestrictionSearchTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val sloChecker = Slo() val sloChecker = Slo()
val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5)
...@@ -60,7 +60,7 @@ class RestrictionSearchTest { ...@@ -60,7 +60,7 @@ class RestrictionSearchTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val sloChecker = Slo() val sloChecker = Slo()
val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5)
...@@ -93,7 +93,7 @@ class RestrictionSearchTest { ...@@ -93,7 +93,7 @@ class RestrictionSearchTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val sloChecker = Slo() val sloChecker = Slo()
val benchmarkExecutorImpl = val benchmarkExecutorImpl =
...@@ -126,7 +126,7 @@ class RestrictionSearchTest { ...@@ -126,7 +126,7 @@ class RestrictionSearchTest {
) )
val mockLoads: List<Int> = (0..6).toList() val mockLoads: List<Int> = (0..6).toList()
val mockResources: List<Int> = (0..7).toList() val mockResources: List<Int> = (0..7).toList()
val results = Results(Metric.from("demand")) val results = Results(Metric.DEMAND)
val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder()
val sloChecker = Slo() val sloChecker = Slo()
val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 0) val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment