SLIDER-989 Mock AA test for nodemap not updated
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/e71ffbdb Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/e71ffbdb Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/e71ffbdb Branch: refs/heads/develop Commit: e71ffbdb943c8bb3724d130be71bec7be238ed66 Parents: b2b58d3 Author: Steve Loughran <ste...@apache.org> Authored: Tue Nov 17 20:10:13 2015 +0000 Committer: Steve Loughran <ste...@apache.org> Committed: Tue Nov 17 20:10:13 2015 +0000 ---------------------------------------------------------------------- .../server/appmaster/state/AppStateBindingInfo.java | 2 +- .../model/appstate/TestMockAppStateAAOvercapacity.groovy | 8 -------- .../model/appstate/TestMockAppStateAAPlacement.groovy | 11 +++++++++++ .../appmaster/model/mock/BaseMockAppStateTest.groovy | 3 +-- 4 files changed, 13 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e71ffbdb/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java index a4a9b7e..a8aa1a2 100644 --- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java +++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppStateBindingInfo.java @@ -47,7 +47,7 @@ public class AppStateBindingInfo { public List<Container> liveContainers = new ArrayList<>(0); public Map<String, String> applicationInfo = new HashMap<>(); public ContainerReleaseSelector releaseSelector = new SimpleReleaseSelector(); - /** node reports off the RM. If null, the app state needs to be given a node update later */ + /** node reports off the RM. */ public List<NodeReport> nodeReports = new ArrayList<>(0); public void validate() throws IllegalArgumentException { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e71ffbdb/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAOvercapacity.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAOvercapacity.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAOvercapacity.groovy index 7728748..a8c50d1 100644 --- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAOvercapacity.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAOvercapacity.groovy @@ -21,19 +21,11 @@ package org.apache.slider.server.appmaster.model.appstate import groovy.transform.CompileStatic import groovy.util.logging.Slf4j import org.apache.hadoop.yarn.api.records.Container -import org.apache.hadoop.yarn.api.records.ContainerId -import org.apache.hadoop.yarn.api.records.NodeState -import org.apache.hadoop.yarn.client.api.AMRMClient import org.apache.slider.core.main.LauncherExitCodes -import org.apache.slider.server.appmaster.model.mock.MockNodeReport import org.apache.slider.server.appmaster.model.mock.MockRoles import org.apache.slider.server.appmaster.model.mock.MockYarnEngine import org.apache.slider.server.appmaster.operations.AbstractRMOperation import org.apache.slider.server.appmaster.state.AppState -import org.apache.slider.server.appmaster.state.ContainerAssignment -import org.apache.slider.server.appmaster.state.NodeInstance -import org.apache.slider.server.appmaster.state.NodeMap -import org.apache.slider.server.appmaster.state.RoleInstance import org.junit.Test /** http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e71ffbdb/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy index 3461e23..cdfa9e2 100644 --- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy @@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j import org.apache.hadoop.yarn.api.records.Container import org.apache.hadoop.yarn.api.records.NodeState import org.apache.hadoop.yarn.client.api.AMRMClient +import org.apache.slider.server.appmaster.model.mock.MockAppState import org.apache.slider.server.appmaster.model.mock.MockNodeReport import org.apache.slider.server.appmaster.model.mock.MockRoles import org.apache.slider.server.appmaster.model.mock.MockYarnEngine @@ -271,4 +272,14 @@ class TestMockAppStateAAPlacement extends BaseMockAppStateAATest assert 1 == appState.reviewRequestAndReleaseNodes().size() } + @Test + public void testBindingInfoMustHaveNodeMap() throws Throwable { + def bindingInfo = buildBindingInfo() + bindingInfo.nodeReports = null; + try { + def state = new MockAppState(bindingInfo) + fail("Expected an exception, got $state") + } catch (IllegalArgumentException expected) { + } + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e71ffbdb/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy index a53e0be..69a98eb 100644 --- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy @@ -96,8 +96,7 @@ abstract class BaseMockAppStateTest extends SliderTestBase implements MockRoles historyWorkDir = new File("target/history", historyDirName) historyPath = new Path(historyWorkDir.toURI()) fs.delete(historyPath, true) - appState = new MockAppState() - appState.buildInstance(buildBindingInfo()) + appState = new MockAppState(buildBindingInfo()) stateAccess = new ProviderAppState(testName, appState) }