-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23739 from vespa-engine/revert-23703-hmusum/clean…
…up-15 Revert "Cluster controller unit test cleanup, part 4 [run-systemtest]"
- Loading branch information
Showing
16 changed files
with
220 additions
and
109 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
.../java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.clustercontroller.apps.clustercontroller; | ||
|
||
import com.yahoo.jdisc.Metric; | ||
import com.yahoo.vdslib.distribution.ConfiguredNode; | ||
import com.yahoo.vespa.clustercontroller.core.FleetController; | ||
import com.yahoo.vespa.clustercontroller.core.FleetControllerOptions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* Doesn't really test cluster controller, but runs some lines of code. | ||
* System tests verifies that container can load it.. | ||
*/ | ||
public class ClusterControllerTest { | ||
|
||
private FleetControllerOptions options = new FleetControllerOptions("storage", Set.of(new ConfiguredNode(0, false))); | ||
|
||
private final Metric metric = new Metric() { | ||
@Override | ||
public void set(String s, Number number, Context context) {} | ||
@Override | ||
public void add(String s, Number number, Context context) {} | ||
@Override | ||
public Context createContext(Map<String, ?> stringMap) { return null; } | ||
}; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
options = new FleetControllerOptions("storage", Set.of(new ConfiguredNode(0, false))); | ||
options.zooKeeperServerAddress = null; | ||
options.slobrokConfigId = "raw:"; | ||
options.slobrokConnectionSpecs = null; | ||
} | ||
|
||
@Test | ||
void testSimple() throws Exception { | ||
ClusterController cc = new ClusterController(); | ||
cc.setOptions(options, metric); | ||
cc.setOptions(options, metric); | ||
assertEquals(1, cc.getFleetControllers().size()); | ||
assertNotNull(cc.get("storage")); | ||
assertNull(cc.get("music")); | ||
cc.countdown(); | ||
assertTrue(cc.getController("storage").isRunning()); | ||
cc.countdown(); | ||
assertFalse(cc.getController("storage").isRunning()); | ||
} | ||
|
||
@Test | ||
void testShutdownException() throws Exception { | ||
ClusterController cc = new ClusterController() { | ||
void shutdownController(FleetController controller) throws Exception { | ||
throw new Exception("Foo"); | ||
} | ||
}; | ||
cc.setOptions(options, metric); | ||
cc.countdown(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.