Projekt hinzugefügt
This commit is contained in:
109
test.sh
Normal file
109
test.sh
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script for simulating the customer installer functionality
|
||||
# This script mocks the Proxmox pct commands for testing on standard Linux systems
|
||||
|
||||
# Mock functions for Proxmox commands
|
||||
pct() {
|
||||
echo "Mock pct command called with arguments: $*"
|
||||
case "$1" in
|
||||
create)
|
||||
echo "Creating LXC container with CTID: $2"
|
||||
echo " - Hostname: customer-$2"
|
||||
echo " - Memory: 2048 MB"
|
||||
echo " - Cores: 2"
|
||||
echo " - Network: eth0, bridge=vmbr0"
|
||||
echo " - Unprivileged: 1"
|
||||
echo " - Features: nesting=1"
|
||||
echo " - Storage: $4"
|
||||
;;
|
||||
exec)
|
||||
echo "Executing command in container $2:"
|
||||
shift 2
|
||||
echo " Command: $*"
|
||||
;;
|
||||
start)
|
||||
echo "Starting container $2"
|
||||
;;
|
||||
push)
|
||||
echo "Pushing file $3 to container $2"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown pct command: $1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Mock pveam commands
|
||||
pveam() {
|
||||
echo "Mock pveam command called with arguments: $*"
|
||||
case "$1" in
|
||||
update)
|
||||
echo "Updating Proxmox templates"
|
||||
;;
|
||||
download)
|
||||
echo "Downloading template: $2"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown pveam command: $1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Set up test environment
|
||||
echo "Setting up test environment..."
|
||||
mkdir -p /tmp/test-customer-installer
|
||||
cd /tmp/test-customer-installer
|
||||
|
||||
# Create test files
|
||||
echo "#!/bin/bash
|
||||
set -e
|
||||
echo 'Test setup script executed'
|
||||
" > setupowner.sh
|
||||
|
||||
echo "version: '3.8'
|
||||
services:
|
||||
db:
|
||||
image: ankane/pgvector:latest
|
||||
container_name: n8n-db
|
||||
environment:
|
||||
POSTGRES_PASSWORD: testpassword
|
||||
POSTGRES_DB: n8n
|
||||
POSTGRES_USER: n8n
|
||||
volumes:
|
||||
- /var/lib/n8n/data/postgres:/var/lib/postgresql/data
|
||||
networks:
|
||||
- n8n-network
|
||||
restart: unless-stopped
|
||||
|
||||
n8n:
|
||||
image: docker.n8n.io/n8nio/n8n:latest
|
||||
container_name: n8n-app
|
||||
environment:
|
||||
DB_TYPE: postgresdb
|
||||
DB_POSTGRESDB_HOST: db
|
||||
DB_POSTGRESDB_PORT: 5432
|
||||
DB_POSTGRESDB_USER: n8n
|
||||
DB_POSTGRESDB_PASSWORD: testpassword
|
||||
DB_POSTGRESDB_DATABASE: n8n
|
||||
N8N_ENCRYPTION_KEY: testkey
|
||||
TIMEZONE: Europe/Berlin
|
||||
volumes:
|
||||
- /var/lib/n8n/data/n8n:/home/n8n/.n8n
|
||||
networks:
|
||||
- n8n-network
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
networks:
|
||||
n8n-network:
|
||||
driver: bridge
|
||||
" > templates/docker-compose.yml
|
||||
|
||||
# Test the main installation script with mocked commands
|
||||
echo "Testing installation script with mocked Proxmox commands..."
|
||||
chmod +x install.sh
|
||||
./install.sh --storage local --bridge vmbr0 --vlan 90
|
||||
|
||||
echo "Test completed successfully!"
|
||||
Reference in New Issue
Block a user