Skip to content

Commit f639c57

Browse files
authored
HDDS-14896. Use separate container for clients in rolling-upgrade suite (#10032)
1 parent db2219f commit f639c57

8 files changed

Lines changed: 49 additions & 34 deletions

File tree

hadoop-ozone/dist/src/main/compose/common/init-kdc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ export_keytab HTTP/scm scm
3131
export_keytab testuser/scm scm
3232
export_keytab testuser2/scm scm
3333

34+
export_keytab testuser/client testuser
3435
export_keytab testuser/dn testuser
3536
export_keytab testuser/httpfs testuser
3637
export_keytab testuser/om testuser
3738
export_keytab testuser/recon testuser
3839
export_keytab testuser/s3g testuser
3940
export_keytab testuser/scm testuser
4041

42+
export_keytab testuser2/client testuser2
4143
export_keytab testuser2/dn testuser2
4244
export_keytab testuser2/httpfs testuser2
4345
export_keytab testuser2/om testuser2

hadoop-ozone/dist/src/main/compose/upgrade/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Docker compose cluster definitions to be used in upgrade testing are defined in
100100
- `SCM`: The name of the SCM container to run robot tests from.
101101
- This can be passed as the first argument to `execute_robot_test`.
102102
- This allows the same tests to work with and without SCM HA.
103+
- `CLIENT`: The dedicated client container used to run Robot tests in rolling-upgrade HA.
103104

104105
### Testing New Versions
105106

hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ services:
322322
- *krb5conf
323323
- *ozone-dir
324324
- *transformation
325+
client:
326+
command: ["sleep","1000000"]
327+
<<: *common-config
328+
hostname: client
329+
networks:
330+
net:
331+
ipv4_address: 10.9.0.27
332+
volumes:
333+
- *keytabs
334+
- *krb5conf
335+
- *ozone-dir
325336

326337
networks:
327338
net:

hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/load.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ set +u
2424
source "$TEST_DIR/testlib.sh"
2525

2626
export COMPOSE_FILE="$TEST_DIR/compose/ha/docker-compose.yaml"
27+
export CLIENT=client
2728
export OM_SERVICE_ID=omservice
2829
export SECURITY_ENABLED="true"
2930

hadoop-ozone/dist/src/main/compose/upgrade/testlib.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,18 @@ run_test() {
117117

118118
## @description Generates data on the cluster.
119119
## @param The prefix to use for data generated.
120-
## @param All parameters after the first one are passed directly to the robot command,
120+
## @param The container to run the robot test in.
121+
## @param All remaining parameters are passed directly to the robot command,
121122
## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options
122123
generate() {
123-
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-generate-${1}" -v PREFIX:"$1" ${@:2} upgrade/generate.robot
124+
execute_robot_test "${2}" -N "${OUTPUT_NAME}-generate-${1}" -v PREFIX:"$1" ${@:3} upgrade/generate.robot
124125
}
125126

126127
## @description Validates that data exists on the cluster.
127128
## @param The prefix of the data to be validated.
128-
## @param All parameters after the first one are passed directly to the robot command,
129+
## @param The container to run the robot test in.
130+
## @param All remaining parameters are passed directly to the robot command,
129131
## see https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options
130132
validate() {
131-
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-validate-${1}" -v PREFIX:"$1" ${@:2} upgrade/validate.robot
133+
execute_robot_test "${2}" -N "${OUTPUT_NAME}-validate-${1}" -v PREFIX:"$1" ${@:3} upgrade/validate.robot
132134
}

hadoop-ozone/dist/src/main/compose/upgrade/upgrades/non-rolling-upgrade/callbacks/common/callback.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,40 @@ source "$TEST_DIR"/testlib.sh
2121

2222
with_old_version() {
2323
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-check-finalization" --include finalized upgrade/check-finalization.robot
24-
generate old1
25-
validate old1
24+
generate old1 "$SCM"
25+
validate old1 "$SCM"
2626
}
2727

2828
with_this_version_pre_finalized() {
2929
# No check for pre-finalized status here, because the release may not have
3030
# added layout features to OM or HDDS.
31-
validate old1
31+
validate old1 "$SCM"
3232
# HDDS-6261: overwrite the same keys intentionally
33-
generate old1 --exclude create-volume-and-bucket
33+
generate old1 "$SCM" --exclude create-volume-and-bucket
3434

35-
generate new1
36-
validate new1
35+
generate new1 "$SCM"
36+
validate new1 "$SCM"
3737
}
3838

3939
with_old_version_downgraded() {
4040
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-check-finalization" --include finalized upgrade/check-finalization.robot
41-
validate old1
42-
validate new1
41+
validate old1 "$SCM"
42+
validate new1 "$SCM"
4343

44-
generate old2
45-
validate old2
44+
generate old2 "$SCM"
45+
validate old2 "$SCM"
4646

4747
# HDDS-6261: overwrite the same keys again to trigger the precondition check
4848
# that exists <= 1.1.0 OM
49-
generate old1 --exclude create-volume-and-bucket
49+
generate old1 "$SCM" --exclude create-volume-and-bucket
5050
}
5151

5252
with_this_version_finalized() {
5353
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-check-finalization" --include finalized upgrade/check-finalization.robot
54-
validate old1
55-
validate new1
56-
validate old2
54+
validate old1 "$SCM"
55+
validate new1 "$SCM"
56+
validate old2 "$SCM"
5757

58-
generate new2
59-
validate new2
58+
generate new2 "$SCM"
59+
validate new2 "$SCM"
6060
}

hadoop-ozone/dist/src/main/compose/upgrade/upgrades/rolling-upgrade/callbacks/common/callback.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ source "$TEST_DIR"/testlib.sh
2020
### CALLBACKS ###
2121

2222
before_service_restart() {
23-
generate "generate-${SERVICE}"
23+
generate "generate-${SERVICE}" "$CLIENT"
2424
}
2525

2626
after_service_restart() {
27-
validate "generate-${SERVICE}"
27+
validate "generate-${SERVICE}" "$CLIENT"
2828
}

hadoop-ozone/dist/src/main/compose/upgrade/upgrades/rolling-upgrade/driver.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set -u
2727
: "${OZONE_UPGRADE_TO}"
2828
: "${TEST_DIR}"
2929
: "${SCM}"
30+
: "${CLIENT}"
3031
: "${OZONE_CURRENT_VERSION}"
3132
set +u
3233

@@ -43,17 +44,6 @@ rolling_restart_service() {
4344
# Stop service
4445
stop_containers "${SERVICE}"
4546

46-
# Check if this SCM container is running, as during a rolling upgrade it does stop-start one-by-one and
47-
# we want to run write/read tests while one service is unavailable. Choose SCM (the container where the generate and
48-
# validate robot tests are running) considering availability.
49-
if [[ "$(docker inspect -f '{{.State.Running}}' "ha-${SCM}-1" 2>/dev/null)" != "true" ]]; then
50-
local fallback_scm
51-
fallback_scm="$(docker-compose --project-directory="$TEST_DIR/compose/ha" config --services | grep scm | grep -v "^${SCM}$" | head -n1)"
52-
if [[ -n "$fallback_scm" ]]; then
53-
export SCM="$fallback_scm"
54-
fi
55-
fi
56-
5747
callback before_service_restart
5848

5949
# Restart service with new image.
@@ -122,10 +112,18 @@ done
122112

123113
# TODO Add downgrade scenario
124114

115+
# Upgrade client after all server components are upgraded but before finalization,
116+
# so new client APIs can be exercised against pre-finalized servers.
117+
echo "--- UPGRADING CLIENT TO $OZONE_UPGRADE_TO ---"
118+
OUTPUT_NAME="${OZONE_UPGRADE_FROM}-${OZONE_UPGRADE_TO}-2-client"
119+
stop_containers "$CLIENT"
120+
prepare_for_image "${OZONE_UPGRADE_TO}"
121+
create_containers "$CLIENT"
122+
125123
echo "--- RUNNING WITH NEW VERSION $OZONE_UPGRADE_TO FINALIZED ---"
126124
OUTPUT_NAME="${OZONE_UPGRADE_FROM}-${OZONE_UPGRADE_TO}-3-finalized"
127125

128126
# TODO Add validation for pre-finalized state
129127

130128
# Sends commands to finalize OM and SCM.
131-
execute_robot_test "$SCM" -N "${OUTPUT_NAME}-finalize" upgrade/finalize.robot
129+
execute_robot_test "$CLIENT" -N "${OUTPUT_NAME}-finalize" upgrade/finalize.robot

0 commit comments

Comments
 (0)