Browse Source

HDDS-1007. Add robot test for AuditParser.
Contributed by Dinesh Chitlangia.

Nanda kumar 6 years ago
parent
commit
8ff9578126

+ 40 - 0
hadoop-ozone/dist/src/main/smoketest/auditparser/parser.robot

@@ -0,0 +1,40 @@
+# 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.
+
+*** Settings ***
+Documentation       Smoketest ozone cluster startup
+Library             OperatingSystem
+Resource            ../commonlib.robot
+
+*** Test Cases ***
+
+Initiating freon to generate data
+    ${result} =        Execute              ozone freon randomkeys --numOfVolumes 5 --numOfBuckets 5 --numOfKeys 5 --numOfThreads 1
+                       Wait Until Keyword Succeeds      3min       10sec     Should contain   ${result}   Number of Keys added: 125
+                       Should Not Contain               ${result}  ERROR
+
+Testing audit parser
+    ${logfile} =       Execute              ls -t /opt/hadoop/logs | grep om-audit | head -1
+                       Execute              ozone auditparser /opt/hadoop/audit.db load "/opt/hadoop/logs/${logfile}"
+    ${result} =        Execute              ozone auditparser /opt/hadoop/audit.db template top5cmds
+                       Should Contain       ${result}  ALLOCATE_KEY
+    ${result} =        Execute              ozone auditparser /opt/hadoop/audit.db template top5users
+                       Should Contain       ${result}  hadoop
+    ${result} =        Execute              ozone auditparser /opt/hadoop/audit.db query "select count(*) from audit where op='CREATE_VOLUME' and RESULT='SUCCESS'"
+                       Should Contain       ${result}  5
+    ${result} =        Execute              ozone auditparser /opt/hadoop/audit.db query "select count(*) from audit where op='CREATE_BUCKET' and RESULT='SUCCESS'"
+                       Should Contain       ${result}  5
+    ${result} =        Execute              ozone auditparser /opt/hadoop/audit.db query "select count(*) from audit where RESULT='FAILURE'"
+                       Should Contain       ${result}  0

+ 2 - 0
hadoop-ozone/dist/src/main/smoketest/test.sh

@@ -140,6 +140,8 @@ if [ "$RUN_ALL" = true ]; then
 #
 # We select the test suites and execute them on multiple type of clusters
 #
+   DEFAULT_TESTS=("auditparser")
+   execute_tests auditparser "${DEFAULT_TESTS[@]}"
    DEFAULT_TESTS=("security")
    execute_tests ozonesecure "${DEFAULT_TESTS[@]}"
    DEFAULT_TESTS=("basic")