SLIDER-533. AgentCmd test app package should publish config and verify it + some other fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c9b47f11 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c9b47f11 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c9b47f11 Branch: refs/heads/develop Commit: c9b47f11c6407da9936f3fa73fac29e8223388e5 Parents: 4154186 Author: Sumit Mohanty <[email protected]> Authored: Fri Oct 17 18:38:33 2014 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Fri Oct 17 18:38:33 2014 -0700 ---------------------------------------------------------------------- .../command-logger/slider-pkg/appConfig.json | 3 +- .../command-logger/slider-pkg/metainfo.xml | 2 ++ .../test_command_log/appConfig.json | 3 +- .../funtest/framework/CommandTestBase.groovy | 2 +- .../funtest/lifecycle/AppsThroughAgentIT.groovy | 38 ++++++++++++++++++-- 5 files changed, 43 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c9b47f11/app-packages/command-logger/slider-pkg/appConfig.json ---------------------------------------------------------------------- diff --git a/app-packages/command-logger/slider-pkg/appConfig.json b/app-packages/command-logger/slider-pkg/appConfig.json index c8bb237..9c19670 100644 --- a/app-packages/command-logger/slider-pkg/appConfig.json +++ b/app-packages/command-logger/slider-pkg/appConfig.json @@ -12,7 +12,8 @@ "site.global.app_root": "${AGENT_WORK_ROOT}/app/install/command-logger", "site.global.app_install_dir": "${AGENT_WORK_ROOT}/app/install", "site.cl-site.logfile.location": "${AGENT_WORK_ROOT}/app/install/command-logger-app/operations.log", - "site.cl-site.datetime.format": "%A, %d. %B %Y %I:%M%p" + "site.cl-site.datetime.format": "%A, %d. %B %Y %I:%M%p", + "site.cl-site.pattern.for.test.to.verify": "verify this pattern" }, "components": { "COMMAND_LOGGER": { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c9b47f11/app-packages/command-logger/slider-pkg/metainfo.xml ---------------------------------------------------------------------- diff --git a/app-packages/command-logger/slider-pkg/metainfo.xml b/app-packages/command-logger/slider-pkg/metainfo.xml index b8de9a3..5de2c37 100644 --- a/app-packages/command-logger/slider-pkg/metainfo.xml +++ b/app-packages/command-logger/slider-pkg/metainfo.xml @@ -24,10 +24,12 @@ log file. When stopped it renames the file. </comment> <version>0.1.0</version> + <exportedConfigs>cl-site</exportedConfigs> <components> <component> <name>COMMAND_LOGGER</name> <category>MASTER</category> + <publishConfig>true</publishConfig> <commandScript> <script>scripts/cl.py</script> <scriptType>PYTHON</scriptType> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c9b47f11/slider-core/src/test/app_packages/test_command_log/appConfig.json ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_command_log/appConfig.json b/slider-core/src/test/app_packages/test_command_log/appConfig.json index 8e81421..a3a9ccf 100644 --- a/slider-core/src/test/app_packages/test_command_log/appConfig.json +++ b/slider-core/src/test/app_packages/test_command_log/appConfig.json @@ -11,7 +11,8 @@ "site.global.app_pid_dir": "${AGENT_WORK_ROOT}/app/run", "site.global.app_root": "${AGENT_WORK_ROOT}/app/install/command-logger", "site.cl-site.logfile.location": "${AGENT_WORK_ROOT}/app/install/command-logger-app/operations.log", - "site.cl-site.datetime.format": "%A, %d. %B %Y %I:%M%p" + "site.cl-site.datetime.format": "%A, %d. %B %Y %I:%M%p", + "site.cl-site.pattern.for.test.to.verify": "verify this pattern" }, "components": { "COMMAND_LOGGER": { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c9b47f11/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy index dc74d16..744ec66 100644 --- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy +++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy @@ -598,9 +598,9 @@ abstract class CommandTestBase extends SliderTestUtils { protected void ensureApplicationIsUp(String clusterName) { repeatUntilTrue(this.&isApplicationUp, + 20, SLIDER_CONFIG.getInt(KEY_TEST_INSTANCE_LAUNCH_TIME, DEFAULT_INSTANCE_LAUNCH_TIME_SECONDS), - 1000, ['arg1': clusterName], true, 'Application did not start, aborting test.') http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c9b47f11/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy index 0796355..ff55b05 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy @@ -97,7 +97,8 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions { APPLICATION_NAME, ARG_GETEXP, "container_log_dirs"]) - if(!containsString(shell, "\"tag\":\"COMMAND_LOGGER\",\"level\":\"component\"", 2)) { + if(!containsString(shell, "\"tag\" : \"COMMAND_LOGGER\"", 2) + || !containsString(shell, "\"level\" : \"component\"", 2)) { logShell(shell) assert fail("Should list 2 entries for log folders") } @@ -110,11 +111,44 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions { APPLICATION_NAME, ARG_GETEXP, "container_work_dirs"]) - if(!containsString(shell, "\"tag\":\"COMMAND_LOGGER\",\"level\":\"component\"", 2)) { + if(!containsString(shell, "\"tag\" : \"COMMAND_LOGGER\"", 2) + || !containsString(shell, "\"level\" : \"component\"", 2)) { logShell(shell) assert fail("Should list 2 entries for work folder") } + // get cl-site config + shell = slider( + [ + ACTION_REGISTRY, + ARG_NAME, + APPLICATION_NAME, + ARG_GETCONF, + "cl-site", + ARG_FORMAT, + "json"]) + + for (int i = 0; i < 10; i++) { + if (shell.getRet() != EXIT_SUCCESS) { + println "Waiting for the cl-site to show up" + sleep(1000 * 10) + shell = slider( + [ + ACTION_REGISTRY, + ARG_NAME, + APPLICATION_NAME, + ARG_GETCONF, + "cl-site", + ARG_FORMAT, + "json"]) + } + } + assert shell.getRet() == EXIT_SUCCESS, "cl-site should be retrieved" + if (!containsString(shell, "\"pattern.for.test.to.verify\" : \"verify this pattern\"", 1)) { + logShell(shell) + assert fail("Should have exported cl-site") + } + assert isApplicationInState("RUNNING", APPLICATION_NAME), 'App is not running.' } }
