test-helper/acl-migrate/check-ffs.sh

64 lines
4.5 KiB
Bash
Raw Normal View History

2024-07-16 17:47:56 +00:00
#!/bin/bash -x
source ./env
readarray -t arr < $CHECKFILE # read object and container ids
# check private container with object inside
CID=${arr[0]}
OID=${arr[1]}
frostfs-cli --config $FFSCONF object get --cid $CID --oid $OID --file out || exit 1 # allow owner to get object
frostfs-cli --config $FFSCONF object put --cid $CID --file $FILE --no-progress || exit 1 # allow owner to put object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID --file out && exit 1 # deny others to get object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --no-progress && exit 1 # deny others to put object
# check public read container with object inside
CID=${arr[2]}
OID=${arr[3]}
frostfs-cli --config $FFSCONF object get --cid $CID --oid $OID --file out || exit 1 # allow owner to get object
frostfs-cli --config $FFSCONF object put --cid $CID --file $FILE --no-progress || exit 1 # allow owner to put object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID --file out || exit 1 # allow others to get object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --no-progress && exit 1 # deny others to put object
# check public read write container with object inside
CID=${arr[4]}
OID=${arr[5]}
frostfs-cli --config $FFSCONF object get --cid $CID --oid $OID --file out || exit 1 # allow owner to get object
frostfs-cli --config $FFSCONF object put --cid $CID --file $FILE --no-progress || exit 1 # allow owner to put object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID --file out || exit 1 # allow others to get object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --no-progress || exit 1 # allow others to put object
# check allow get / put specific objects in container
CID=${arr[6]}
OID_S_ATTR=${arr[7]}
OID_C_ATTR=${arr[8]}
OID_S_NOATTR=${arr[9]}
OID_C_NOATTR=${arr[10]}
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_S_ATTR --file out || exit 1 # allow others to get small attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_C_ATTR --file out || exit 1 # allow others to get complex attr object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --attributes "Foo=Bar" --no-progress || exit 1 # allow others to put simple attr object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $COMPLEXFILE --attributes "Foo=Bar" --no-progress || exit 1 # allow others to put complex attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_S_NOATTR --file out && exit 1 # deny others to get small attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_C_NOATTR --file out && exit 1 # deny others to get complex attr object
# ! DIDN'T WORK v1.5.0 ! frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --no-progress && exit 1 # deny others to put simple attr object
# ! DIDN'T WORK v1.5.0 ! frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $COMPLEXFILE --no-progress && exit 1 # deny others to put complex attr object
# check deny get / put specific objects in container
CID=${arr[11]}
OID_S_ATTR=${arr[12]}
OID_C_ATTR=${arr[13]}
OID_S_NOATTR=${arr[14]}
OID_C_NOATTR=${arr[15]}
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_S_ATTR --file out && exit 1 # deny others to get small attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_C_ATTR --file out && exit 1 # deny others to get complex attr object
# ! DIDN'T WORK v1.5.0 ! frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --attributes "Foo=Bar" --no-progress && exit 1 # deny others to put simple attr object
# ! DIDN'T WORK v1.5.0 ! frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $COMPLEXFILE --attributes "Foo=Bar" --no-progress && exit 1 # deny others to put complex attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_S_NOATTR --file out || exit 1 # allow others to get small attr object
frostfs-cli --config $FFSCONFEXT object get --cid $CID --oid $OID_C_NOATTR --file out || exit 1 # allow others to get complex attr object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $FILE --no-progress || exit 1 # allow others to put simple attr object
frostfs-cli --config $FFSCONFEXT object put --cid $CID --file $COMPLEXFILE --no-progress || exit 1 # allow others to put complex attr object
rm out && exit 0