mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
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
This commit is contained in:
parent
8f2be58d95
commit
7223c4a5aa
@ -1500,6 +1500,7 @@ AC_CONFIG_FILES(nc_test4/findplugin.sh:nc_test4/findplugin.in)
|
||||
AC_CONFIG_FILES(examples/C/findplugin.sh:nc_test4/findplugin.in)
|
||||
AC_CONFIG_FILES(ncdap_test/findtestserver.c:ncdap_test/findtestserver.c.in)
|
||||
AC_CONFIG_FILES(dap4_test/findtestserver4.c:ncdap_test/findtestserver.c.in)
|
||||
AC_CONFIG_FILES(dap4_test/pingurl4.c:ncdap_test/pingurl.c)
|
||||
AC_CONFIG_FILES([nc_test4/run_par_test.sh], [chmod ugo+x nc_test4/run_par_test.sh])
|
||||
AC_CONFIG_FILES([nc_perf/run_par_bm_test.sh], [chmod ugo+x nc_perf/run_par_bm_test.sh])
|
||||
AC_CONFIG_FILES([examples/C/run_par_test.sh], [chmod ugo+x examples/C/run_par_test.sh])
|
||||
|
@ -26,6 +26,7 @@ IF(ENABLE_DAP_REMOTE_TESTS)
|
||||
# Change name (add '4') to avoid cmake
|
||||
# complaint about duplicate targets.
|
||||
BUILD_BIN_TEST(findtestserver4)
|
||||
BUILD_BIN_TEST(pingurl4)
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLE_TESTS)
|
||||
|
@ -46,8 +46,9 @@ test_data.log: test_meta.log
|
||||
if ENABLE_DAP_REMOTE_TESTS
|
||||
# Note: This program name was changed to findtestserver4
|
||||
# to avoid cmake complaint about duplicate targets.
|
||||
noinst_PROGRAMS = findtestserver4
|
||||
noinst_PROGRAMS = findtestserver4 pingurl4
|
||||
findtestserver4_SOURCES = findtestserver4.c
|
||||
pingurl4_SOURCES = pingurl4.c
|
||||
endif
|
||||
|
||||
if ENABLE_DAP_REMOTE_TESTS
|
||||
|
@ -18,6 +18,8 @@ See \ref copyright file for more info.
|
||||
|
||||
#undef FINDTESTSERVER_DEBUG
|
||||
|
||||
enum KIND {NOKIND, DAP2KIND, DAP4KIND, THREDDSKIND};
|
||||
|
||||
#define MAXSERVERURL 4096
|
||||
#define TIMEOUT 10 /*seconds*/
|
||||
#define BUFSIZE 8192 /*bytes*/
|
||||
@ -28,6 +30,7 @@ See \ref copyright file for more info.
|
||||
#endif
|
||||
|
||||
static int ping(const char* url);
|
||||
static int timedping(const char* url, long timeout);
|
||||
|
||||
static char**
|
||||
parseServers(const char* remotetestservers)
|
||||
@ -73,8 +76,8 @@ This indicates that the server is up and running.
|
||||
Return the complete url for the server plus the path.
|
||||
*/
|
||||
|
||||
static char*
|
||||
nc_findtestserver(const char* path, int isdap4, const char* serverlist)
|
||||
char*
|
||||
nc_findtestserver(const char* path, const char* serverlist)
|
||||
{
|
||||
char** svclist;
|
||||
char** svc;
|
||||
@ -153,8 +156,15 @@ done:
|
||||
See if a server is responding.
|
||||
Return NC_ECURL if the ping fails, NC_NOERR otherwise
|
||||
*/
|
||||
|
||||
static int
|
||||
ping(const char* url)
|
||||
{
|
||||
return timedping(url,TIMEOUT);
|
||||
}
|
||||
|
||||
static int
|
||||
timedping(const char* url, long timeout)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
CURLcode cstat = CURLE_OK;
|
||||
@ -172,7 +182,7 @@ ping(const char* url)
|
||||
CERR((curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)));
|
||||
|
||||
/* use a very short timeout: 10 seconds */
|
||||
CERR((curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)TIMEOUT)));
|
||||
CERR((curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)timeout)));
|
||||
|
||||
/* fail on HTTP 400 code errors */
|
||||
CERR((curl_easy_setopt(curl, CURLOPT_FAILONERROR, (long)1)));
|
||||
|
@ -1,4 +1,4 @@
|
||||
netcdf \2004050300_eta_211 {
|
||||
netcdf \2004050412_eta_211 {
|
||||
dimensions:
|
||||
record = UNLIMITED ; // (1 currently)
|
||||
x = 135 ;
|
||||
|
@ -6,7 +6,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
set -e
|
||||
|
||||
#Constants
|
||||
URL3="http://149.165.169.123:8080/thredds/fileServer/testdata/2004050300_eta_211.nc#bytes"
|
||||
URL3="https://remotetest.unidata.ucar.edu/thredds/fileServer/testdata/2004050412_eta_211.nc#bytes"
|
||||
URL4="http://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadC/2017/059/03/OR_ABI-L1b-RadC-M3C13_G16_s20170590337505_e20170590340289_c20170590340316.nc#mode=bytes"
|
||||
|
||||
# See if netcdf-4 support is enabled
|
||||
|
@ -17,6 +17,7 @@ FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSION
|
||||
|
||||
IF(ENABLE_DAP_REMOTE_TESTS)
|
||||
BUILD_BIN_TEST(findtestserver)
|
||||
BUILD_BIN_TEST(pingurl)
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLE_TESTS)
|
||||
@ -54,6 +55,7 @@ IF(ENABLE_TESTS)
|
||||
ENDIF()
|
||||
|
||||
add_bin_test(ncdap test_varm3)
|
||||
add_bin_test(ncdap test_nstride_cached)
|
||||
|
||||
###
|
||||
# This test relates to NCF-330 in
|
||||
|
@ -38,8 +38,9 @@ endif
|
||||
# because the server may be down or inaccessible
|
||||
|
||||
if ENABLE_DAP_REMOTE_TESTS
|
||||
noinst_PROGRAMS = findtestserver
|
||||
noinst_PROGRAMS = findtestserver pingurl
|
||||
findtestserver_SOURCES = findtestserver.c
|
||||
pingurl_SOURCES = pingurl.c
|
||||
endif
|
||||
|
||||
if ENABLE_DAP_REMOTE_TESTS
|
||||
@ -54,20 +55,22 @@ if ENABLE_DAP_LONG_TESTS
|
||||
endif
|
||||
|
||||
test_partvar_SOURCES = test_partvar.c
|
||||
test_varm3_SOURCES = test_varm3.c
|
||||
test_nstride_cached_SOURCES = test_nstride_cached.c
|
||||
|
||||
t_misc_SOURCES = t_misc.c
|
||||
|
||||
TESTS += test_varm3
|
||||
|
||||
#TESTS += t_ncf330
|
||||
TESTS += test_nstride_cached
|
||||
TESTS += t_misc
|
||||
|
||||
check_PROGRAMS += test_partvar
|
||||
test_nstride_cached_SOURCES = test_nstride_cached.c
|
||||
TESTS += test_nstride_cached
|
||||
check_PROGRAMS += test_nstride_cached
|
||||
check_PROGRAMS += t_misc
|
||||
test_varm3_SOURCES = test_varm3.c
|
||||
TESTS += test_varm3
|
||||
check_PROGRAMS += test_varm3
|
||||
|
||||
check_PROGRAMS += test_partvar
|
||||
check_PROGRAMS += t_misc
|
||||
check_PROGRAMS += t_ncf330
|
||||
|
||||
if ENABLE_DAP_AUTH_TESTS
|
||||
|
@ -48,7 +48,10 @@ main(int argc, char** argv)
|
||||
const char* servlet = NULL;
|
||||
const char* proto = NULL;
|
||||
char* serverlist = NULL;
|
||||
int isdap4 = 0; /* 1 => dap4 */
|
||||
enum KIND kind = NOKIND;
|
||||
|
||||
kind = kind;
|
||||
proto = proto;
|
||||
|
||||
argc--; argv++;
|
||||
if(argc < 2)
|
||||
@ -59,13 +62,16 @@ main(int argc, char** argv)
|
||||
serverlist = strdup(argv[2]);
|
||||
|
||||
#ifdef ENABLE_DAP
|
||||
if(strcasecmp(proto,"thredds")==0)
|
||||
kind = THREDDSKIND;
|
||||
else
|
||||
if(strcasecmp(proto,"dap2")==0)
|
||||
isdap4 = 0;
|
||||
kind = DAP2KIND;
|
||||
else
|
||||
#endif
|
||||
#ifdef ENABLE_DAP4
|
||||
if(strcasecmp(proto,"dap4")==0)
|
||||
isdap4 = 1;
|
||||
kind = DAP4KIND;
|
||||
else
|
||||
#endif
|
||||
usage();
|
||||
@ -75,13 +81,14 @@ main(int argc, char** argv)
|
||||
serverlist = strdup(REMOTETESTSERVERS);
|
||||
#endif
|
||||
}
|
||||
if(serverlist == NULL || strlen(serverlist) == 0)
|
||||
fprintf(stderr,"Cannot determine a server list");
|
||||
|
||||
url = nc_findtestserver(servlet,isdap4,serverlist);
|
||||
if(serverlist == NULL || strlen(serverlist) == 0) {
|
||||
fprintf(stderr,"WARNING: Cannot determine a server list\n");
|
||||
exit(0);
|
||||
}
|
||||
url = nc_findtestserver(servlet,serverlist);
|
||||
if(url == NULL) {
|
||||
url = "";
|
||||
fprintf(stderr,"not found: %s\n",servlet);
|
||||
fprintf(stderr,"not found: %s\n",servlet);
|
||||
}
|
||||
printf("%s",url);
|
||||
fflush(stdout);
|
||||
|
60
ncdap_test/pingurl.c
Normal file
60
ncdap_test/pingurl.c
Normal file
@ -0,0 +1,60 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "nctestserver.h"
|
||||
|
||||
#define PINGTIME 25
|
||||
|
||||
/**
|
||||
usage: pingurl <svc>
|
||||
See if a specific server at a given url appears to be up.
|
||||
*/
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,"usage: pingurl <svc>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
char url[MAXSERVERURL+1];
|
||||
int found = 0;
|
||||
int ishttps = 0;
|
||||
|
||||
argc--; argv++;
|
||||
if(argc < 1)
|
||||
usage();
|
||||
|
||||
/* Try http: first */
|
||||
snprintf(url,MAXSERVERURL,"http://%s",argv[0]);
|
||||
if(timedping(url,PINGTIME) == NC_NOERR)
|
||||
found = 1;
|
||||
else {
|
||||
/* Try https: next */
|
||||
snprintf(url,MAXSERVERURL,"https://%s",argv[0]);
|
||||
if(timedping(url,PINGTIME) == NC_NOERR) {
|
||||
found = 1;
|
||||
ishttps = 1;
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
printf((ishttps?"https\n":"http\n"));
|
||||
else
|
||||
printf("no\n");
|
||||
exit(0);
|
||||
}
|
@ -73,7 +73,12 @@ main(int argc, char** argv)
|
||||
|
||||
fprintf(stderr,"Testing: Authorization\n");
|
||||
|
||||
dfaltsvc = nc_findtestserver("thredds",0,REMOTETESTSERVERS);
|
||||
dfaltsvc = nc_findtestserver("thredds",REMOTETESTSERVERS);
|
||||
if(svc == NULL) {
|
||||
fprintf(stderr,"WARNING: Cannot locate test server\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
snprintf(url1,sizeof(url1),URL1,USERPWD,dfaltsvc); /* embedded */
|
||||
snprintf(url2,sizeof(url2),URL2,dfaltsvc); /* using rc file */
|
||||
|
||||
|
@ -50,12 +50,12 @@ main()
|
||||
#endif
|
||||
|
||||
if(serverlist == NULL || strlen(serverlist) == 0) {
|
||||
fprintf(stderr,"Cannot determine a server list");
|
||||
exit(1);
|
||||
fprintf(stderr,"WARNING: Cannot determine a server list");
|
||||
exit(0);
|
||||
}
|
||||
svcurl = nc_findtestserver(servlet,0,serverlist);
|
||||
svcurl = nc_findtestserver(servlet,serverlist);
|
||||
if(svcurl == NULL) {
|
||||
fprintf(stderr,"not found: %s\n",servlet);
|
||||
fprintf(stderr,"WARNING: Server not found: %s\n",servlet);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,10 @@ main()
|
||||
char* svc;
|
||||
|
||||
/* Find Test Server */
|
||||
svc = nc_findtestserver("thredds",0,REMOTETESTSERVERS);
|
||||
svc = nc_findtestserver("thredds",REMOTETESTSERVERS);
|
||||
|
||||
if(svc == NULL) {
|
||||
fprintf(stderr,"Cannot locate test server\n");
|
||||
fprintf(stderr,"WARNING: Cannot locate test server\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -110,10 +110,10 @@ main()
|
||||
char* svc = NULL;
|
||||
|
||||
/* Find Test Server */
|
||||
svc = nc_findtestserver("dts",0,REMOTETESTSERVERS);
|
||||
svc = nc_findtestserver("dts",REMOTETESTSERVERS);
|
||||
|
||||
if(svc == NULL) {
|
||||
fprintf(stderr,"Cannot locate test server\n");
|
||||
fprintf(stderr,"WARNING: Cannot locate test server\n");
|
||||
exit(0);
|
||||
}
|
||||
strncpy(url,PARAMS,sizeof(url));
|
||||
|
@ -99,10 +99,10 @@ main()
|
||||
char url[4096];
|
||||
|
||||
/* Find Test Server */
|
||||
svc = nc_findtestserver("dts",0, REMOTETESTSERVER);
|
||||
svc = nc_findtestserver("dts",REMOTETESTSERVER);
|
||||
|
||||
if(svc == NULL) {
|
||||
fprintf(stderr,"Cannot locate test server\n");
|
||||
fprintf(stderr,"WARNING: Cannot locate test server\n");
|
||||
exit(1);
|
||||
}
|
||||
strncpy(url,PARAMS,sizeo(url));
|
||||
|
@ -95,10 +95,10 @@ main()
|
||||
#endif
|
||||
|
||||
/* Find Test Server */
|
||||
svc = nc_findtestserver("thredds",0,REMOTETESTSERVERS);
|
||||
svc = nc_findtestserver("thredds",REMOTETESTSERVERS);
|
||||
|
||||
if(svc == NULL) {
|
||||
fprintf(stderr,"Cannot locate test server\n");
|
||||
fprintf(stderr,"WARNING: Cannot locate test server\n");
|
||||
exit(0);
|
||||
}
|
||||
strncpy(url,svc,sizeof(url));
|
||||
|
@ -23,7 +23,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
DTS=`${execdir}/findtestserver dap2 dts`
|
||||
if test "x$DTS" = "x" ; then
|
||||
echo "WARNING: Cannot locate test server for dts"
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OCLOGFILE=stderr
|
||||
|
@ -12,7 +12,7 @@ set -e
|
||||
# Figure our dst server
|
||||
DTS=`./findtestserver dap2 dts`
|
||||
if test "x$DTS" = "x" ; then
|
||||
echo "cannot locate test server for dts"
|
||||
echo "WARNING: cannot locate test server for dts"
|
||||
exit
|
||||
fi
|
||||
URL="$DTS/test.03"
|
||||
|
@ -10,8 +10,8 @@ timing=0
|
||||
# Figure our dst server; if none, then just stop
|
||||
TESTSERVER=`${execdir}/findtestserver dap2 dts`
|
||||
if test "x$TESTSERVER" = "x" ; then
|
||||
echo "***XFAIL: Cannot locate test server for dts"
|
||||
exit 1
|
||||
echo "***WARNING: Cannot locate test server for dts"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PARAMS="[log]"
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
##################################################
|
||||
# Remote test info
|
||||
##################################################
|
||||
@ -11,7 +12,7 @@
|
||||
DTS=`${execdir}/findtestserver dap2 dts`
|
||||
if test "x$DTS" = "x" ; then
|
||||
echo "WARNING: Cannot locate test server for dts"
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test "x$timing" = "x1" ; then TIMECMD="time"; else TIMECMD=""; fi
|
||||
|
@ -10,7 +10,22 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
# If the bug referenced in https://github.com/Unidata/netcdf-c/issues/1300
|
||||
# reoccurs, then the following command would fail.
|
||||
|
||||
${NCDUMP} http://test.opendap.org/opendap/data/nc/zero_length_array.nc > tst_zero_len_var.cdl
|
||||
# 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=$?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user