Skip to content

Commit 20064b6

Browse files
HDDS-1978. Create helper script to run blockade tests. (#1310)
1 parent c92de82 commit 20064b6

File tree

2 files changed

+39
-3
lines changed
  • hadoop-ozone

2 files changed

+39
-3
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
18+
cd "$DIR/../../.." || exit 1
19+
20+
OZONE_VERSION=$(grep "<ozone.version>" "$DIR/../../pom.xml" | sed 's/<[^>]*>//g'| sed 's/^[ \t]*//')
21+
cd "$DIR/../../dist/target/ozone-$OZONE_VERSION/tests" || exit 1
22+
23+
source ${DIR}/../../dist/target/ozone-${OZONE_VERSION}/compose/ozoneblockade/.env
24+
export HADOOP_RUNNER_VERSION
25+
export HDDS_VERSION
26+
27+
python -m pytest -s blockade
28+
exit $?

hadoop-ozone/fault-injection-test/network-tests/src/test/blockade/ozone/cluster.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import os
2020
import re
2121
import subprocess
22+
import sys
2223
import yaml
24+
import time
2325

2426

2527
from os import environ
@@ -146,11 +148,17 @@ def start(self):
146148
"""
147149
Start Ozone Cluster in docker containers.
148150
"""
149-
# check if proper env $HDDS_VERSION and $HADOOP_RUNNER_VERSION
150-
# are set.
151151

152152
# check if docker is up.
153153

154+
if "HADOOP_RUNNER_VERSION" not in os.environ:
155+
self.__logger__.error("HADOOP_RUNNER_VERSION is not set.")
156+
sys.exit(1)
157+
158+
if "HDDS_VERSION" not in os.environ:
159+
self.__logger__.error("HDDS_VERSION is not set.")
160+
sys.exit(1)
161+
154162
self.__logger__.info("Starting Ozone Cluster")
155163
if Blockade.blockade_status() == 0:
156164
Blockade.blockade_destroy()
@@ -162,7 +170,7 @@ def start(self):
162170
"datanode=" + str(self.conf.datanode_count)])
163171
self.__logger__.info("Waiting 10s for cluster start up...")
164172
# Remove the sleep and wait only till the cluster is out of safemode
165-
# time.sleep(10)
173+
time.sleep(10)
166174
output = subprocess.check_output([Command.docker_compose, "-f",
167175
self.docker_compose_file, "ps"])
168176
node_list = []

0 commit comments

Comments
 (0)