fix test
parent
a96dd88477
commit
d0041bc820
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue