Repository: incubator-slider Updated Branches: refs/heads/develop 5a3a64392 -> b97a86113
SLIDER-773 Add co-processor support for app packages - unit and fun tests (Thomas Liu via gourksaha) Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/b97a8611 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/b97a8611 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/b97a8611 Branch: refs/heads/develop Commit: b97a861135eaa8577ec27a4201e0c8598c0ff9bd Parents: 5a3a643 Author: Gour Saha <[email protected]> Authored: Mon May 4 22:05:23 2015 -0700 Committer: Gour Saha <[email protected]> Committed: Mon May 4 22:05:23 2015 -0700 ---------------------------------------------------------------------- .../python/agent/CustomServiceOrchestrator.py | 1 + .../org/apache/slider/client/SliderClient.java | 6 +- .../apache/slider/common/params/Arguments.java | 17 +- .../metainfo.xml | 42 ++++ .../package/scripts/all.py | 59 +++++ .../metainfo.xml | 50 ++++ .../package/scripts/cl.py | 59 +++++ .../metainfo.xml | 33 +++ .../metainfo.xml | 42 ++++ .../package/scripts/COMMAND_LOGGER.py | 59 +++++ .../add-on-package-echo/metainfo.xml | 42 ++++ .../add-on-package-echo/package/scripts/echo.py | 59 +++++ .../test_command_log/resources_add_on_pkg.json | 17 ++ .../slider/client/TestClientBadArgs.groovy | 17 ++ .../providers/agent/TestAddonPackage.groovy | 152 ++++++++++++ .../framework/AgentCommandTestBase.groovy | 27 +++ .../funtest/framework/CommandTestBase.groovy | 2 +- .../ApplicationWithAddonPackagesIT.groovy | 234 +++++++++++++++++++ .../TestApplicationWithAddonPackagesIT.groovy | 79 ------- 19 files changed, 906 insertions(+), 91 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py b/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py index b4a1e21..b40a8b5 100644 --- a/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py +++ b/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py @@ -102,6 +102,7 @@ class CustomServiceOrchestrator(): + "/application.addon." + command['package'] ) + command['commandParams']['addonPackageRoot'] = add_on_dir_str add_on_base_dir = os.path.realpath(posixpath.join(add_on_dir_str, "package")) logger.info("Add on package: %s, add on base dir: %s" % (command['package'], str(add_on_base_dir))) http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/main/java/org/apache/slider/client/SliderClient.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java index 9050e4f..98f1344 100644 --- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java +++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java @@ -1633,9 +1633,6 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe validateClientAndClusterResource(clustername, resources); } } - - AppDefinitionPersister appDefinitionPersister = new AppDefinitionPersister(sliderFileSystem); - appDefinitionPersister.processSuppliedDefinitions(clustername, buildInfo, appConf); //get the command line options ConfTree cmdLineAppOptions = buildInfo.buildAppOptionsConfTree(); @@ -1643,6 +1640,9 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe appConf.merge(cmdLineAppOptions); + AppDefinitionPersister appDefinitionPersister = new AppDefinitionPersister(sliderFileSystem); + appDefinitionPersister.processSuppliedDefinitions(clustername, buildInfo, appConf); + // put the role counts into the resources file Map<String, String> argsRoleMap = buildInfo.getComponentMap(); for (Map.Entry<String, String> roleEntry : argsRoleMap.entrySet()) { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java index 89d5a3e..7dda57b 100644 --- a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java +++ b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java @@ -26,9 +26,11 @@ package org.apache.slider.common.params; * so it is easier to see what arguments are there */ public interface Arguments { + String ARG_ADDON = "--addon"; String ARG_ALL = "--all"; String ARG_ALIAS = "--alias"; String ARG_APPLICATION = "--application"; + String ARG_APPDEF = "--appdef"; String ARG_APP_HOME = "--apphome"; String ARG_BASE_PATH = "--basepath"; String ARG_CLIENT = "--client"; @@ -38,8 +40,8 @@ public interface Arguments { String ARG_COMPONENTS = "--components"; String ARG_COMP_OPT= "--compopt"; String ARG_COMP_OPT_SHORT = "--co"; + String ARG_CONFIG = "--config"; String ARG_CREDENTIALS = "--credentials"; - String ARG_DEBUG = "--debug"; String ARG_DEFINE = "-D"; String ARG_DEST = "--dest"; @@ -78,8 +80,8 @@ public interface Arguments { String ARG_MANAGER = "--manager"; String ARG_MANAGER_SHORT = "--m"; String ARG_MESSAGE = "--message"; + String ARG_METAINFO = "--metainfo"; String ARG_NAME = "--name"; - String ARG_VERSION = "--version"; String ARG_OPTION = "--option"; String ARG_OPTION_SHORT = "-O"; String ARG_OUTPUT = "--out"; @@ -109,15 +111,16 @@ public interface Arguments { String ARG_TRUSTSTORE = "--truststore"; String ARG_USER = "--user"; String ARG_VERBOSE = "--verbose"; + String ARG_VERSION = "--version"; String ARG_WAIT = "--wait"; String ARG_YARN = "--yarn"; String ARG_ZKHOSTS = "--zkhosts"; String ARG_ZKPATH = "--zkpath"; String ARG_ZKPORT = "--zkport"; - String ARG_CONFIG = "--config"; - String ARG_METAINFO = "--metainfo"; - String ARG_ADDON = "--addon"; - String ARG_APPDEF = "--appdef"; +/* + STOP: DO NOT ADD YOUR ARGUMENTS HERE. GO BACK AND INSERT THEM IN THE + RIGHT PLACE IN THE LIST + */ /** @@ -139,7 +142,5 @@ public interface Arguments { */ String ARG_RM_ADDR = "--rm"; - String FORMAT_XML = "xml"; - String FORMAT_PROPERTIES = "properties"; } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/metainfo.xml ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/metainfo.xml b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/metainfo.xml new file mode 100644 index 0000000..d47ffe2 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/metainfo.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <applicationPackage> + <name>add-on-package-apply-on-all-component</name> + <comment> + add-on-package-apply-on-all-component + </comment> + <version>2.0</version> + <type>ADDON-PACKAGE</type> + <minHadoopVersion>1.0</minHadoopVersion> + + <components> + <component> + <name>ALL</name> + <commandScript> + <script>scripts/all.py</script> + <scriptType>PYTHON</scriptType> + <timeout>600</timeout> + </commandScript> + </component> + + </components> + </applicationPackage> +</metainfo> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/package/scripts/all.py ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/package/scripts/all.py b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/package/scripts/all.py new file mode 100644 index 0000000..de1a8f8 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/package/scripts/all.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +import subprocess +from resource_management import * + + +class ALL(Script): + def install(self, env): + self.install_packages(env) + tmp_file_path = "/tmp/test_slider" + tmp_file = open(tmp_file_path, 'w') + tmp_file.write("testing...") + cat = subprocess.Popen(["hdfs", "dfs", "-copyFromLocal", tmp_file_path, "/tmp"], stdout=subprocess.PIPE) + cat.communicate() + print "running install for all components in add on pkg" + + def configure(self, env): + import params + env.set_params(params) + + def start(self, env): + import params + env.set_params(params) + self.configure(env) # for security + + + def stop(self, env): + import params + env.set_params(params) + + + def status(self, env): + import status_params + env.set_params(status_params) + + + +if __name__ == "__main__": + ALL().execute() + pass http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/metainfo.xml ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/metainfo.xml b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/metainfo.xml new file mode 100644 index 0000000..fa3003b --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/metainfo.xml @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <applicationPackage> + <name>add-on-package-apply-on-multi-component</name> + <comment> + add-on-package-apply-on-multi-component + </comment> + <version>2.0</version> + <type>ADDON-PACKAGE</type> + <minHadoopVersion>1.0</minHadoopVersion> + + <components> + <component> + <name>COMMAND_LOGGER</name> + <commandScript> + <script>scripts/cl.py</script> + <scriptType>PYTHON</scriptType> + <timeout>600</timeout> + </commandScript> + </component> + + <component> + <name>COMMAND_LOGGER_CLIENT</name> + <commandScript> + <script>scripts/cl_client.py</script> + <scriptType>PYTHON</scriptType> + <timeout>600</timeout> + </commandScript> + </component> + </components> + </applicationPackage> +</metainfo> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/package/scripts/cl.py ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/package/scripts/cl.py b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/package/scripts/cl.py new file mode 100644 index 0000000..3cb4751 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/package/scripts/cl.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +import subprocess +from resource_management import * + + +class CL(Script): + def install(self, env): + self.install_packages(env) + tmp_file_path = "/tmp/test_slider" + tmp_file = open(tmp_file_path, 'w') + tmp_file.write("testing...") + cat = subprocess.Popen(["hdfs", "dfs", "-copyFromLocal", tmp_file_path, "/tmp"], stdout=subprocess.PIPE) + cat.communicate() + print "running install for all components in add on pkg" + + def configure(self, env): + import params + env.set_params(params) + + def start(self, env): + import params + env.set_params(params) + self.configure(env) # for security + + + def stop(self, env): + import params + env.set_params(params) + + + def status(self, env): + import status_params + env.set_params(status_params) + + + +if __name__ == "__main__": + CL().execute() + pass http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-no-component/metainfo.xml ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-no-component/metainfo.xml b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-no-component/metainfo.xml new file mode 100644 index 0000000..ca68eaa --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-no-component/metainfo.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <applicationPackage> + <name>add-on-package-apply-on-all-component</name> + <comment> + add-on-package-apply-on-all-component + </comment> + <version>2.0</version> + <type>ADDON-PACKAGE</type> + <minHadoopVersion>1.0</minHadoopVersion> + + <components> + </components> + </applicationPackage> +</metainfo> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/metainfo.xml ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/metainfo.xml b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/metainfo.xml new file mode 100644 index 0000000..6b7f9b1 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/metainfo.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <applicationPackage> + <name>add-on-package-apply-on-one-component</name> + <comment> + add-on-package-apply-on-one-component + </comment> + <version>2.0</version> + <type>ADDON-PACKAGE</type> + <minHadoopVersion>1.0</minHadoopVersion> + + <components> + <component> + <name>COMMAND_LOGGER</name> + <commandScript> + <script>scripts/COMMAND_LOGGER.py</script> + <scriptType>PYTHON</scriptType> + <timeout>600</timeout> + </commandScript> + </component> + + </components> + </applicationPackage> +</metainfo> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/package/scripts/COMMAND_LOGGER.py ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/package/scripts/COMMAND_LOGGER.py b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/package/scripts/COMMAND_LOGGER.py new file mode 100644 index 0000000..1c18969 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/package/scripts/COMMAND_LOGGER.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +import subprocess +from resource_management import * + + +class COMMAND_LOGGER(Script): + def install(self, env): + self.install_packages(env) + tmp_file_path = "/tmp/test_slider" + tmp_file = open(tmp_file_path, 'w') + tmp_file.write("testing...") + cat = subprocess.Popen(["hdfs", "dfs", "-copyFromLocal", tmp_file_path, "/tmp"], stdout=subprocess.PIPE) + cat.communicate() + print "running install for command_logger components in add on pkg" + + def configure(self, env): + import params + env.set_params(params) + + def start(self, env): + import params + env.set_params(params) + self.configure(env) # for security + + + def stop(self, env): + import params + env.set_params(params) + + + def status(self, env): + import status_params + env.set_params(status_params) + + + +if __name__ == "__main__": + COMMAND_LOGGER().execute() + pass http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/metainfo.xml ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/metainfo.xml b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/metainfo.xml new file mode 100644 index 0000000..f75552f --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/metainfo.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <applicationPackage> + <name>add-on-package-apply-on-one-component</name> + <comment> + add-on-package-apply-on-one-component + </comment> + <version>2.0</version> + <type>ADDON-PACKAGE</type> + <minHadoopVersion>1.0</minHadoopVersion> + + <components> + <component> + <name>echo</name> + <commandScript> + <script>scripts/echo.py</script> + <scriptType>PYTHON</scriptType> + <timeout>600</timeout> + </commandScript> + </component> + + </components> + </applicationPackage> +</metainfo> http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/package/scripts/echo.py ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/package/scripts/echo.py b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/package/scripts/echo.py new file mode 100644 index 0000000..480ed31 --- /dev/null +++ b/slider-core/src/test/app_packages/test_add_on_package/add-on-package-echo/package/scripts/echo.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +import subprocess +from resource_management import * + + +class ECHO(Script): + def install(self, env): + self.install_packages(env) + tmp_file_path = "/tmp/test_slider" + tmp_file = open(tmp_file_path, 'w') + tmp_file.write("testing...") + cat = subprocess.Popen(["hdfs", "dfs", "-copyFromLocal", tmp_file_path, "/tmp"], stdout=subprocess.PIPE) + cat.communicate() + print "running install for command_logger components in add on pkg" + + def configure(self, env): + import params + env.set_params(params) + + def start(self, env): + import params + env.set_params(params) + self.configure(env) # for security + + + def stop(self, env): + import params + env.set_params(params) + + + def status(self, env): + import status_params + env.set_params(status_params) + + + +if __name__ == "__main__": + ECHO().execute() + pass http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/app_packages/test_command_log/resources_add_on_pkg.json ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_command_log/resources_add_on_pkg.json b/slider-core/src/test/app_packages/test_command_log/resources_add_on_pkg.json new file mode 100644 index 0000000..5255f0e --- /dev/null +++ b/slider-core/src/test/app_packages/test_command_log/resources_add_on_pkg.json @@ -0,0 +1,17 @@ +{ + "schema": "http://example.org/specification/v2.0.0", + "metadata": { + }, + "global": { + }, + "components": { + "COMMAND_LOGGER": { + "yarn.memory": "128", + "yarn.role.priority": "1", + "yarn.component.instances": "1" + }, + "slider-appmaster": { + "yarn.memory": "256" + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy b/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy index f81738f..12736e3 100644 --- a/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy @@ -27,6 +27,7 @@ import org.apache.slider.common.params.SliderActions import org.apache.slider.core.exceptions.BadCommandArgumentsException import org.apache.slider.core.exceptions.ErrorStrings import org.apache.slider.core.exceptions.UsageException +import org.apache.slider.core.exceptions.BadConfigException import org.apache.slider.core.main.ServiceLauncher import org.apache.slider.core.main.ServiceLauncherBaseTest import org.junit.Test @@ -37,6 +38,9 @@ import org.junit.Test @CompileStatic @Slf4j class TestClientBadArgs extends ServiceLauncherBaseTest { + + static String TEST_FILES = "./src/test/resources/org/apache/slider/providers/agent/tests/" + @Test public void testNoAction() throws Throwable { launchExpectingException(SliderClient, @@ -220,4 +224,17 @@ class TestClientBadArgs extends ServiceLauncherBaseTest { log.info(exception.toString()) } + @Test + public void testCreateAppWithAddonPkgBadArg1() throws Throwable { + //add on package without specifying add on package name + def exception = launchExpectingException(SliderClient, + new Configuration(), + "Expected 2 values after --addon", + [SliderActions.ACTION_CREATE, + "cl1", + Arguments.ARG_ADDON, + "addon1"]) + assert exception instanceof BadCommandArgumentsException + log.info(exception.toString()) + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAddonPackage.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAddonPackage.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAddonPackage.groovy new file mode 100644 index 0000000..1167b95 --- /dev/null +++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAddonPackage.groovy @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.providers.agent + +import org.apache.slider.common.SliderExitCodes +import org.apache.slider.core.main.ServiceLaunchException +import org.apache.slider.core.exceptions.BadClusterStateException + +import java.io.IOException; + +import static org.apache.slider.common.params.Arguments.* +import static org.apache.slider.providers.agent.AgentKeys.* +import groovy.util.logging.Slf4j + +import org.apache.hadoop.fs.FileSystem +import org.apache.hadoop.fs.RawLocalFileSystem +import org.apache.hadoop.yarn.conf.YarnConfiguration +import org.apache.slider.client.SliderClient +import org.apache.slider.common.params.Arguments +import org.apache.slider.common.params.ClientArgs +import org.apache.slider.common.tools.SliderFileSystem +import org.apache.slider.common.tools.SliderUtils +import org.apache.slider.core.exceptions.SliderException +import org.apache.slider.core.main.ServiceLauncher +import org.apache.slider.providers.agent.AgentKeys +import org.apache.slider.api.ResourceKeys +import org.apache.slider.common.SliderXmlConfKeys +import org.apache.slider.test.SliderTestUtils +import org.junit.Before +import org.junit.Test + +/** + * Tests an echo command + */ +@Slf4j +class TestAddonPackage extends AgentTestBase { + + File slider_core + String echo_py + File echo_py_path + File app_def_path + String agt_ver + File agt_ver_path + String agt_conf + File agt_conf_path + + static String APPCONFIG_PATH = "src/test/app_packages/test_addon_pkg/appConfig.json" + static String RESOURCE_PATH = "src/test/app_packages/test_addon_pkg/resources.json" + static String MASTER_PKG_PATH = "src/test/app_packages/test_addon_pkg/master-app-pkg.zip" + static String ADD_ON_PACKAGE_NAME1 = "LISTEN1"; + static String ADD_ON_PACKAGE_ECHO_FOLDER = "src/test/app_packages/test_add_on_package/add-on-package-echo" + static String ADD_ON_PACKAGE_ECHO_NAME = "add-on-package-echo" + static String ADD_ON_PACKAGE_ECHO_FILE = "target/add-on-package-echo.zip"; + static String APP_NAME = "FAKE" + + @Before + public void setupArtifacts() { + slider_core = new File(new File(".").absoluteFile, "src/test/python"); + echo_py = "echo.py" + echo_py_path = new File(slider_core, echo_py) + app_def_path = new File(app_def_pkg_path) + agt_ver = "version" + agt_ver_path = new File(slider_core, agt_ver) + agt_conf = "agent.ini" + agt_conf_path = new File(slider_core, agt_conf) + + } + + @Override + void checkTestAssumptions(YarnConfiguration conf) { + + } + + @Test + public void testEchoApplicationAddPackage() throws Throwable { + assumeValidServerEnv() + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_ECHO_FOLDER), new File(ADD_ON_PACKAGE_ECHO_FILE)) + + String clustername = createMiniCluster("", + configuration, + 1, + 1, + 1, + true, + false) + + assert echo_py_path.exists() + assert app_def_path.exists() + assert agt_ver_path.exists() + assert agt_conf_path.exists() + + def role = "echo" + Map<String, Integer> roles = [ + (role): 2, + ]; + ServiceLauncher<SliderClient> launcher = buildAgentCluster(clustername, + roles, + [ + ARG_OPTION, PACKAGE_PATH, slider_core.absolutePath, + ARG_OPTION, APP_DEF, toURIArg(app_def_path), + ARG_OPTION, AGENT_CONF, toURIArg(agt_conf_path), + ARG_OPTION, AGENT_VERSION, toURIArg(agt_ver_path), + ARG_RES_COMP_OPT, role, ResourceKeys.COMPONENT_PRIORITY, "1", + ARG_COMP_OPT, role, SCRIPT_PATH, echo_py, + ARG_COMP_OPT, role, SERVICE_NAME, "Agent", + ARG_DEFINE, + SliderXmlConfKeys.KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED + "=false", + ARG_COMP_OPT, role, TEST_RELAX_VERIFICATION, "true", + ARG_ADDON, ADD_ON_PACKAGE_ECHO_NAME, ADD_ON_PACKAGE_ECHO_FILE + ], + true, true, + true) + + SliderClient sliderClient = launcher.service + + waitForRoleCount(sliderClient, roles, 15000) + //sleep a bit + sleep(5000) + //expect the role count to be the same + waitForRoleCount(sliderClient, roles, 1000) + + // flex size + // while running, flex it with no changes + sliderClient.flex(clustername, [(role): 2]); + sleep(5000) + waitForRoleCount(sliderClient, roles, 1000) + + // flex to an illegal value + try { + sliderClient.flex(clustername, [(role): -1]); + fail("expected an exception") + } catch (BadClusterStateException e) { + assertExceptionDetails(e, SliderExitCodes.EXIT_BAD_STATE, "negative") + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy index 832f855..60d3ee2 100644 --- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy +++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/AgentCommandTestBase.groovy @@ -22,6 +22,7 @@ import groovy.util.logging.Slf4j import org.apache.hadoop.fs.Path import org.apache.hadoop.security.UserGroupInformation import org.apache.hadoop.yarn.api.records.YarnApplicationState +import org.apache.hadoop.fs.FileSystem; import org.apache.slider.common.SliderExitCodes import org.apache.slider.common.params.Arguments import org.apache.slider.common.params.SliderActions @@ -150,6 +151,32 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions { } } } + + protected static void verifyFileExist(String filePath){ + try{ + Path pt = new Path(filePath); + def uploader = new FileUploader(SLIDER_CONFIG, + UserGroupInformation.currentUser) + FileSystem fs = uploader.getFileSystem(); + assert fs.exists(pt); + }catch(IOException e){ + log.error("IOException during verifying file exist " + e.toString()); + } + } + + protected static void cleanupHdfsFile(String filePath){ + try{ + Path pt = new Path(filePath); + def uploader = new FileUploader(SLIDER_CONFIG, + UserGroupInformation.currentUser) + FileSystem fs = uploader.getFileSystem(); + if( fs.exists(pt)){ + fs.delete(pt, false); + } + }catch(IOException e){ + log.error("IOException during deleting file: " + e.toString()); + } + } protected void cleanup(String applicationName) throws Throwable { if (setup_failed) { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/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 76853d0..edc4826 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 @@ -75,7 +75,7 @@ abstract class CommandTestBase extends SliderTestUtils { public static final File SLIDER_CONF_XML = new File(SLIDER_CONF_DIRECTORY, CLIENT_CONFIG_FILENAME).canonicalFile public static final YarnConfiguration SLIDER_CONFIG - public static final int THAW_WAIT_TIME + public static int THAW_WAIT_TIME public static final int FREEZE_WAIT_TIME public static final int SLIDER_TEST_TIMEOUT http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy new file mode 100644 index 0000000..4f89485 --- /dev/null +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy @@ -0,0 +1,234 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.slider.funtest.coprocessors + +import groovy.transform.CompileStatic +import groovy.util.logging.Slf4j + +import org.apache.hadoop.security.UserGroupInformation +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.yarn.api.records.YarnApplicationState +import org.apache.slider.api.ClusterDescription +import org.apache.slider.api.StatusKeys +import org.apache.slider.client.SliderClient +import org.apache.slider.common.SliderExitCodes +import org.apache.slider.common.SliderXmlConfKeys +import org.apache.slider.common.params.Arguments +import org.apache.slider.common.params.SliderActions +import org.apache.slider.common.tools.SliderUtils +import org.apache.slider.funtest.framework.AgentCommandTestBase +import org.apache.slider.funtest.framework.FuntestProperties +import org.apache.slider.funtest.framework.SliderShell +import org.apache.slider.funtest.framework.FileUploader +import org.junit.After +import org.junit.Before +import org.junit.Test + +import org.apache.slider.funtest.framework.AgentCommandTestBase +import org.apache.slider.funtest.framework.CommandTestBase +import org.junit.After +import org.junit.Before +import org.junit.Test + +@CompileStatic +@Slf4j +public class ApplicationWithAddonPackagesIT extends AgentCommandTestBase{ + + static String CLUSTER = "test-application-with-add-on" + static String APP_RESOURCE2 = "../slider-core/src/test/app_packages/test_command_log/resources_add_on_pkg.json" + static String APP_META12 = "../slider-core/src/test/app_packages/test_addon_pkg/metainfo.json" + static String APP_TEMPLATE12 = "../slider-core/src/test/app_packages/test_addon_pkg/appConfig.json" + static String ADD_ON_PACKAGE_ONE_COMPONENT = "../slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-one-component/" + static String ADD_ON_PACKAGE_ALL_COMPONENT = "../slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-all-component/" + static String ADD_ON_PACKAGE_MULTI_COMPONENT = "../slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-multi-component/" + static String ADD_ON_PACKAGE_NO_COMPONENT = "../slider-core/src/test/app_packages/test_add_on_package/add-on-package-apply-on-no-component/" + static String ADD_ON_PACKAGE_ALL_COMPONENT_PKG_NAME = "add-on-package-apply-on-all-component" + static String ADD_ON_PACKAGE_ALL_COMPONENT_PKG_FILE = "target/package-tmp/add-on-package-apply-on-all-component.zip" + static String ADD_ON_PACKAGE_ONE_COMPONENT_PKG_NAME = "add-on-package-apply-on-one-component" + static String ADD_ON_PACKAGE_ONE_COMPONENT_PKG_FILE = "target/package-tmp/add-on-package-apply-on-one-component.zip" + static String ADD_ON_PACKAGE_MULTI_COMPONENT_PKG_NAME = "add-on-package-apply-on-multi-component" + static String ADD_ON_PACKAGE_MULTI_COMPONENT_PKG_FILE = "target/package-tmp/add-on-package-apply-on-multi-component.zip" + static String ADD_ON_PACKAGE_NO_COMPONENT_PKG_NAME = "add-on-package-apply-on-no-component" + static String ADD_ON_PACKAGE_NO_COMPONENT_PKG_FILE = "target/package-tmp/add-on-package-apply-on-no-component.zip" + static String TARGET_FILE = "/tmp/test_slider" + protected String APP_RESOURCE = getAppResource() + protected String APP_TEMPLATE = getAppTemplate() + + @Before + public void prepareCluster() { + setupCluster(CLUSTER) + } + + @After + public void destroyCluster() { + cleanup(CLUSTER) + } + + @Test + public void testCreateApplicationWithOneAddonPackagesForOneComponent() throws Throwable { + describe("Create a cluster with an addon package that apply to one component") + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_ONE_COMPONENT), new File(ADD_ON_PACKAGE_ONE_COMPONENT_PKG_FILE)) + cleanupHdfsFile(TARGET_FILE) + + def clusterpath = buildClusterPath(CLUSTER) + File launchReportFile = createTempJsonFile(); + + SliderShell shell = createTemplatedSliderApplication(CLUSTER, + APP_TEMPLATE, + APP_RESOURCE2, + [Arguments.ARG_ADDON, ADD_ON_PACKAGE_ONE_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_ONE_COMPONENT_PKG_FILE], + launchReportFile) + + logShell(shell) + + def appId = ensureYarnApplicationIsUp(launchReportFile) + + exists(0, CLUSTER) + list(0, [CLUSTER]) + list(0, [""]) + list(0, [CLUSTER, ARG_LIVE]) + list(0, [CLUSTER, ARG_STATE, "running"]) + list(0, [ARG_LIVE]) + list(0, [ARG_STATE, "running"]) + status(0, CLUSTER) + Thread.sleep(10000) + verifyFileExist(TARGET_FILE) + } + + @Test + public void testCreateApplicationWithOneAddonPackagesForNoComponents() throws Throwable { + describe("Create a cluster with an addon package that apply to no components") + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_NO_COMPONENT), new File(ADD_ON_PACKAGE_NO_COMPONENT_PKG_FILE)) + def clusterpath = buildClusterPath(CLUSTER) + File launchReportFile = createTempJsonFile(); + cleanupHdfsFile(TARGET_FILE) + + //default waiting time too long, temporarily lower it + int temp_holder = CommandTestBase.THAW_WAIT_TIME; + CommandTestBase.THAW_WAIT_TIME = 100; + SliderShell shell = createTemplatedSliderApplication(CLUSTER, + APP_TEMPLATE, + APP_RESOURCE2, + [Arguments.ARG_ADDON, ADD_ON_PACKAGE_NO_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_NO_COMPONENT_PKG_FILE], + launchReportFile) + CommandTestBase.THAW_WAIT_TIME = temp_holder; + + logShell(shell) + + Thread.sleep(10000) + //application should not start as no components in metainfo.json in add on pkg + exists(-1, CLUSTER) + list(0, [CLUSTER]) + } + + @Test + public void testCreateApplicationWithOneAddonPackagesForMultipleComponents() throws Throwable { + describe("Create a cluster with an addon package that apply to multiple components") + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_MULTI_COMPONENT), new File(ADD_ON_PACKAGE_MULTI_COMPONENT_PKG_FILE)) + def clusterpath = buildClusterPath(CLUSTER) + File launchReportFile = createTempJsonFile(); + cleanupHdfsFile(TARGET_FILE) + + SliderShell shell = createTemplatedSliderApplication(CLUSTER, + APP_TEMPLATE, + APP_RESOURCE2, + [Arguments.ARG_ADDON, ADD_ON_PACKAGE_MULTI_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_MULTI_COMPONENT_PKG_FILE], + launchReportFile) + + logShell(shell) + + def appId = ensureYarnApplicationIsUp(launchReportFile) + + exists(0, CLUSTER) + list(0, [CLUSTER]) + list(0, [""]) + list(0, [CLUSTER, ARG_LIVE]) + list(0, [CLUSTER, ARG_STATE, "running"]) + list(0, [ARG_LIVE]) + list(0, [ARG_STATE, "running"]) + status(0, CLUSTER) + Thread.sleep(10000) + verifyFileExist(TARGET_FILE) + } + + @Test + public void testCreateApplicationWithOneAddonPackagesForAllComponents() throws Throwable { + describe("Create a cluster with an addon package that apply to all components") + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_ALL_COMPONENT), new File(ADD_ON_PACKAGE_ALL_COMPONENT_PKG_FILE)) + def clusterpath = buildClusterPath(CLUSTER) + File launchReportFile = createTempJsonFile(); + cleanupHdfsFile(TARGET_FILE) + + SliderShell shell = createTemplatedSliderApplication(CLUSTER, + APP_TEMPLATE, + APP_RESOURCE2, + [Arguments.ARG_ADDON, ADD_ON_PACKAGE_ALL_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_ALL_COMPONENT_PKG_FILE], + launchReportFile) + + logShell(shell) + Thread.sleep(10000); + def appId = ensureYarnApplicationIsUp(launchReportFile) + + exists(0, CLUSTER) + list(0, [CLUSTER]) + list(0, [""]) + list(0, [CLUSTER, ARG_LIVE]) + list(0, [CLUSTER, ARG_STATE, "running"]) + list(0, [ARG_LIVE]) + list(0, [ARG_STATE, "running"]) + status(0, CLUSTER) + + Thread.sleep(10000) + verifyFileExist(TARGET_FILE) + } + + + @Test + public void testCreateApplicationWithMultipeAddonPackages() throws Throwable { + describe("Create a cluster with multiple addon packages") + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_ALL_COMPONENT), new File(ADD_ON_PACKAGE_ALL_COMPONENT_PKG_FILE)) + SliderUtils.zipFolder(new File(ADD_ON_PACKAGE_ONE_COMPONENT), new File(ADD_ON_PACKAGE_ONE_COMPONENT_PKG_FILE)) + def clusterpath = buildClusterPath(CLUSTER) + File launchReportFile = createTempJsonFile(); + cleanupHdfsFile(TARGET_FILE) + + SliderShell shell = createTemplatedSliderApplication(CLUSTER, + APP_TEMPLATE, + APP_RESOURCE2, + [Arguments.ARG_ADDON, ADD_ON_PACKAGE_ALL_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_ALL_COMPONENT_PKG_FILE, + Arguments.ARG_ADDON, ADD_ON_PACKAGE_ONE_COMPONENT_PKG_NAME, ADD_ON_PACKAGE_ONE_COMPONENT_PKG_FILE], + launchReportFile) + + logShell(shell) + + def appId = ensureYarnApplicationIsUp(launchReportFile) + + exists(0, CLUSTER) + list(0, [CLUSTER]) + list(0, [""]) + list(0, [CLUSTER, ARG_LIVE]) + list(0, [CLUSTER, ARG_STATE, "running"]) + list(0, [ARG_LIVE]) + list(0, [ARG_STATE, "running"]) + status(0, CLUSTER) + Thread.sleep(10000) + verifyFileExist(TARGET_FILE) + } +} + http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/b97a8611/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestApplicationWithAddonPackagesIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestApplicationWithAddonPackagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestApplicationWithAddonPackagesIT.groovy deleted file mode 100644 index 981dd4a..0000000 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/TestApplicationWithAddonPackagesIT.groovy +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.slider.agent.standalone - -import groovy.transform.CompileStatic -import groovy.util.logging.Slf4j -import org.apache.hadoop.yarn.api.records.YarnApplicationState -import org.apache.slider.api.ClusterDescription -import org.apache.slider.api.StatusKeys -import org.apache.slider.client.SliderClient -import org.apache.slider.common.SliderExitCodes -import org.apache.slider.common.SliderXmlConfKeys -import org.apache.slider.common.params.Arguments -import org.apache.slider.common.params.SliderActions -import org.apache.slider.funtest.framework.AgentCommandTestBase -import org.apache.slider.funtest.framework.FuntestProperties -import org.apache.slider.funtest.framework.SliderShell -import org.junit.After -import org.junit.Before -import org.junit.Test - -import org.apache.slider.funtest.framework.AgentCommandTestBase -import org.junit.After -import org.junit.Before -import org.junit.Test - -@CompileStatic -@Slf4j -public class ApplicationWithAddonPackagesIT extends AgentCommandTestBase{ - - static String CLUSTER = "test-application-with-add-on" - - static String APP_RESOURCE12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/resources.json" - static String APP_META12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/metainfo.json" - static String APP_TEMPLATE12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/appConfig.json" - - - @Before - public void prepareCluster() { - setupCluster(CLUSTER) - } - - @After - public void destroyCluster() { - cleanup(CLUSTER) - } - - @Test - public void testAgentRegistry() throws Throwable { - describe("Create a cluster using metainfo, resources, and appConfig that calls nc to listen on a port") - def clusterpath = buildClusterPath(CLUSTER) - File launchReportFile = createTempJsonFile(); - - SliderShell shell = createSliderApplicationMinPkg(CLUSTER, - APP_META12, - APP_RESOURCE12, - APP_TEMPLATE12, - [], - launchReportFile) - - logShell(shell) - - def appId = ensureYarnApplicationIsUp(launchReportFile) - } -} \ No newline at end of file
