Skip to content
Snippets Groups Projects
Commit 362ebf02 authored by Michael Davis's avatar Michael Davis
Browse files

[ci] Set EOS instance for eos commands called in grpc_dir_inject.sh

parent 5096490c
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
# Migration tools parameters
EOSINSTANCE=ctaeos
EOS_CMD="/usr/bin/eos root://${EOSINSTANCE}"
EOS_TEST_DIR_INJECT=/usr/bin/eos-test-dir-inject
CONFIG_FILE=/etc/cta/castor-migration.conf
TMPFILE=/tmp/eos-test-inject-sh.$$
......@@ -37,9 +39,11 @@ EOS_PREFIX=$(awk '/^eos.prefix[ ]/ { print $2 }' ${CONFIG_FILE})
# Ping the gRPC interface
${EOS_TEST_DIR_INJECT} ping || error "gRPC ping failed"
# Create the top-level directory. GNU coreutils "mkdir -p" does not return an error if the directory
# already exists; "eos mkdir -p" does return an error, which we explicitly ignore.
eos mkdir -p ${EOS_PREFIX} 2>/dev/null
# Create the top-level directory.
#
# Note: GNU coreutils "mkdir -p" does not return an error if the directory already exists;
# but "eos mkdir -p" does return an error.
${EOS_CMD} mkdir -p ${EOS_PREFIX}
# Create directory with system-assigned file id -- should succeed
echoc $LT_BLUE "Creating directory with auto-assigned file id"
......@@ -47,9 +51,10 @@ ${EOS_TEST_DIR_INJECT} --path ${CASTOR_PREFIX}/my_test_dir >${TMPFILE}
[ $? -eq 0 ] || error "Creating directory with auto-assigned file id failed"
json-pretty-print.sh ${TMPFILE}
rm ${TMPFILE}
eos ls -l ${EOS_PREFIX}
eos fileinfo ${EOS_PREFIX}/my_test_dir
eos rmdir ${EOS_PREFIX}/my_test_dir
${EOS_CMD} ls -l ${EOS_PREFIX}
${EOS_CMD} fileinfo ${EOS_PREFIX}/my_test_dir
XrdSecPROTOCOL=sss ${EOS_CMD} fileinfo ${EOS_PREFIX}/my_test_dir
${EOS_CMD} rmdir ${EOS_PREFIX}/my_test_dir
# Create directory with self-assigned file id -- should succeed
echoc $LT_BLUE "Creating directory with self-assigned file id"
......@@ -57,7 +62,7 @@ ${EOS_TEST_DIR_INJECT} --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir >
[ $? -eq 0 ] || error "Creating directory with self-assigned file id failed"
json-pretty-print.sh ${TMPFILE}
rm ${TMPFILE}
eos fileinfo ${EOS_PREFIX}/my_test_dir
${EOS_CMD} fileinfo ${EOS_PREFIX}/my_test_dir
# Try again -- should fail
echoc $LT_GREEN "Creating directory with the same file id (should fail)"
......@@ -66,12 +71,12 @@ ${EOS_TEST_DIR_INJECT} --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir2
# Remove and try again -- should succeed after restarting EOS
echoc $LT_GREEN "Remove the directory and restart EOS to remove the tombstone"
eos rmdir ${EOS_PREFIX}/my_test_dir
${EOS_CMD} rmdir ${EOS_PREFIX}/my_test_dir
echoc $LT_BLUE "Recreate the directory with self-assigned file id (should succeed this time)"
${EOS_TEST_DIR_INJECT} --fileid 9876543210 --path ${CASTOR_PREFIX}/my_test_dir >/dev/null
[ $? -eq 0 ] || error "Creating directory with self-assigned file id failed with error $?"
eos fileinfo ${EOS_PREFIX}/my_test_dir
${EOS_CMD} fileinfo ${EOS_PREFIX}/my_test_dir
echoc $LT_GREEN "Cleaning up: removing tombstones and removing injected directories"
eos rmdir ${EOS_PREFIX}/my_test_dir 2>/dev/null
eos rmdir ${EOS_PREFIX}/my_test_dir2 2>/dev/null
${EOS_CMD} rmdir ${EOS_PREFIX}/my_test_dir 2>/dev/null
${EOS_CMD} rmdir ${EOS_PREFIX}/my_test_dir2 2>/dev/null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment