diff options
Diffstat (limited to 'test/kms')
| -rw-r--r-- | test/kms/docker-compose.yml | 2 | ||||
| -rwxr-xr-x | test/kms/setup_openbao.sh | 18 | ||||
| -rwxr-xr-x | test/kms/test_s3_kms.sh | 30 | ||||
| -rwxr-xr-x | test/kms/wait_for_services.sh | 16 |
4 files changed, 32 insertions, 34 deletions
diff --git a/test/kms/docker-compose.yml b/test/kms/docker-compose.yml index 47c5c9131..381d9fbb4 100644 --- a/test/kms/docker-compose.yml +++ b/test/kms/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: # OpenBao server for KMS integration testing openbao: diff --git a/test/kms/setup_openbao.sh b/test/kms/setup_openbao.sh index 8de49229f..dc8fdf6dd 100755 --- a/test/kms/setup_openbao.sh +++ b/test/kms/setup_openbao.sh @@ -15,7 +15,7 @@ echo "Transit Path: $TRANSIT_PATH" echo "⏳ Waiting for OpenBao to be ready..." for i in {1..30}; do if curl -s "$OPENBAO_ADDR/v1/sys/health" >/dev/null 2>&1; then - echo "✅ OpenBao is ready!" + echo "[OK] OpenBao is ready!" break fi echo " Attempt $i/30: OpenBao not ready yet, waiting..." @@ -24,7 +24,7 @@ done # Check if we can connect if ! curl -s -H "X-Vault-Token: $OPENBAO_TOKEN" "$OPENBAO_ADDR/v1/sys/health" >/dev/null; then - echo "❌ Cannot connect to OpenBao at $OPENBAO_ADDR" + echo "[FAIL] Cannot connect to OpenBao at $OPENBAO_ADDR" exit 1 fi @@ -68,9 +68,9 @@ for key_spec in "${TEST_KEYS[@]}"; do # Verify the key was created if curl -s -H "X-Vault-Token: $OPENBAO_TOKEN" "$OPENBAO_ADDR/v1/$TRANSIT_PATH/keys/$key_name" >/dev/null; then - echo " ✅ Key $key_name verified" + echo " [OK] Key $key_name verified" else - echo " ❌ Failed to create/verify key $key_name" + echo " [FAIL] Failed to create/verify key $key_name" exit 1 fi done @@ -93,12 +93,12 @@ ENCRYPT_RESPONSE=$(curl -s -X POST \ CIPHERTEXT=$(echo "$ENCRYPT_RESPONSE" | jq -r '.data.ciphertext') if [[ "$CIPHERTEXT" == "null" || -z "$CIPHERTEXT" ]]; then - echo " ❌ Encryption test failed" + echo " [FAIL] Encryption test failed" echo " Response: $ENCRYPT_RESPONSE" exit 1 fi -echo " ✅ Encryption successful: ${CIPHERTEXT:0:50}..." +echo " [OK] Encryption successful: ${CIPHERTEXT:0:50}..." # Decrypt DECRYPT_RESPONSE=$(curl -s -X POST \ @@ -111,13 +111,13 @@ DECRYPTED_B64=$(echo "$DECRYPT_RESPONSE" | jq -r '.data.plaintext') DECRYPTED_TEXT=$(echo "$DECRYPTED_B64" | base64 -d) if [[ "$DECRYPTED_TEXT" != "$TEST_PLAINTEXT" ]]; then - echo " ❌ Decryption test failed" + echo " [FAIL] Decryption test failed" echo " Expected: $TEST_PLAINTEXT" echo " Got: $DECRYPTED_TEXT" exit 1 fi -echo " ✅ Decryption successful: $DECRYPTED_TEXT" +echo " [OK] Decryption successful: $DECRYPTED_TEXT" echo "📊 OpenBao KMS setup summary:" echo " Address: $OPENBAO_ADDR" @@ -142,4 +142,4 @@ echo " --endpoint-url http://localhost:8333 \\" echo " --bucket test-bucket \\" echo " --server-side-encryption-configuration file://bucket-encryption.json" echo "" -echo "✅ OpenBao KMS setup complete!" +echo "[OK] OpenBao KMS setup complete!" diff --git a/test/kms/test_s3_kms.sh b/test/kms/test_s3_kms.sh index e8a282005..7b5444a84 100755 --- a/test/kms/test_s3_kms.sh +++ b/test/kms/test_s3_kms.sh @@ -96,9 +96,9 @@ aws s3 cp "s3://test-openbao/encrypted-object-1.txt" "$DOWNLOAD_FILE" \ # Verify content if cmp -s "$TEST_FILE" "$DOWNLOAD_FILE"; then - echo " ✅ Encrypted object 1 downloaded and decrypted successfully" + echo " [OK] Encrypted object 1 downloaded and decrypted successfully" else - echo " ❌ Encrypted object 1 content mismatch" + echo " [FAIL] Encrypted object 1 content mismatch" exit 1 fi @@ -108,9 +108,9 @@ aws s3 cp "s3://test-openbao/encrypted-object-2.txt" "$DOWNLOAD_FILE" \ # Verify content if cmp -s "$TEST_FILE" "$DOWNLOAD_FILE"; then - echo " ✅ Encrypted object 2 downloaded and decrypted successfully" + echo " [OK] Encrypted object 2 downloaded and decrypted successfully" else - echo " ❌ Encrypted object 2 content mismatch" + echo " [FAIL] Encrypted object 2 content mismatch" exit 1 fi @@ -127,7 +127,7 @@ echo "$METADATA" | jq '.' # Verify SSE headers are present if echo "$METADATA" | grep -q "ServerSideEncryption"; then - echo " ✅ SSE metadata found in object headers" + echo " [OK] SSE metadata found in object headers" else echo " ⚠️ No SSE metadata found (might be internal only)" fi @@ -160,9 +160,9 @@ aws s3 cp "s3://test-openbao/large-encrypted-file.txt" "$DOWNLOAD_LARGE_FILE" \ --endpoint-url "$SEAWEEDFS_S3_ENDPOINT" if cmp -s "$LARGE_FILE" "$DOWNLOAD_LARGE_FILE"; then - echo " ✅ Large encrypted file uploaded and downloaded successfully" + echo " [OK] Large encrypted file uploaded and downloaded successfully" else - echo " ❌ Large encrypted file content mismatch" + echo " [FAIL] Large encrypted file content mismatch" exit 1 fi @@ -197,14 +197,14 @@ rm -f "$PERF_FILE" "/tmp/perf-download.txt" echo "" echo "🎉 S3 KMS Integration Tests Summary:" -echo " ✅ Bucket creation and encryption configuration" -echo " ✅ Default bucket encryption" -echo " ✅ Explicit SSE-KMS encryption" -echo " ✅ Object upload and download" -echo " ✅ Encryption/decryption verification" -echo " ✅ Metadata handling" -echo " ✅ Multipart upload with encryption" -echo " ✅ Performance test" +echo " [OK] Bucket creation and encryption configuration" +echo " [OK] Default bucket encryption" +echo " [OK] Explicit SSE-KMS encryption" +echo " [OK] Object upload and download" +echo " [OK] Encryption/decryption verification" +echo " [OK] Metadata handling" +echo " [OK] Multipart upload with encryption" +echo " [OK] Performance test" echo "" echo "🔐 All S3 KMS integration tests passed successfully!" echo "" diff --git a/test/kms/wait_for_services.sh b/test/kms/wait_for_services.sh index 4e47693f1..2e72defc2 100755 --- a/test/kms/wait_for_services.sh +++ b/test/kms/wait_for_services.sh @@ -13,11 +13,11 @@ echo "🕐 Waiting for services to be ready..." echo " Waiting for OpenBao at $OPENBAO_ADDR..." for i in $(seq 1 $MAX_WAIT); do if curl -s "$OPENBAO_ADDR/v1/sys/health" >/dev/null 2>&1; then - echo " ✅ OpenBao is ready!" + echo " [OK] OpenBao is ready!" break fi if [ $i -eq $MAX_WAIT ]; then - echo " ❌ Timeout waiting for OpenBao" + echo " [FAIL] Timeout waiting for OpenBao" exit 1 fi sleep 1 @@ -27,11 +27,11 @@ done echo " Waiting for SeaweedFS Master at http://127.0.0.1:9333..." for i in $(seq 1 $MAX_WAIT); do if curl -s "http://127.0.0.1:9333/cluster/status" >/dev/null 2>&1; then - echo " ✅ SeaweedFS Master is ready!" + echo " [OK] SeaweedFS Master is ready!" break fi if [ $i -eq $MAX_WAIT ]; then - echo " ❌ Timeout waiting for SeaweedFS Master" + echo " [FAIL] Timeout waiting for SeaweedFS Master" exit 1 fi sleep 1 @@ -41,11 +41,11 @@ done echo " Waiting for SeaweedFS Volume Server at http://127.0.0.1:8080..." for i in $(seq 1 $MAX_WAIT); do if curl -s "http://127.0.0.1:8080/status" >/dev/null 2>&1; then - echo " ✅ SeaweedFS Volume Server is ready!" + echo " [OK] SeaweedFS Volume Server is ready!" break fi if [ $i -eq $MAX_WAIT ]; then - echo " ❌ Timeout waiting for SeaweedFS Volume Server" + echo " [FAIL] Timeout waiting for SeaweedFS Volume Server" exit 1 fi sleep 1 @@ -55,11 +55,11 @@ done echo " Waiting for SeaweedFS S3 API at $SEAWEEDFS_S3_ENDPOINT..." for i in $(seq 1 $MAX_WAIT); do if curl -s "$SEAWEEDFS_S3_ENDPOINT/" >/dev/null 2>&1; then - echo " ✅ SeaweedFS S3 API is ready!" + echo " [OK] SeaweedFS S3 API is ready!" break fi if [ $i -eq $MAX_WAIT ]; then - echo " ❌ Timeout waiting for SeaweedFS S3 API" + echo " [FAIL] Timeout waiting for SeaweedFS S3 API" exit 1 fi sleep 1 |
