Fix edge gateway relay command draining

This commit is contained in:
Jeppe Bundgaard
2026-07-02 12:41:34 +02:00
parent 62c1393f62
commit 243d68ab59
9 changed files with 1170 additions and 38 deletions
@@ -51,8 +51,11 @@ it('builds the installer around the compose stack artifacts and management polli
expect($managerSource)->toContain('systemctl stop truckwash-edge-agent.service');
expect($managerSource)->toContain('TRUCKWASH_INSTALL_DIR="$INSTALL_DIR" "$INSTALL_DIR/gateway-launcher.sh" down >/dev/null 2>&1 || true');
expect($managerSource)->toContain('docker rm -f');
expect($managerSource)->toContain('remove_edge_gateway_containers()');
expect($managerSource)->toContain('remove_docker_containers_matching_filter "name=${name}"');
expect($managerSource)->toContain('remove_docker_containers_matching_filter "label=com.docker.compose.project=${project_name}"');
expect($managerSource)->toContain('remove_docker_containers_matching_filter "label=com.docker.compose.project.working_dir=${INSTALL_DIR}"');
expect($managerSource)->toContain('truckwash-minio');
expect($managerSource)->toContain('truckwash-minio >/dev/null 2>&1 || true');
expect($managerSource)->toContain('rm -f "$STACK_SERVICE_PATH" "$LEGACY_SERVICE_PATH"');
expect($managerSource)->toContain('rm -rf "$INSTALL_DIR"');
expect($managerSource)->toContain('systemctl reset-failed truckwash-edge-agent.service >/dev/null 2>&1 || true');
@@ -76,7 +79,9 @@ it('builds the installer around the compose stack artifacts and management polli
expect($managerSource)->toContain('run_step "Waiting for gateway claim" wait_for_gateway_claim "$CONFIG_PATH" "$HEARTBEAT_MARKER_PATH" "$INSTALL_STARTED_AT" 180');
expect($managerSource)->not->toContain('run_step "Waiting for post-reinstall heartbeat"');
expect($managerSource)->not->toContain('Gateway reconnected using preserved credentials.');
expect($managerSource)->toContain('journalctl -u truckwash-edge-gateway-stack.service -n 60 --no-pager || true');
expect($managerSource)->toContain('journalctl -a -u truckwash-edge-gateway-stack.service -n 80 --no-pager');
expect($managerSource)->toContain("docker ps -a --format '{{.Names}} {{.Status}} {{.Ports}}'");
expect($managerSource)->toContain('logs --no-color --no-log-prefix --tail=120');
expect($managerSource)->not->toContain('agent.mjs');
expect($managerSource)->toContain("'brokerUrl' => \$this->buildBrokerPublicUrl()");
expect($installServiceSource)->toContain('normalizeLineEndings($this->manager()->buildInstallScript($plainToken))');
@@ -102,8 +107,9 @@ it('builds the installer around the compose stack artifacts and management polli
expect($launcherSource)->toContain('window="$(staged_update_value update_window \'\')"');
expect($launcherSource)->toContain('Staged update already applied; nothing to reconcile');
expect($launcherSource)->toContain('AUTO_UPDATER_BASE_IMAGE="$auto_updater_base_image"');
expect($launcherSource)->toContain('COMPOSE_PROJECT_NAME="$compose_project_name" compose_cmd -f "$COMPOSE_FILE" ps || true');
expect($launcherSource)->toContain('COMPOSE_PROJECT_NAME="$compose_project_name" compose_cmd -f "$COMPOSE_FILE" logs --tail=80 || true');
expect($launcherSource)->toContain("docker ps -a --format '{{.Names}} {{.Status}} {{.Ports}}'");
expect($launcherSource)->toContain('COMPOSE_PROJECT_NAME="$compose_project_name" compose_cmd -f "$COMPOSE_FILE" ps -a --no-trunc || true');
expect($launcherSource)->toContain('COMPOSE_PROJECT_NAME="$compose_project_name" compose_cmd -f "$COMPOSE_FILE" logs --no-color --no-log-prefix --tail=120 || true');
expect($launcherSource)->toContain('log "Compose rollout failed during build/startup"');
expect($launcherSource)->toContain('write_rollback_status "FAILED" "compose_up_failed" "$installed_version"');
expect($launcherSource)->toContain('write_rollback_status "FAILED" "rollback_apply_failed" "$installed_version"');