dombizita commented on code in PR #9877:
URL: https://github.com/apache/ozone/pull/9877#discussion_r2988105925


##########
hadoop-ozone/dist/src/main/compose/upgrade/upgrades/rolling-upgrade/driver.sh:
##########
@@ -0,0 +1,134 @@
+#!/usr/bin/env bash
+# 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.
+
+# This script tests upgrade from a previous release to the current
+# binaries.  Docker image with Ozone binaries is required for the
+# initial version, while the snapshot version uses Ozone runner image.
+
+set -e -o pipefail
+
+# Fail if required vars are not set.
+set -u
+: "${OZONE_UPGRADE_FROM}"
+: "${OZONE_UPGRADE_TO}"
+: "${TEST_DIR}"
+: "${SCM}"
+: "${OZONE_CURRENT_VERSION}"
+set +u
+
+echo "--- RUNNING ROLLING UPGRADE TEST FROM $OZONE_UPGRADE_FROM TO 
$OZONE_UPGRADE_TO ---"
+
+source "$TEST_DIR"/testlib.sh
+
+# Restart one service with the target image.
+rolling_restart_service() {
+  SERVICE="$1"
+
+  echo "--- RESTARTING ${SERVICE} WITH IMAGE ${OZONE_UPGRADE_TO} ---"
+
+  # Stop service
+  stop_containers "${SERVICE}"
+
+  # Check if this SCM container is running, as during a rolling upgrade it 
does stop-start one-by-one and
+  # we want to run write/read tests while one service is unavailable. Choose 
SCM (the container where the generate and
+  # validate robot tests are running) considering availability.
+  if [[ "$(docker inspect -f '{{.State.Running}}' "ha-${SCM}-1" 2>/dev/null)" 
!= "true" ]]; then
+    local fallback_scm
+    fallback_scm="$(docker-compose --project-directory="$TEST_DIR/compose/ha" 
config --services | grep scm | grep -v "^${SCM}$" | head -n1)"
+    if [[ -n "$fallback_scm" ]]; then
+      export SCM="$fallback_scm"
+    fi
+  fi

Review Comment:
   Thanks, this is a good idea, filed 
[HDDS-14896](https://issues.apache.org/jira/browse/HDDS-14896).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to