Skip to content

Commit

Permalink
Make int test for new and old services co-exist for a while (#216)
Browse files Browse the repository at this point in the history
Co-authored-by: Adrian Damian <[email protected]>
  • Loading branch information
andamian and Adrian Damian authored Feb 13, 2024
1 parent 40c1767 commit 9a68465
Show file tree
Hide file tree
Showing 27 changed files with 2,787 additions and 403 deletions.
7 changes: 5 additions & 2 deletions vos/test/scripts/README
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ at the CADC. These tests can only be executed at the CADC against that
service. The vos package must be installed before the these tests
are executed.

Environment variables (optional):
VOSPACE_WEBSERVICE = URL of the VOSpace service host (Default: "www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca")
Environment variables:
VOSPACE_WEBSERVICE (optional) = URL of the VOSpace service host (Default: "www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca")
CADC_TESTCERT_PATH (required) = Path to local directories containing 2 proxy certificates:
- cadc-auth.pem - proxy certificate of the owner of the vospace root directory
- cadc-auth-test.pem - proxy certificate of a valid user.
1 change: 0 additions & 1 deletion vos/test/scripts/something.props

This file was deleted.

16 changes: 8 additions & 8 deletions vos/test/scripts/vospace-all.tcsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
set THIS_DIR = `dirname $0`
set THIS_DIR = `cd $THIS_DIR && pwd`

echo "Enter path to the CADC test certificates"
echo -n "Cert path: "
set certpath = "$<"
setenv CADC_TESTCERT_PATH ${certpath}

echo "cert files path: $CADC_TESTCERT_PATH"
#echo "Enter path to the CADC test certificates"
#echo -n "Cert path: "
#set certpath = "$<"
#setenv CADC_TESTCERT_PATH ${certpath}
#
#echo "cert files path: $CADC_TESTCERT_PATH"
echo
echo "*** start all tests ***"
echo "vospace-client-atest.tcsh"
Expand All @@ -20,8 +20,8 @@ echo "vospace-delete-permission-atest.tcsh"
$THIS_DIR/vospace-delete-permission-atest.tcsh $args || echo "FAIL vospace-delete-permission-atest.tcsh" && exit -1
echo "vospace-vsync-atest.tcsh"
$THIS_DIR/vospace-vsync-atest.tcsh $args || echo "FAIL vospace-vsync-atest.tcsh" && exit -1
echo "vospace-quota-atest.tcsh"
$THIS_DIR/vospace-quota-atest.tcsh $args || echo "FAIL vospace-quota-atest.tcsh" && exit -1
#echo "vospace-quota-atest.tcsh"
#$THIS_DIR/vospace-quota-atest.tcsh $args || echo "FAIL vospace-quota-atest.tcsh" && exit -1
echo "vospace-link-atest.tcsh"
$THIS_DIR/vospace-link-atest.tcsh $args || echo "FAIL vospace-link-atest.tcsh" && exit -1
echo "vospace-read-permission-atest.tcsh"
Expand Down
114 changes: 55 additions & 59 deletions vos/test/scripts/vospace-client-atest.tcsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ else
endif

if (! ${?CADC_TESTCERT_PATH} ) then
echo "CADC_TESTCERT_PATH env variable not set. Must point to the location of x509_CADCRegtest1.pem cert file"
echo "Missing CADC_TESTCERT_PATH location to cadc-auth.pem and cadc-auth-test.pem files"
exit -1
else
set CERTFILE = "$CADC_TESTCERT_PATH/x509_CADCRegtest1.pem"
echo "cert file: (CADC_TESTCERT_PATH env variable): $CERTFILE"
echo "cert files path: ($CADC_TESTCERT_PATH env variable): $CADC_TESTCERT_PATH"
set CERT = "--cert=$CADC_TESTCERT_PATH/cadc-auth.pem"
endif

if (! ${?TMPDIR} ) then
Expand All @@ -26,14 +26,13 @@ else
echo "Using ${TMPDIR} for temporary files"
endif

set LSCMD = "vls -l"
set MKDIRCMD = "vmkdir"
set RMCMD = "vrm"
set CPCMD = "vcp"
set RMDIRCMD = "vrmdir"
set CHMODCMD = "vchmod"

set CERT = " --cert=$CERTFILE"
set LSCMD = "vls -l -k"
set MKDIRCMD = "vmkdir -k"
set RMCMD = "vrm -k"
set CPCMD = "vcp -k"
set RMDIRCMD = "vrmdir -k"
set CHMODCMD = "vchmod -k"
set VTAGCMD = 'vtag -k'

echo "vls command: " $LSCMD $CERT
echo
Expand All @@ -50,33 +49,30 @@ foreach resource ($resources)
echo "************* TESTING AGAINST $resource ****************"

# use resourceID in vos-config to determine the base URI
# vault uses CADCRegtest1, cavern uses home/cadcregtest1
echo $resource | grep "cavern" >& /dev/null
if ( $status == 0) then
set VOROOT = "arc:"
set HOME_BASE = "home/cadcregtest1"
set VOROOT = "cavern:"
set TESTING_CAVERN = "true"
else
set VOROOT = "vos:"
set HOME_BASE = "CADCRegtest1"

endif
set HOME_BASE = "vostools-inttest"
set VOHOME = "$VOROOT""$HOME_BASE"
set BASE = "$VOHOME/atest"
set BASE = $VOHOME

set TIMESTAMP=`date +%Y-%m-%dT%H-%M-%S`
set CONTAINER = $BASE/$TIMESTAMP


echo -n "** checking base URI"
$LSCMD $CERT $BASE > /dev/null
if ( $status == 0) then
echo " [OK]"
else
echo -n ", creating base URI"
exit
$MKDIRCMD $CERT $BASE || echo " [FAIL]" && exit -1
echo " [OK]"
endif
$RMCMD $CERT $BASE > /dev/null

# echo -n ", creating base URI"
# $MKDIRCMD $CERT $BASE || echo " [FAIL]" && exit -1
# $VTAGCMD $CERT $BASE 'ivo://cadc.nrc.ca/vospace/core#inheritPermissions=true'
# echo " [OK]"

echo -n "** setting home and base to public, no groups"
$CHMODCMD $CERT o+r $VOHOME || echo " [FAIL]" && exit -1
echo -n " [OK]"
Expand Down Expand Up @@ -107,43 +103,43 @@ foreach resource ($resources)

echo -n "verify public=false after create "
if ( ${?TESTING_CAVERN} ) then
echo " [SKIPPED, permission inheitance not supported]"
echo " [SKIPPED, permission inheritance not supported]"
else
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'drw----r--' || echo " [FAIL]" && exit -1
echo " [OK]"
endif

echo -n "check set permission properties "
if ( ${?TESTING_CAVERN} ) then
echo " [SKIPPED, permission inheitance not supported]"
echo " [SKIPPED, permission inheritance not supported]"
else
$CHMODCMD $CERT g+rw $CONTAINER test:g1 test:g2 || echo " [FAIL]" && exit -1
$CHMODCMD $CERT g+rw $CONTAINER test-g1 test-g2 || echo " [FAIL]" && exit -1
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'drw-rw-r--' || echo " [FAIL]" && exit -1
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'test:g1' || echo " [FAIL]" && exit -1
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'test:g2' || echo " [FAIL]" && exit -1
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'test-g1' || echo " [FAIL]" && exit -1
$LSCMD $CERT $BASE | grep $TIMESTAMP | grep -q 'test-g2' || echo " [FAIL]" && exit -1
echo " [OK]"
endif

echo -n "check inherit permission properties "
if ( ${?TESTING_CAVERN} ) then
echo " [SKIPPED, permission inheitance not supported]"
echo " [SKIPPED, permission inheritance not supported]"
else
$MKDIRCMD $CERT $CONTAINER/pub || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep pub | grep -q 'drw-rw-r--' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep pub | grep -q 'test:g1' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep pub | grep -q 'test:g2' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep pub | grep -q 'test-g1' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep pub | grep -q 'test-g2' || echo " [FAIL]" && exit -1
echo " [OK]"
endif

echo -n "check inherit + change certain properties "
if ( ${?TESTING_CAVERN} ) then
echo " [SKIPPED, permission inheitance not supported]"
echo " [SKIPPED, permission inheritance not supported]"
else
$MKDIRCMD $CERT $CONTAINER/priv || echo " [FAIL]" && exit -1
$CHMODCMD $CERT g+r $CONTAINER/priv test:g3 || echo " [FAIL]" && exit -1
$CHMODCMD $CERT g+r $CONTAINER/priv test-g3 || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep priv | grep -q 'drw-rw-r--' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep priv | grep -q 'test:g3' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep priv | grep -q 'test:g2' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep priv | grep -q 'test-g3' || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER | grep priv | grep -q 'test-g2' || echo " [FAIL]" && exit -1
echo " [OK]"
endif

Expand All @@ -159,24 +155,24 @@ foreach resource ($resources)
echo -n "copy empty files"
rm -f /tmp/zerosize.txt
touch /tmp/zerosize.txt
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL1]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null || echo " [FAIL]" && exit -1
# repeat
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL2]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null || echo " [FAIL]" && exit -1
# change size
echo "test" > /tmp/zerosize.txt
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL3]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null && echo " [FAIL]" && exit -1
# repeat
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL4]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null && echo " [FAIL]" && exit -1
# make it back 0 size
/bin/cp /dev/null /tmp/zerosize.txt
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL5]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null || echo " [FAIL]" && exit -1
# repeat
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL]" && exit -1
$CPCMD $CERT /tmp/zerosize.txt $CONTAINER || echo " [FAIL6]" && exit -1
$LSCMD $CERT $CONTAINER/zerosize.txt | awk '{print $5}'| grep "0" >& /dev/null || echo " [FAIL]" && exit -1
echo " [OK]"

Expand All @@ -187,8 +183,8 @@ foreach resource ($resources)
echo " [OK]"

echo -n "copy data node to local filesystem "
$CPCMD $CERT $CONTAINER/something.png $THIS_DIR/something.png.2 || echo " [FAIL]" && exit -1
cmp $THIS_DIR/something.png $THIS_DIR/something.png.2 || echo " [FAIL]" && exit -1
$CPCMD $CERT $CONTAINER/something.png $THIS_DIR/something.png.2 || echo " [FAIL1]" && exit -1
cmp $THIS_DIR/something.png $THIS_DIR/something.png.2 || echo " [FAIL2]" && exit -1
\rm -f $THIS_DIR/something.png.2
echo " [OK]"

Expand All @@ -210,7 +206,7 @@ foreach resource ($resources)
echo " [OK]"

echo -n "Do a real cutout of a known file"
#$CPCMD $CERT "vos:CADCRegtest1/DONOTDELETE_VOSPACE_CUTOUT_TEST.fits(34.436194,19.34665,0.01)" $TMPDIR/testcutout || echo " [FAIL]" && exit -1
#$CPCMD $CERT "vos:CADCAuthtest1/DONOTDELETE_VOSPACE_CUTOUT_TEST.fits(34.436194,19.34665,0.01)" $TMPDIR/testcutout || echo " [FAIL]" && exit -1
#if (`cat $TMPDIR/testcutout | md5` != "cb7d6a829277975d1016a769970ec45a") then
# echo " [FAIL]" && exit -1
#endif
Expand Down Expand Up @@ -251,19 +247,19 @@ foreach resource ($resources)
$RMCMD $CERT $CONTAINER/something.png >& /dev/null && echo " [FAIL]" && exit -1
echo " [OK]"

echo -n "delete non-empty container "
$RMDIRCMD $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER/something2.png >& /dev/null && echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER >& /dev/null && echo " [FAIL]" && exit -1
echo " [OK]"

echo -n "delete empty container "
$MKDIRCMD $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER > /dev/null || echo " [FAIL]" && exit -1
$RMDIRCMD $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
$LSCMD $CERT $CONTAINER >& /dev/null && echo " [FAIL]" && exit -1
echo " [OK]"
echo
# echo -n "delete non-empty container - THIS NOW REQURIES vrm -R INSTEAD"
# $RMCMD -R $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
# $LSCMD $CERT $CONTAINER/something2.png >& /dev/null && echo " [FAIL]" && exit -1
# $LSCMD $CERT $CONTAINER >& /dev/null && echo " [FAIL]" && exit -1
# echo " [OK]"

# echo -n "delete empty container "
# $MKDIRCMD $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
# $LSCMD $CERT $CONTAINER > /dev/null || echo " [FAIL]" && exit -1
# $RMDIRCMD $CERT $CONTAINER >& /dev/null || echo " [FAIL]" && exit -1
# $LSCMD $CERT $CONTAINER >& /dev/null && echo " [FAIL]" && exit -1
# echo " [OK]"
# echo
echo "*** test sequence passed for resource $resource ***"
end

Expand Down
51 changes: 30 additions & 21 deletions vos/test/scripts/vospace-delete-permission-atest.tcsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ else
endif

if (! ${?CADC_TESTCERT_PATH} ) then
echo "CADC_TESTCERT_PATH env variable not set. Must point to the location of test cert files"
exit -1
echo "Missing CADC_TESTCERT_PATH location to cadc-auth.pem and cadc-auth-test.pem files"
exit -1
else
echo "cert files path: ($CADC_TESTCERT_PATH env variable): $CADC_TESTCERT_PATH"
set CERT = "--cert=$CADC_TESTCERT_PATH/cadc-auth.pem"
set CERT1 = "--cert=$CADC_TESTCERT_PATH/cadc-auth-test.pem"
endif

