Walkthroughs
Walkthrough 1: one long-running machine
Here one machine stays up all day while you change a Windows application. After each change you copy in the new build, start it, drive it, take screenshots and check the results, without rebuilding an image or restarting Windows.
-
Launch the machine once. Use the one-service Compose file from Deploying a single machine, with no main process, so that the machine keeps running:
Terminalendia compose up --wait shots=$(mktemp -d) # screenshots stay outside the project -
Deploy the build. Build the application on your side, create its folder in the machine, then copy it in:
Terminalendia exec orders-dev-dev-1 cmd /c "if not exist C:\app mkdir C:\app" endia cp ./publish/. orders-dev-dev-1:C:/app -
Run it on the desktop and keep its process ID:
Terminalpid=$(endia desktop launch orders-dev-dev-1 C:\\app\\Orders.exe | jq -r .processId) -
Interact with it. Read the window's elements, then drive them:
Terminalendia desktop inspect orders-dev-dev-1 "$pid" > ui.json endia desktop set-value orders-dev-dev-1 "$pid" "Window[Orders]/Edit#CustomerName" "Ada" endia desktop invoke orders-dev-dev-1 "$pid" "Window[Orders]/Button[Save]" -
Take screenshots of the state you want to keep:
Terminalendia desktop screenshot --pid "$pid" orders-dev-dev-1 > "$shots/after-save.png" -
Validate. Run the test suite inside the machine and fetch its results, or call the application through its published port:
Terminalendia exec orders-dev-dev-1 C:\\app\\tests\\run-tests.cmd endia cp orders-dev-dev-1:C:/app/tests/results ./results curl http://127.0.0.1:18080/health -
Fix and redeploy. Stop the running application, change the code, and start again from step 2:
Terminalendia process stop orders-dev-dev-1 "$pid"
When you finish, endia compose down removes the machine. If the machine gets into a bad state, endia compose down followed by endia compose up --wait gives a fresh one from the image in a few minutes.
Walkthrough 2: testing a fleet
Here a test checks several machines working as one system. It builds an image with the software under test and its Windows settings, and starts several machines from that image at once. It then tests them together, collects their results and shuts everything down.
-
Build the layer. Build the image from
app.Endiafilein Built images. That recipe copies the application in, opens its firewall port, adds a hosts entry and sets a registry value:Terminalendia build -t lab/app:dev -f app.Endiafile . -
Describe the fleet. Use the Compose file from Deploying many machines: one server with a health check and three clients that wait for it, on one private network.
-
Launch the fleet. Give each run its own project name, so that runs side by side do not collide. A trap makes sure the fleet is always removed:
Terminalset -e project="orders-test-$$" trap 'endia compose -p "$project" down -v' EXIT endia compose -p "$project" up --wait --wait-timeout 900 # seconds: 15 minutesup --waitexits with 1 if a machine becomes unhealthy, its main process exits, or the time-out passes. -
Run the coordinated test. Start the clients' work and wait for each:
Terminalpids=() for i in 1 2 3; do endia compose -p "$project" exec -T --index "$i" client C:\\app\\Client.exe --orders 100 & pids+=($!) done status=0 for pid in "${pids[@]}"; do wait "$pid" || status=1 done exit $status-Tattaches no terminal, which suits a script. Eachexecexits with the client program's exit code, andwaitwith a process ID returns that code. A barewaitreturns 0 whatever the programs did, so the script names each process ID. -
Capture the results. Copy each machine's result files out, and keep the server's output:
Terminalfor i in 1 2 3; do endia compose -p "$project" cp --index "$i" client:C:/app/results "./results/client-$i" done endia compose -p "$project" cp server:C:/app/logs ./results/server-logs endia compose -p "$project" logs server > ./results/server.log -
Shut the fleet down. The shell's
trapline from step 3 runsendia compose -p "$project" down -vwhen the script ends, whether it passed or failed. That removes the machines, the private network and the named volumes.