zentol commented on a change in pull request #8386: [FLINK-12181][Tests] Port
ExecutionGraphRestartTest to new codebase
URL: https://github.com/apache/flink/pull/8386#discussion_r285048584
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphRestartTest.java
##########
@@ -733,79 +658,114 @@ public void testFailureWhileRestarting() throws
Exception {
// Utilities
//
------------------------------------------------------------------------
- private Scheduler createSchedulerWithInstances(int num,
TaskManagerGateway taskManagerGateway) {
- final Scheduler scheduler = new Scheduler(executor);
- final Instance[] instances = new Instance[num];
+ private static class TestingExecutionGraphBuilder {
+ private RestartStrategy restartStrategy = new
NoRestartStrategy();
+ private JobGraph jobGraph = createJobGraph();
+ private int tasksNum = NUM_TASKS;
+ private TaskManagerLocation taskManagerLocation = new
LocalTaskManagerLocation();
- for (int i = 0; i < instances.length; i++) {
- instances[i] = createInstance(taskManagerGateway, 55443
+ i);
- scheduler.newInstanceAvailable(instances[i]);
+ public TestingExecutionGraphBuilder
setRestartStrategy(RestartStrategy restartStrategy) {
+ this.restartStrategy = restartStrategy;
+ return this;
}
- return scheduler;
- }
+ public TestingExecutionGraphBuilder setJobGraph(JobGraph
jobGraph) {
+ this.jobGraph = jobGraph;
+ return this;
+ }
- private static Instance createInstance(TaskManagerGateway
taskManagerGateway, int port) {
- final HardwareDescription resources = new
HardwareDescription(4, 1_000_000_000, 500_000_000, 400_000_000);
- final TaskManagerLocation location = new TaskManagerLocation(
- ResourceID.generate(),
InetAddress.getLoopbackAddress(), port);
- return new Instance(taskManagerGateway, location, new
InstanceID(), resources, 1);
- }
+ TestingExecutionGraphBuilder setTasksNum2() {
Review comment:
I'd prefer `setNumberOfTasks(int numTasks)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services