You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by rv...@apache.org on 2017/03/28 04:28:43 UTC
bigtop git commit: BIGTOP-1408. create basic end-to-end tests for
Ambari integration
Repository: bigtop
Updated Branches:
refs/heads/master 4a24c4bd9 -> 38e1571b2
BIGTOP-1408. create basic end-to-end tests for Ambari integration
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/38e1571b
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/38e1571b
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/38e1571b
Branch: refs/heads/master
Commit: 38e1571b2f73bbfa6ab0c01a689fae967b8399d9
Parents: 4a24c4b
Author: Roman Shaposhnik <rv...@apache.org>
Authored: Mon Mar 27 20:50:38 2017 +0000
Committer: Roman Shaposhnik <rv...@apache.org>
Committed: Mon Mar 27 21:28:12 2017 -0700
----------------------------------------------------------------------
.../smoke-tests/ambari/TestAmbariSimple.groovy | 77 ++++++++++++++++++++
bigtop-tests/smoke-tests/ambari/build.gradle | 32 ++++++++
2 files changed, 109 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bigtop/blob/38e1571b/bigtop-tests/smoke-tests/ambari/TestAmbariSimple.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/ambari/TestAmbariSimple.groovy b/bigtop-tests/smoke-tests/ambari/TestAmbariSimple.groovy
new file mode 100644
index 0000000..6397268
--- /dev/null
+++ b/bigtop-tests/smoke-tests/ambari/TestAmbariSimple.groovy
@@ -0,0 +1,77 @@
+/**
+ * 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.bigtop.itest.ambari
+
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.BeforeClass
+import org.apache.commons.logging.LogFactory
+import org.apache.commons.logging.Log
+import groovyx.net.http.RESTClient
+
+import org.junit.runner.RunWith
+
+class TestAmbariSmoke {
+ static RESTClient ambari
+
+ static String prop(String key) {
+ def value = System.getenv(key)
+ assertNotNull(value)
+ return value
+ }
+
+ @BeforeClass
+ static void setUp() {
+ ambari = new RESTClient("${prop('AMBARI_URL')}/api/v1/")
+ ambari.setHeaders(["X-Requested-By": "ambari", "Authorization": "Basic YWRtaW46YWRtaW4="])
+ ambari.parser.'text/plain' = ambari.parser.'application/json'
+ }
+
+ @Test
+ void testStackNameVersion() {
+ ambari.get( path: 'stacks/ODPi' ) { resp, json ->
+ println json
+ assertEquals("ODPi", json.versions.Versions[0].stack_name)
+ assertEquals("2.0", json.versions.Versions[0].stack_version)
+ }
+ }
+
+ @Test
+ void testBlueprints() {
+ ambari.get( path: 'blueprints' ) { resp, json ->
+ println json
+ assertEquals(0, json.items.size)
+ }
+ }
+
+ @Test
+ void testHosts() {
+ def hosts
+ ambari.get( path: 'hosts' ) { resp, json ->
+ hosts = json.items.Hosts
+ }
+ hosts.each {
+ ambari.get ( path: "hosts/${it.host_name}") { resp, json ->
+ assertEquals("HEALTHY", json.Hosts.host_status)
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/38e1571b/bigtop-tests/smoke-tests/ambari/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/ambari/build.gradle b/bigtop-tests/smoke-tests/ambari/build.gradle
new file mode 100644
index 0000000..a2da00d
--- /dev/null
+++ b/bigtop-tests/smoke-tests/ambari/build.gradle
@@ -0,0 +1,32 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+dependencies {
+ testCompile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
+}
+
+sourceSets {
+ test {
+ groovy {
+ srcDirs = ["./"]
+ }
+ }
+}
+
+test.doFirst {
+ checkEnv(["AMBARI_URL"])
+}