This is an automated email from the ASF dual-hosted git repository.
guyuqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/master by this push:
new f6b1adfe3 BIGTOP-3703. Add smoke tests for Ranger. (#1076)
f6b1adfe3 is described below
commit f6b1adfe3eb84c75774a06705d98b57397bcdbc8
Author: Kengo Seki <[email protected]>
AuthorDate: Tue Mar 28 19:18:05 2023 +0900
BIGTOP-3703. Add smoke tests for Ranger. (#1076)
---
.../smoke-tests/ranger/TestRangerSimple.groovy | 47 ++++++++++++++++++++++
bigtop-tests/smoke-tests/ranger/build.gradle | 33 +++++++++++++++
provisioner/utils/smoke-tests.sh | 1 +
3 files changed, 81 insertions(+)
diff --git a/bigtop-tests/smoke-tests/ranger/TestRangerSimple.groovy
b/bigtop-tests/smoke-tests/ranger/TestRangerSimple.groovy
new file mode 100644
index 000000000..44014193d
--- /dev/null
+++ b/bigtop-tests/smoke-tests/ranger/TestRangerSimple.groovy
@@ -0,0 +1,47 @@
+/**
+ * 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.ranger
+
+import groovy.json.JsonSlurper
+import org.junit.Test
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+
+class TestRangerSmoke {
+
+ static String prop(String key) {
+ def value = System.getenv(key)
+ assertNotNull(value)
+ return value
+ }
+
+ def url = "${prop('RANGER_URL')}/service/"
+ def header = ['Authorization':
+ "Basic ${new
String(Base64.getEncoder().encode('admin:Admin01234'.getBytes()))}"]
+
+ @Test
+ void testServiceDefs() {
+ def json = new URL(url +
'public/v2/api/servicedef').getText(requestProperties: header)
+ def serviceDefs = new JsonSlurper().parseText(json)
+ assertTrue(0 < serviceDefs.size())
+
+ // Check if some major service definitions were registered through setup
+ def serviceNames = serviceDefs.stream().map{ it.name }.collect()
+ assertTrue(['hdfs', 'hbase', 'hive'].every { serviceNames.contains(it) })
+ }
+}
diff --git a/bigtop-tests/smoke-tests/ranger/build.gradle
b/bigtop-tests/smoke-tests/ranger/build.gradle
new file mode 100644
index 000000000..ffd14fa8e
--- /dev/null
+++ b/bigtop-tests/smoke-tests/ranger/build.gradle
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+def junitVersion = '4.13.2'
+dependencies {
+ compile group: 'junit', name: 'junit', version: junitVersion, transitive:
'true'
+}
+
+sourceSets {
+ test {
+ groovy {
+ srcDirs = ["./"]
+ }
+ }
+}
+
+test.doFirst {
+ checkEnv(["RANGER_URL"])
+}
diff --git a/provisioner/utils/smoke-tests.sh b/provisioner/utils/smoke-tests.sh
index d6fdb716e..9ce639fac 100755
--- a/provisioner/utils/smoke-tests.sh
+++ b/provisioner/utils/smoke-tests.sh
@@ -48,6 +48,7 @@ export KAFKA_HOME=${KAFKA_HOME:-/usr/lib/kafka}
export LIVY_HOME=${LIVY_HOME:-/usr/lib/livy}
export OOZIE_TAR_HOME=${OOZIE_TAR_HOME:-/usr/lib/oozie}
export OOZIE_URL=${OOZIE_URL:-http://localhost:11000/oozie}
+export RANGER_URL=${RANGER_URL:-http://localhost:6080}
export SPARK_HOME=${SPARK_HOME:-/usr/lib/spark}
export TEZ_HOME=${TEZ_HOME:-/usr/lib/tez}
export WEBHDFS_URL=${WEBHDFS_URL:-$(hostname):50070/webhdfs/v1}