This is an automated email from the ASF dual-hosted git repository. sciabarracom pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/openserverless-testing.git
commit c38a82039609575dddfa52505f9ecf21cfaffe1d Author: Michele Sciabarra <[email protected]> AuthorDate: Fri Jul 3 17:21:38 2026 +0000 fixes to tests --- test-runtimes/javascript/minio.js | 7 ++++--- test-runtimes/python/minio.py | 12 +++++------- tests/14-runtime-testing.sh | 35 ++++++++++++++++------------------- tests/6-login.sh | 24 +++++++++++------------- tests/7-static.sh | 10 ++++++++-- tests/8-user-redis.sh | 26 +++++++------------------- tests/9a-user-ferretdb.sh | 26 +++++++------------------- tests/9b-user-postgres.sh | 26 +++++++------------------- tests/all.sh | 20 +++++++++++++++----- 9 files changed, 80 insertions(+), 106 deletions(-) diff --git a/test-runtimes/javascript/minio.js b/test-runtimes/javascript/minio.js index 9110199..c87fa67 100644 --- a/test-runtimes/javascript/minio.js +++ b/test-runtimes/javascript/minio.js @@ -33,11 +33,12 @@ async function main(args) { let bucketExists = await minioClient.bucketExists(bucketName); - if(!bucketExists) { - response.bucketOperation = await minioClient.makeBucket(bucketName, 'us-east-1'); + if(!bucketExists) { + throw new Error(`bucket ${bucketName} does not exist`); } - response.buckets = await minioClient.listBuckets(); + response.bucket = bucketName; + response.exists = bucketExists; return { "body": response } diff --git a/test-runtimes/python/minio.py b/test-runtimes/python/minio.py index 19d60ea..7ed3b5f 100644 --- a/test-runtimes/python/minio.py +++ b/test-runtimes/python/minio.py @@ -19,16 +19,14 @@ import boto3 from botocore.client import Config def main(args): - buckets = [] s3 = boto3.resource('s3', endpoint_url=f"http://{args.get('s3_host')}:{args.get('s3_port')}", aws_access_key_id=args.get("s3_access"), aws_secret_access_key=args.get("s3_secret"), config=Config(signature_version='s3v4'), region_name='us-east-1') - - for bucket in s3.buckets.all(): - buckets.append(bucket.name) - - response = {"body": buckets} - return response \ No newline at end of file + + bucket = args.get("s3_data") + s3.meta.client.head_bucket(Bucket=bucket) + response = {"body": {"bucket": bucket, "exists": True}} + return response diff --git a/tests/14-runtime-testing.sh b/tests/14-runtime-testing.sh index b5f5514..b132391 100755 --- a/tests/14-runtime-testing.sh +++ b/tests/14-runtime-testing.sh @@ -17,12 +17,21 @@ # under the License. TYPE="${1:?test type}" TYPE="$(echo $TYPE | awk -F- '{print $1}')" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TESTING_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" user="testactionuser" password=$(ops -random --str 12) +OBJECT_STORAGE_FLAG="" +if ops config status | grep -q OPERATOR_COMPONENT_SEAWEEDFS=true; then + OBJECT_STORAGE_FLAG="--seaweedfs" +elif ops config status | grep -q OPERATOR_COMPONENT_MINIO=true; then + OBJECT_STORAGE_FLAG="--minio" +fi + ops admin deleteuser $user 2>/dev/null || true -if ops admin adduser $user [email protected] $password --minio --redis --mongodb --postgres | grep "whiskuser.nuvolaris.org/$user created" +if ops admin adduser $user [email protected] $password $OBJECT_STORAGE_FLAG --redis --mongodb --postgres | grep "whiskuser.nuvolaris.org/$user created" then echo SUCCESS CREATING $user else echo FAIL CREATING $user; exit 1 fi @@ -31,21 +40,11 @@ ops util kube waitfor FOR=condition=ready OBJ="wsku/$user" TIMEOUT=600 -case "$TYPE" in - (kind) - if OPS_USER=$user OPS_PASSWORD=$password ops -login http://miniops.me | grep "Successfully logged in as $user." - then echo SUCCESS LOGIN - else echo FAIL LOGIN ; exit 1 - fi - ;; - *) - APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') - if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user." - then echo SUCCESS LOGIN - else echo FAIL LOGIN ; exit 1 - fi - ;; -esac +APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') +if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user." +then echo SUCCESS LOGIN +else echo FAIL LOGIN ; exit 1 +fi export S3_ACCESS_KEY=$(ops -config S3_ACCESS_KEY) export S3_SECRET_KEY=$(ops -config S3_SECRET_KEY) @@ -59,9 +58,7 @@ export MONGODB_URL=$(ops -config MONGODB_URL) export MONGODB_DB=$user export POSTGRES_URL=$(ops -config POSTGRES_URL) -PWD=$(pwd) - -if ops -wsk project deploy --manifest ${PWD}/test-runtimes/manifest.yaml | grep Success +if ops -wsk project deploy --manifest ${TESTING_DIR}/test-runtimes/manifest.yaml | grep Success then echo SUCCESS DEPLOY PROJECT; else echo FAIL DEPLOY PROJECT; exit 1 fi diff --git a/tests/6-login.sh b/tests/6-login.sh index 7e48ba4..8ca3013 100755 --- a/tests/6-login.sh +++ b/tests/6-login.sh @@ -23,27 +23,30 @@ password=$(ops -random --str 12) user="demouser" ENABLE_REDIS="" -if ops config status | grep OPERATOR_COMPONENT_REDIS=true; then +if ops config status | grep -q OPERATOR_COMPONENT_REDIS=true; then ENABLE_REDIS="--redis" fi ENABLE_MONGODB="" -if ops config status | grep OPERATOR_COMPONENT_MONGODB=true; then +if ops config status | grep -q OPERATOR_COMPONENT_MONGODB=true; then ENABLE_MONGODB="--mongodb" fi -ENABLE_MINIO="" -if ops config status | grep OPERATOR_COMPONENT_MINIO=true; then - ENABLE_MINIO="--minio" +ENABLE_OBJECT_STORAGE="" +if ops config status | grep -q OPERATOR_COMPONENT_SEAWEEDFS=true; then + ENABLE_OBJECT_STORAGE="--seaweedfs" +elif ops config status | grep -q OPERATOR_COMPONENT_MINIO=true; then + ENABLE_OBJECT_STORAGE="--minio" fi ENABLE_POSTGRES="" -if ops config status | grep OPERATOR_COMPONENT_POSTGRES=true; then +if ops config status | grep -q OPERATOR_COMPONENT_POSTGRES=true; then ENABLE_POSTGRES="--postgres" fi # Create a new user "demo-user" with ops admin adduser with previous services enabled -if ops admin adduser $user [email protected] $password $ENABLE_REDIS $ENABLE_MONGODB $ENABLE_MINIO $ENABLE_POSTGRES | grep "whiskuser.nuvolaris.org/$user created"; then +ops admin deleteuser $user >/dev/null 2>&1 || true +if ops admin adduser $user [email protected] $password $ENABLE_REDIS $ENABLE_MONGODB $ENABLE_OBJECT_STORAGE $ENABLE_POSTGRES | grep "whiskuser.nuvolaris.org/$user created"; then echo SUCCESS CREATING $user else echo FAIL CREATING $user @@ -52,12 +55,7 @@ fi ops util kube waitfor FOR=condition=ready OBJ="wsku/$user" TIMEOUT=120 -APIURL="http://localhost:3233" -# if type is not kind, get the APIURL from ops debug apihost -if [ "$TYPE" != "kind" ]; then - APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') -fi - +APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') echo $APIURL if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then echo SUCCESS LOGIN diff --git a/tests/7-static.sh b/tests/7-static.sh index 658c8f2..380620f 100755 --- a/tests/7-static.sh +++ b/tests/7-static.sh @@ -18,15 +18,21 @@ TYPE="${1:?test type}" TYPE="$(echo $TYPE | awk -F- '{print $1}')" -ops config enable --minio --static +ops config disable --minio +ops config enable --seaweedfs --static ops update apply ops util kube waitfor FOR=condition=ready OBJ=pod/nuvolaris-static-0 TIMEOUT=60 +ops setup nuvolaris wait-cm-value \ + JSONPATH='{.metadata.annotations.s3_provider}' \ + EXPECTED_VALUE='seaweedfs' \ + MESSAGE='Waiting for SeaweedFS S3 provider' user="demostaticuser" password=$(ops -random --str 12) -if ops admin adduser $user [email protected] $password --minio | grep "whiskuser.nuvolaris.org/$user created"; then +ops admin deleteuser $user >/dev/null 2>&1 || true +if ops admin adduser $user [email protected] $password --seaweedfs | grep "whiskuser.nuvolaris.org/$user created"; then echo SUCCESS CREATING $user else echo FAIL CREATING $user diff --git a/tests/8-user-redis.sh b/tests/8-user-redis.sh index a89158b..d9d5309 100755 --- a/tests/8-user-redis.sh +++ b/tests/8-user-redis.sh @@ -38,25 +38,13 @@ fi ops util kube waitfor FOR=condition=ready OBJ="wsku/$user" TIMEOUT=120 -case "$TYPE" in -kind) - if OPS_USER=$user OPS_PASSWORD=$password ops -login http://miniops.me | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -*) - APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') - if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -esac +APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') +if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then + echo SUCCESS LOGIN +else + echo FAIL LOGIN + exit 1 +fi if ops setup nuvolaris redis | grep hello; then echo SUCCESS SETUP REDIS ACTION diff --git a/tests/9a-user-ferretdb.sh b/tests/9a-user-ferretdb.sh index 2eccd2b..2d18473 100755 --- a/tests/9a-user-ferretdb.sh +++ b/tests/9a-user-ferretdb.sh @@ -38,25 +38,13 @@ fi ops util kube waitfor FOR=condition=ready OBJ="wsku/$user" TIMEOUT=120 -case "$TYPE" in -kind) - if OPS_USER=$user OPS_PASSWORD=$password ops -login http://miniops.me | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -*) - APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') - if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -esac +APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') +if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then + echo SUCCESS LOGIN +else + echo FAIL LOGIN + exit 1 +fi if ops setup nuvolaris mongodb | grep hello; then echo SUCCESS SETUP MONGODB ACTION diff --git a/tests/9b-user-postgres.sh b/tests/9b-user-postgres.sh index 0e88fde..8fc66b8 100755 --- a/tests/9b-user-postgres.sh +++ b/tests/9b-user-postgres.sh @@ -39,25 +39,13 @@ fi ops util kube waitfor FOR=condition=ready OBJ="wsku/$user" TIMEOUT=120 -case "$TYPE" in -kind) - if OPS_USER=$user OPS_PASSWORD=$password ops -login http://miniops.me | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -*) - APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') - if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then - echo SUCCESS LOGIN - else - echo FAIL LOGIN - exit 1 - fi - ;; -esac +APIURL=$(ops debug apihost | awk '/whisk API host/{print $4}') +if OPS_USER=$user OPS_PASSWORD=$password ops -login $APIURL | grep "Successfully logged in as $user."; then + echo SUCCESS LOGIN +else + echo FAIL LOGIN + exit 1 +fi if ops setup nuvolaris postgres | grep 'Nuvolaris Postgres is up and running!'; then echo SUCCESS SETUP POSTGRES ACTION diff --git a/tests/all.sh b/tests/all.sh index 30e9441..9d76ce0 100755 --- a/tests/all.sh +++ b/tests/all.sh @@ -18,9 +18,17 @@ TYPE="${1:?test type}" TYPE="$(echo $TYPE | awk -F- '{print $1}')" -# echo -export OPS_BRANCH=main -echo "*** using $OPS_BRANCH ***" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +OPEN_SERVERLESS_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +export OPS_BRANCH="${OPS_BRANCH:-main}" +if [ -d "$OPEN_SERVERLESS_ROOT/olaris" ]; then + export OPS_ROOT="${OPS_ROOT:-$OPEN_SERVERLESS_ROOT/olaris}" + export PATH="$OPEN_SERVERLESS_ROOT:$PATH" +fi + +echo "*** using OPS_BRANCH=$OPS_BRANCH ***" +echo "*** using OPS_ROOT=${OPS_ROOT:-default} ***" # if type not in (kind, k3s, mk8s, aks, eks, gke) exit @@ -35,6 +43,7 @@ case "$TYPE" in ;; esac +cd "$SCRIPT_DIR" rm -f _results collect() { if "$@" @@ -124,7 +133,7 @@ collect ./9b-user-postgres.sh $TYPE echo "##############################################" echo "# #" -echo "# TESTING USER MINIO $TYPE #" +echo "# TESTING USER SEAWEEDFS $TYPE #" echo "# #" echo "##############################################" collect ./10-user-seaweedfs.sh $TYPE @@ -136,4 +145,5 @@ echo "# #" echo "##############################################" collect ./14-runtime-testing.sh $TYPE -cat _results \ No newline at end of file +echo "============================================" +cat _results
