netcdf-c/ncdap_test/tst_zero_len_var.sh
Dennis Heimbigner 7223c4a5aa Avoid spurious test failures when servers fail.
re: https://github.com/Unidata/netcdf-c/issues/1451

The situation with the various DAP (and other) remote test
servers is currently in a state of flux.  For example, Unidata
admin is planning to forcibly shift the remote test server to
remotetest.unidata.ucar.edu soon.  In addition, the server
test.opendap.org has shown some recent instability.

The result is that various DAP (and byterange) tests can fail
unexpectedly. This is an irritant to users and reveals nothing
about test sucess or failure.

Solve by modifying tests to report server inaccessibility and
otherwise pretend to succeed.

This puts an onus on Unidata to detect such server failures, but
will not cause users to see spurious failures. [Note. Do similar
fix for netcdf-java]. The check is:
1. export SETX=1 to cause all the shell scripts to trace
2. search the log files for the phrase "WARNING" (in upper case)
and see if it is complaining about not finding a server.

Misc. Changes
-------------
1. Added a pingurl program to see if a server was up.
2. modified some test case url targets
2019-12-31 15:42:58 -07:00

40 lines
764 B
Bash
Executable File

#!/bin/sh
if test "x$SETX" != x ; then set -x; fi
set -e
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
##
# If the bug referenced in https://github.com/Unidata/netcdf-c/issues/1300
# reoccurs, then the following command would fail.
# Figure our server; if none, then just stop
SVCP=`${execdir}/pingurl test.opendap.org/opendap`
if test "x$SVCP" = xno ; then
echo "WARNING: test.opendap.org is not accessible";
exit 0;
fi
if test "x$SVCP" = xhttp ; then
URL="http://test.opendap.org/opendap"
else
URL="https://test.opendap.org/opendap"
fi
URL="${URL}/data/nc/zero_length_array.nc"
${NCDUMP} "$URL" > tst_zero_len_var.cdl
RES=$?
if [ $RES -ne 0 ]; then
echo "Error $RES"
exit $RES
fi
rm -f tst_zero_len_var.cdl
exit 0