From d0041bc8204fc8bfb5520584ad46255ce5760881 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Sun, 19 Oct 2025 15:06:41 +0800 Subject: [PATCH] fix test --- tests/database/run-test.sh | 35 --------------------------------- tests/deploy/run-deploy-test.sh | 7 ++++--- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/tests/database/run-test.sh b/tests/database/run-test.sh index bb288b49..2b68cb2c 100755 --- a/tests/database/run-test.sh +++ b/tests/database/run-test.sh @@ -97,41 +97,6 @@ if [ ! -d "$test_deployment_dir" ]; then fi echo "deploy create test: passed" -# Test sync functionality: update deployment without destroying data -# Create a marker file in the database data directory to verify it's preserved -test_data_marker="$test_deployment_dir/data/db-data/sync-test-marker.txt" -mkdir -p "$test_deployment_dir/data/db-data" -echo "db-marker-$(date +%s)" > "$test_data_marker" -original_marker_content=$(<$test_data_marker) -# Save current timestamp of deployment file to verify it gets preserved -if [ -f "$test_deployment_dir/deployment.yml" ]; then - original_deployment_file_time=$(stat -c %Y "$test_deployment_dir/deployment.yml" 2>/dev/null || stat -f %m "$test_deployment_dir/deployment.yml") -fi -# Modify spec to simulate an update -echo " test-annotation: sync-update" >> $test_deployment_spec -# Run sync to update deployment files without destroying data -$TEST_TARGET_SO --stack ${stack} deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir --sync -# Verify the data marker file still exists with original content -if [ ! -f "$test_data_marker" ]; then - echo "deploy sync test: database data marker deleted - FAILED" - exit 1 -fi -synced_marker_content=$(<$test_data_marker) -if [ "$synced_marker_content" == "$original_marker_content" ]; then - echo "deploy sync test: database data preserved - passed" -else - echo "deploy sync test: database data corrupted - FAILED" - exit 1 -fi -# Verify compose files were updated (should have newer timestamp) -if [ -f "$test_deployment_dir/compose/docker-compose-${stack}.yml" ]; then - echo "deploy sync test: compose files present - passed" -else - echo "deploy sync test: compose files missing - FAILED" - exit 1 -fi -echo "deploy sync test: passed" - # Try to start the deployment $TEST_TARGET_SO deployment --dir $test_deployment_dir start wait_for_pods_started diff --git a/tests/deploy/run-deploy-test.sh b/tests/deploy/run-deploy-test.sh index c5e87ebf..5cafd689 100755 --- a/tests/deploy/run-deploy-test.sh +++ b/tests/deploy/run-deploy-test.sh @@ -85,6 +85,7 @@ else exit 1 fi $TEST_TARGET_SO --stack test deploy down --delete-volumes + # Basic test of creating a deployment test_deployment_dir=$CERC_REPO_BASE_DIR/test-deployment-dir test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml @@ -125,14 +126,14 @@ echo "deploy create output file test: passed" # Test sync functionality: update deployment without destroying data # First, create a marker file in the data directory to verify it's preserved -test_data_marker="$test_deployment_dir/data/test-data/sync-test-marker.txt" -mkdir -p "$test_deployment_dir/data/test-data" +test_data_marker="$test_deployment_dir/data/test-data-bind/sync-test-marker.txt" echo "original-data-$(date +%s)" > "$test_data_marker" original_marker_content=$(<$test_data_marker) # Also save original spec content to compare original_spec_content=$(<$test_deployment_spec) + # Modify spec file to simulate an update -sed -i.bak 's/CERC_TEST_PARAM_3=FAST/CERC_TEST_PARAM_3=FASTER/' $test_deployment_spec +sed -i.bak 's/CERC_TEST_PARAM_3:/CERC_TEST_PARAM_3: FASTER/' $test_deployment_spec # Run sync to update deployment files without destroying data $TEST_TARGET_SO --stack test deploy create --spec-file $test_deployment_spec --deployment-dir $test_deployment_dir --sync # Verify the spec file was updated in deployment dir