|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved. |
| 4 | +# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. |
| 5 | + |
| 6 | +# |
| 7 | +# Description: |
| 8 | +# ------------ |
| 9 | +# |
| 10 | +# This helper utility tests the operator's wl version check code. |
| 11 | +# It's intended to be run on an image with an oracle install |
| 12 | +# and assumes the ORACLE_HOME env var has been set. |
| 13 | +# |
| 14 | +# Usage: |
| 15 | +# ------ |
| 16 | +# |
| 17 | +# ./util_testwlversion.sh input_file_name output_dir |
| 18 | +# |
| 19 | + |
| 20 | +traceFile=/weblogic-operator/scripts/traceUtils.sh |
| 21 | +source ${traceFile} |
| 22 | +[ $? -ne 0 ] && echo "Error: missing file ${traceFile}" && exit 1 |
| 23 | + |
| 24 | +test_checkWebLogicVersion() |
| 25 | +{ |
| 26 | + local testout="/tmp/unit_test_checkWebLogicVersion" |
| 27 | + rm -f $testout |
| 28 | + ( |
| 29 | + |
| 30 | + local WLVER="12.2.1.3" |
| 31 | + versionGE "$WLVER" "12.2.1.3" || echo "ERROR not GE 12.2.1.3" |
| 32 | + versionGE "$WLVER" "12.2.1.2" || echo "ERROR not GE 12.2.1.2" |
| 33 | + versionGE "$WLVER" "11" || echo "ERROR not GE 11.9.9" |
| 34 | + versionGE "$WLVER" "11.9.9" || echo "ERROR not GE 11.9.9" |
| 35 | + versionGE "$WLVER" "11.9.9.9" || echo "ERROR not GE 11.9.9.9" |
| 36 | + versionEQ "$WLVER" "12.2.1.3" || echo "ERROR not EQ 12.2.1.3" |
| 37 | + versionGE "$WLVER" "12.2.1.4" && echo "ERROR GE 12.2.1.4" |
| 38 | + versionEQ "$WLVER" "12.2.1" || echo "ERROR EQ 12.2.1" |
| 39 | + versionEQ "$WLVER" "12.2.1.4" && echo "ERROR EQ 12.2.1.4" |
| 40 | + versionEQ "$WLVER" "12.2.1.2" && echo "ERROR EQ 12.2.1.2" |
| 41 | + # hasWebLogicPatches returns success if entire inventory file is missing |
| 42 | + hasWebLogicPatches 999767676 && echo "ERROR has impossible patch" |
| 43 | + local WLVER="`getWebLogicVersion`" |
| 44 | + # WLVER will be 9999.9999.9999.9999 if the version can't be retrieved |
| 45 | + versionGE "$WLVER" "888" && echo "ERROR could not get WLVER, got $WLVER" |
| 46 | + versionGE "$WLVER" "12.2.1.3" || echo "ERROR wl version too low, got $WLVER" |
| 47 | + checkWebLogicVersion |
| 48 | + |
| 49 | + ) 2<&1 > $testout 2>&1 |
| 50 | + cat $testout |
| 51 | + grep --silent -i ERROR $testout && return 1 |
| 52 | + rm -f $testout |
| 53 | + return 0 |
| 54 | +} |
| 55 | + |
| 56 | +# TBD move this to the unit test script |
| 57 | +test_checkWebLogicVersion || exit 1 |
| 58 | +trace Test passed. |
| 59 | +exit 0 |
0 commit comments