@@ -32,16 +32,17 @@ source "${COMPOSE_DIR}/../testlib.sh"
3232export SECURITY_ENABLED=true
3333: ${OZONE_BUCKET_KEY_NAME:= key1}
3434
35- old_client () {
36- OZONE_DIR=/opt/ozone
37- container=${client}
38- " $@ "
39- }
35+ echo ' Compatibility Test' > " ${TEST_DATA_DIR} " /small
36+
37+ client () {
38+ if [[ " ${client_version} " == " ${current_version} " ]]; then
39+ OZONE_DIR=/opt/hadoop
40+ container=new_client
41+ else
42+ OZONE_DIR=/opt/ozone
43+ container=" old_client_${client_version// ./ _} "
44+ fi
4045
41- new_client () {
42- OZONE_DIR=/opt/hadoop
43- container=new_client
44- client_version=${current_version}
4546 " $@ "
4647}
4748
@@ -60,7 +61,7 @@ _write() {
6061 execute_robot_test ${container} -N " xcompat-cluster-${cluster_version} -client-${client_version} -write" \
6162 -v CLIENT_VERSION:${client_version} \
6263 -v CLUSTER_VERSION:${cluster_version} \
63- -v SUFFIX: ${client_version} \
64+ -v TEST_DATA_DIR:/testdata \
6465 compatibility/write.robot
6566}
6667
@@ -71,87 +72,46 @@ _read() {
7172 -v CLIENT_VERSION:${client_version} \
7273 -v CLUSTER_VERSION:${cluster_version} \
7374 -v DATA_VERSION:${data_version} \
74- -v SUFFIX: ${data_version} \
75+ -v TEST_DATA_DIR:/testdata \
7576 compatibility/read.robot
7677}
7778
7879test_cross_compatibility () {
7980 echo " Starting ${cluster_version} cluster with COMPOSE_FILE=${COMPOSE_FILE} "
8081
81- OZONE_KEEP_RESULTS=true start_docker_env
82+ OZONE_KEEP_RESULTS=true start_docker_env 5
8283
8384 execute_command_in_container kms hadoop key create ${OZONE_BUCKET_KEY_NAME}
8485
8586 _init
8687
87- new_client _write
88- new_client _read ${current_version}
88+ # first write with client matching cluster version
89+ client_version= " ${cluster_version} " client _write
8990
9091 for client_version in " $@ " ; do
91- client=" old_client_${client_version// ./ _} "
92-
93- old_client _write
94- old_client _read ${client_version}
95-
96- old_client _read ${current_version}
97- new_client _read ${client_version}
92+ # skip write, since already done
93+ if [[ " ${client_version} " == " ${cluster_version} " ]]; then
94+ continue
95+ fi
96+ client _write
9897 done
9998
100- KEEP_RUNNING=false stop_docker_env
101- }
102-
103- test_ec_cross_compatibility () {
104- echo " Running Erasure Coded storage backward compatibility tests."
105- # local cluster_versions_with_ec="1.3.0 1.4.0 ${current_version}"
106- local cluster_versions_with_ec=" ${current_version} " # until HDDS-11334
107- # TODO: debug acceptance test failures for client versions 1.0.0 on secure clusters
108- local non_ec_client_versions=" 1.1.0 1.2.1"
109-
110- for cluster_version in ${cluster_versions_with_ec} ; do
111- export COMPOSE_FILE=new-cluster.yaml:clients.yaml cluster_version=${cluster_version}
112- OZONE_KEEP_RESULTS=true start_docker_env 5
113-
114- echo -n " Generating data locally... "
115- dd if=/dev/urandom of=/tmp/1mb bs=1048576 count=1 > /dev/null 2>&1
116- dd if=/dev/urandom of=/tmp/2mb bs=1048576 count=2 > /dev/null 2>&1
117- dd if=/dev/urandom of=/tmp/3mb bs=1048576 count=3 > /dev/null 2>&1
118- echo " done"
119- echo -n " Copy data into client containers... "
120- for container in $( docker ps --format ' {{.Names}}' | grep client) ; do
121- docker cp /tmp/1mb ${container} :/tmp/1mb
122- docker cp /tmp/2mb ${container} :/tmp/2mb
123- docker cp /tmp/3mb ${container} :/tmp/3mb
124- done
125- echo " done"
126- rm -f /tmp/1mb /tmp/2mb /tmp/3mb
127-
128-
129- local prefix=$( LC_CTYPE=C tr -dc ' [:alnum:]' < /dev/urandom | head -c 5 | tr ' [:upper:]' ' [:lower:]' )
130- OZONE_DIR=/opt/hadoop
131- new_client _kinit
132- execute_robot_test new_client --include setup-ec-data -N " xcompat-cluster-${cluster_version} -setup-data" -v prefix:" ${prefix} " ec/backward-compat.robot
133- OZONE_DIR=/opt/ozone
134-
135- for client_version in ${non_ec_client_versions} ; do
136- client=" old_client_${client_version// ./ _} "
137- unset OUTPUT_PATH
138- container=" ${client} " _kinit
139- execute_robot_test " ${client} " --include test-ec-compat -N " xcompat-cluster-${cluster_version} -client-${client_version} -read-${cluster_version} " -v prefix:" ${prefix} " ec/backward-compat.robot
99+ for client_version in " $@ " ; do
100+ for data_version in $( echo " $client_version " " $cluster_version " " $current_version " | xargs -n1 | sort -u) ; do
101+ client _read ${data_version}
140102 done
141-
142- KEEP_RUNNING=false stop_docker_env
143103 done
104+
105+ KEEP_RUNNING=false stop_docker_env
144106}
145107
146108create_results_dir
147109
148110# current cluster with various clients
149- COMPOSE_FILE=new-cluster.yaml:clients.yaml cluster_version=${current_version} test_cross_compatibility ${old_versions}
111+ COMPOSE_FILE=new-cluster.yaml:clients.yaml cluster_version=${current_version} test_cross_compatibility ${old_versions} ${current_version}
150112
151113# old cluster with clients: same version and current version
152114for cluster_version in ${old_versions} ; do
153115 export OZONE_VERSION=${cluster_version}
154- COMPOSE_FILE=old-cluster.yaml:clients.yaml test_cross_compatibility ${cluster_version}
116+ COMPOSE_FILE=old-cluster.yaml:clients.yaml test_cross_compatibility ${cluster_version} ${current_version}
155117done
156-
157- test_ec_cross_compatibility
0 commit comments