sijie commented on a change in pull request #1407: Refactor bookkeeper bash 
scripts and move dlog script to root bin directory
URL: https://github.com/apache/bookkeeper/pull/1407#discussion_r188790829
 
 

 ##########
 File path: tests/scripts/src/test/bash/bk_test_bin_common.sh
 ##########
 @@ -0,0 +1,256 @@
+#!/usr/bin/env bash
+#
+# vim:et:ft=sh:sts=2:sw=2
+#
+#/**
+# * 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.
+# */
+
+# load test helpers
+. ./bk_test_helpers
+
+#------------------------------------------------------------------------------
+# suite tests
+#
+
+testDefaultVariables() {
+  source ${BK_BINDIR}/common.sh
+  assertEquals "BINDIR is not set correctly" "${BK_BINDIR}" "${BINDIR}"
+  assertEquals "BK_HOME is not set correctly" "${BK_HOMEDIR}" "${BK_HOME}"
+  assertEquals "DEFAULT_LOG_CONF is not set correctly" 
"${BK_CONFDIR}/log4j.properties" "${DEFAULT_LOG_CONF}"
+  assertEquals "NETTY_LEAK_DETECTION_LEVEL is not set correctly" "disabled" 
"${NETTY_LEAK_DETECTION_LEVEL}"
+  assertEquals "NETTY_RECYCLER_MAXCAPACITY is not set correctly" "1000" 
"${NETTY_RECYCLER_MAXCAPACITY}"
+  assertEquals "NETTY_RECYCLER_LINKCAPACITY is not set correctly" "1024" 
"${NETTY_RECYCLER_LINKCAPACITY}"
+  assertEquals "BOOKIE_MAX_HEAP_MEMORY is not set correctly" "1g" 
"${BOOKIE_MAX_HEAP_MEMORY}"
+  assertEquals "BOOKIE_MIN_HEAP_MEMORY is not set correctly" "1g" 
"${BOOKIE_MIN_HEAP_MEMORY}"
+  assertEquals "BOOKIE_MAX_DIRECT_MEMORY is not set correctly" "2g" 
"${BOOKIE_MAX_DIRECT_MEMORY}"
+  assertEquals "BOOKIE_MEM_OPTS is not set correctly" "-Xms1g -Xmx1g 
-XX:MaxDirectMemorySize=2g" "${BOOKIE_MEM_OPTS}"
+  assertEquals "BOOKIE_GC_OPTS is not set correctly" 
"${DEFAULT_BOOKIE_GC_OPTS}" "${BOOKIE_GC_OPTS}"
+  assertEquals "BOOKIE_GC_LOGGING_OPTS is not set correctly" 
"${DEFAULT_BOOKIE_GC_LOGGING_OPTS}" "${BOOKIE_GC_LOGGING_OPTS}"
+  assertEquals "CLI_MAX_HEAP_MEMORY is not set correctly" "512M" 
"${CLI_MAX_HEAP_MEMORY}"
+  assertEquals "CLI_MIN_HEAP_MEMORY is not set correctly" "256M" 
"${CLI_MIN_HEAP_MEMORY}"
+  assertEquals "CLI_MEM_OPTS is not set correctly" "-Xms256M -Xmx512M" 
"${CLI_MEM_OPTS}"
+  assertEquals "CLI_GC_OPTS is not set correctly" "${DEFAULT_CLI_GC_OPTS}" 
"${CLI_GC_OPTS}"
+  assertEquals "CLI_GC_LOGGING_OPTS is not set correctly" 
"${DEFAULT_CLI_GC_LOGGING_OPTS}" "${CLI_GC_LOGGING_OPTS}"
+}
+
+testFindModuleJarAt() {
+  source ${BK_BINDIR}/common.sh
+
+  MODULE="test-module"
+
+  # case 1: empty dir
+  TEST_DIR1=${BK_TMPDIR}/testdir1
+  mkdir -p ${TEST_DIR1}
+  MODULE_JAR1=$(find_module_jar_at ${TEST_DIR1} ${MODULE})
+  assertEquals "No module jar should be found at empty dir" "" "${MODULE_JAR1}"
+
+  # case 2: SNAPSHOT jar
+  TEST_FILES=(
+    "invalid-${MODULE}.jar"
+    "invalid-${MODULE}-4.8.0.jar"
+    "invalid-${MODULE}-4.8.0-SNAPSHOT.jar"
 
 Review comment:
   @eolivelli this is a unit test. the version here can be anything. it just 
need to be following the pattern. I used "4.8.0" because this PR is developed 
at 4.8.0. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to