if($#argv == 0) then
Expand All @@ -24,44 +26,50 @@ else
echo "Testing against resources: $resources"
endif

set CHMODCMD = "vchmod"
set MKDIRCMD = "vmkdir"
set LSCMD = "vls -l"
set CPCMD = "vcp"
set RMDIRCMD = "vrmdir"
set CHMODCMD = "vchmod -k"
set MKDIRCMD = "vmkdir -k"
set LSCMD = "vls -k -l"
set CPCMD = "vcp -k"
set RMDIRCMD = "vrmdir -k"
set RMCMD = "vrm -k"
set VTAGCMD = "vtag -k"

set CERT = "--cert=$CADC_TESTCERT_PATH/x509_CADCRegtest1.pem"
set CADC_TESTCERT_PATH = "/Users/adriand/A/test-certificates"
set CERT = "--cert=$CADC_TESTCERT_PATH/cadcproxy.pem"
set CERT1 = "--cert=$CADC_TESTCERT_PATH/x509_CADCAuthtest1.pem"
set CERT2 = "--cert=$CADC_TESTCERT_PATH/x509_CADCAuthtest2.pem"

echo "vchmod command: " $CHMODCMD $CERT
echo "vchmod command 1: " $CHMODCMD $CERT1
echo "vchmod command 2: " $CHMODCMD $CERT2

echo

# group 3000 aka CADC_TEST_GROUP1 has members: CADCAuthtest1
set GROUP1 = "CADC_TEST_GROUP1"

# group 3100 aka CADC_TEST_GROUP2 has members: CADCAuthtest1, CADCAuthtest2
set GROUP2 = "CADC_TEST_GROUP2"

echo "vchmod command: " $CHMODCMD $CERT
echo "vchmod command 1: " $CHMODCMD $CERT1

echo

foreach resource ($resources)
echo "************* TESTING AGAINST $resource ****************"

# vault uses CADCRegtest1, cavern uses home/cadcregtest1
echo $resource | grep "cavern" >& /dev/null
if ( $status == 0) then
set HOME_BASE = "home/cadcregtest1"
set VOROOT = "arc:"
set VOROOT = "cavern:"
set TESTING_CAVERN = "true"
else
set VOROOT = "vos:"
set HOME_BASE = "CADCRegtest1"
endif

set HOME_BASE = "vostools-inttest"
set VOHOME = "$VOROOT""$HOME_BASE"
set BASE = "$VOHOME/atest"
set BASE = $VOHOME

# echo -n ", creating base URI"
# $RMCMD -R $CERT $BASE > /dev/null
# $MKDIRCMD $CERT $BASE || echo " [FAIL]" && exit -1
# $VTAGCMD $CERT $BASE 'ivo://cadc.nrc.ca/vospace/core#inheritPermissions=true'
echo " [OK]"

set TIMESTAMP=`date +%Y-%m-%dT%H-%M-%S`
set CONTAINER = $BASE/$TIMESTAMP
Expand Down Expand Up @@ -130,7 +138,8 @@ foreach resource ($resources)
if ( ${?TESTING_CAVERN} ) then
echo " [SKIPPED, permission inheritance not supported]"
else
$RMDIRCMD $CERT1 $CONTAINER/sub1 >& /dev/null || echo " [FAIL]" && exit -1
echo "$RMCMD -R $CERT1 $CONTAINER/sub1"
$RMCMD -R $CERT1 $CONTAINER/sub1 >& /dev/null || echo " [FAIL]" && exit -1
echo -n " verify "
$LSCMD $CERT $CONTAINER/sub1 >& /dev/null && echo " [FAIL]" && exit -1
echo " [OK]"
Expand Down Expand Up @@ -159,7 +168,7 @@ foreach resource ($resources)
echo " [OK]"

echo -n "test root delete"
$RMDIRCMD $CERT $CONTAINER/sub1 >& /dev/null || echo " [FAIL]" && exit -1
$RMCMD -R $CERT $CONTAINER/sub1 >& /dev/null || echo " [FAIL]" && exit -1
echo -n " verify "
$LSCMD $CERT1 $CONTAINER/sub1 >& /dev/null && echo " [FAIL]" && exit -1
echo " [OK]"
Expand Down
Loading

0 comments on commit 9a68465

Please sign in to comment.