84 lines
1.5 KiB
Bash
84 lines
1.5 KiB
Bash
![]() |
#!/bin/bash
|
||
|
|
||
|
# Test script for configuration wizard with default answers
|
||
|
# This provides automated input to test the wizard functionality
|
||
|
|
||
|
set -e
|
||
|
|
||
|
# Colors for output
|
||
|
RED='\033[0;31m'
|
||
|
GREEN='\033[0;32m'
|
||
|
YELLOW='\033[1;33m'
|
||
|
BLUE='\033[0;34m'
|
||
|
NC='\033[0m' # No Color
|
||
|
|
||
|
print_info() {
|
||
|
echo -e "${BLUE}[INFO]${NC} $1"
|
||
|
}
|
||
|
|
||
|
print_success() {
|
||
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||
|
}
|
||
|
|
||
|
print_error() {
|
||
|
echo -e "${RED}[ERROR]${NC} $1"
|
||
|
}
|
||
|
|
||
|
print_info "Testing configuration wizard with default answers..."
|
||
|
|
||
|
# Create input for the wizard
|
||
|
# This provides answers for all the questions the wizard will ask
|
||
|
cat > /tmp/wizard_input.txt << 'EOF'
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
127.0.0.1
|
||
|
3030
|
||
|
dev
|
||
|
4
|
||
|
n
|
||
|
n
|
||
|
n
|
||
|
y
|
||
|
EOF
|
||
|
|
||
|
print_info "Running wizard with test input..."
|
||
|
|
||
|
# Run the wizard with our input
|
||
|
if cd server && cargo run --bin simple_config_wizard --quiet < /tmp/wizard_input.txt; then
|
||
|
print_success "Wizard completed successfully!"
|
||
|
|
||
|
# Check if files were generated
|
||
|
if [ -f "../config.toml" ]; then
|
||
|
print_success "config.toml generated"
|
||
|
echo "First 10 lines of config.toml:"
|
||
|
head -n 10 ../config.toml
|
||
|
else
|
||
|
print_error "config.toml not found"
|
||
|
fi
|
||
|
|
||
|
# Check if Cargo.toml was updated
|
||
|
if grep -q "default = \[" Cargo.toml; then
|
||
|
print_success "Cargo.toml features updated"
|
||
|
echo "Default features:"
|
||
|
grep -A 2 "default = \[" Cargo.toml
|
||
|
else
|
||
|
print_error "Cargo.toml features not updated"
|
||
|
fi
|
||
|
|
||
|
else
|
||
|
print_error "Wizard failed!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Cleanup
|
||
|
rm -f /tmp/wizard_input.txt
|
||
|
|
||
|
print_success "Test completed!"
|