Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand All @@ -20,8 +26,8 @@ echo "=== Testing Java Version ==="
echo ""

# Capture java -version output (note: java -version outputs to stderr)
"../../../codingbooth" --variant base --port "${CB_PORT:-50011}" -- 'java -version' 2>&1
output=$("../../../codingbooth" --variant base --port "${CB_PORT:-50011}" -- 'java -version' 2>&1) || true
"$BOOTH" --variant base --port "${CB_PORT:-50011}" -- 'java -version' 2>&1
output=$("$BOOTH" --variant base --port "${CB_PORT:-50011}" -- 'java -version' 2>&1) || true

echo "$output"
echo ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand All @@ -18,7 +24,7 @@ echo "=== Testing jbang Source Execution ==="
echo ""

# Run jbang with inline Java source
output=$("../../../codingbooth" --variant base --port "${CB_PORT:-50012}" -- '
output=$("$BOOTH" --variant base --port "${CB_PORT:-50012}" -- '
cat > /tmp/Test.java << "EOFJAVA"
import java.nio.file.*;
import java.util.Arrays;
Expand All @@ -44,23 +50,23 @@ echo ""
failed=0

# Check for JDK version line
if grep -q "🚀 JDK:" <<< "$output"; then
if LC_ALL=C grep -q "🚀 JDK:" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found JDK version output"
else
echo -e "${RED}✗${NC} Missing JDK version output"
failed=1
fi

# Check for CWD line
if grep -q "📁 CWD:" <<< "$output"; then
if LC_ALL=C grep -q "📁 CWD:" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found CWD output"
else
echo -e "${RED}✗${NC} Missing CWD output"
failed=1
fi

# Check for Args line with expected arguments
if grep -q "🔧 Args: \[one, two 2\]" <<< "$output"; then
if LC_ALL=C grep -q "🔧 Args: \[one, two 2\]" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found correct arguments"
else
echo -e "${RED}✗${NC} Missing or incorrect arguments"
Expand Down
4 changes: 2 additions & 2 deletions examples/workspaces/android-example/device-connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# does not run under Docker Desktop's amd64 emulation on Apple Silicon (see the
# README's Architecture note), but a real device over the network is unaffected.
#
# Run this INSIDE the booth: ../../../codingbooth -- ./device-connect.sh ...
# Run this INSIDE the booth: ../../../booth -- ./device-connect.sh ...
#
# On the phone: Settings -> Developer options -> Wireless debugging ->
# "Pair device with pairing code" shows the IP, a PAIRING port, and a 6-digit
Expand Down Expand Up @@ -44,7 +44,7 @@ CONNECT_PORT="${4:-}"

if ! command -v adb >/dev/null 2>&1; then
echo "❌ adb not found on PATH. Is this running inside the booth?" >&2
echo " Try: ../../../codingbooth -- ./device-connect.sh ..." >&2
echo " Try: ../../../booth -- ./device-connect.sh ..." >&2
exit 1
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -48,12 +54,12 @@ echo ""

# Test 2: AWS connection from inside the container
echo "Testing AWS connection from inside container..."
if ../../../codingbooth --variant base --port "${CB_PORT:-50021}" -- ./check-connection.sh; then
if "$BOOTH" --variant base --port "${CB_PORT:-50021}" -- ./check-connection.sh; then
echo -e "${GREEN}✓${NC} Container AWS connection test passed"
else
echo -e "${RED}✗${NC} Container AWS connection test failed"
exit 1
fi
echo ""

echo -e "${GREEN}All AWS connection tests passed!${NC}"
echo -e "${GREEN}All AWS connection tests passed!${NC}"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand Down Expand Up @@ -61,7 +67,7 @@ sleep 1

# Start workspace in daemon mode with fixed port mapping
echo "Starting codingbooth..."
../../../codingbooth --no-browser --variant base --port "${CB_PORT:-50071}" --daemon --name "$CONTAINER_NAME" -p "$CONTAINER_PORT":8080 || true
"$BOOTH" --no-browser --variant base --port "${CB_PORT:-50071}" --daemon --name "$CONTAINER_NAME" -p "$CONTAINER_PORT":8080 || true

# Wait for booth to be ready
sleep 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand All @@ -16,7 +22,7 @@ fail() { echo -e "${RED}✗${NC} $1"; exit 1; }

echo "=== test001: egress allowlist + extra (non-DinD) ==="

if ../../../codingbooth --variant base --version latest --port "${CB_PORT:-50281}" --name egress-allowlist-extra-example --egress -- ./.cb-tests/test-on-container.sh; then
if "$BOOTH" --variant base --version latest --port "${CB_PORT:-50281}" --name egress-allowlist-extra-example --egress -- ./.cb-tests/test-on-container.sh; then
pass "Egress non-DinD test passed"
else
fail "Egress non-DinD test failed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand All @@ -16,7 +22,7 @@ fail() { echo -e "${RED}✗${NC} $1"; exit 1; }

echo "=== test001: egress envoy policy (non-DinD) ==="

if ../../../codingbooth --variant base --version latest --port "${CB_PORT:-50291}" --name egress-envoy-example --egress -- ./.cb-tests/test-on-container.sh; then
if "$BOOTH" --variant base --version latest --port "${CB_PORT:-50291}" --name egress-envoy-example --egress -- ./.cb-tests/test-on-container.sh; then
pass "Egress non-DinD test passed"
else
fail "Egress non-DinD test failed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -55,7 +61,7 @@ echo ""

# Test 2: Firebase connection from inside the container
echo "Testing Firebase connection from inside container..."
if ../../../codingbooth --variant base --port "${CB_PORT:-50091}" -- ./check-connection.sh; then
if "$BOOTH" --variant base --port "${CB_PORT:-50091}" -- ./check-connection.sh; then
echo -e "${GREEN}✓${NC} Container Firebase connection test passed"
else
echo -e "${RED}✗${NC} Container Firebase connection test failed"
Expand Down
2 changes: 1 addition & 1 deletion examples/workspaces/firebase-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This means:
### From Host

```bash
../../../codingbooth -- ./test-connection.sh
../../../booth -- ./test-connection.sh
```

### From Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -48,7 +54,7 @@ echo ""

# Test 2: gcloud connection from inside the container
echo "Testing gcloud connection from inside container..."
if ../../../codingbooth --variant base --port "${CB_PORT:-50111}" -- ./check-connection.sh; then
if "$BOOTH" --variant base --port "${CB_PORT:-50111}" -- ./check-connection.sh; then
echo -e "${GREEN}✓${NC} Container gcloud connection test passed"
else
echo -e "${RED}✗${NC} Container gcloud connection test failed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ else
fi

# Check for tree output (the emoji tree structure)
if grep -q "📁" <<< "$output"; then
if LC_ALL=C grep -q "📁" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found directory emoji in output"
else
echo -e "${RED}✗${NC} Missing directory emoji in output"
failed=1
fi

if grep -q "📄" <<< "$output"; then
if LC_ALL=C grep -q "📄" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found file emoji in output"
else
echo -e "${RED}✗${NC} Missing file emoji in output"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ echo ""
failed=0

# Check for JDK version
if grep -q "🚀 JDK:" <<< "$output"; then
if LC_ALL=C grep -q "🚀 JDK:" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found JDK version in output"
else
echo -e "${RED}✗${NC} Missing JDK version in output"
failed=1
fi

# Check for current working directory
if grep -q "📁 CWD:" <<< "$output"; then
if LC_ALL=C grep -q "📁 CWD:" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found CWD in output"
else
echo -e "${RED}✗${NC} Missing CWD in output"
failed=1
fi

# Check for args display
if grep -q "🔧 Args:" <<< "$output"; then
if LC_ALL=C grep -q "🔧 Args:" <<< "$output"; then
echo -e "${GREEN}✓${NC} Found Args in output"
else
echo -e "${RED}✗${NC} Missing Args in output"
Expand Down
7 changes: 6 additions & 1 deletion examples/workspaces/java-example/run-example-on-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

../../../codingbooth --variant base --port 22000 -- '
"$BOOTH" --variant base --port 22000 -- '
jbang --quiet - <<EOF one "two 2"
import java.nio.file.*;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand Down Expand Up @@ -39,7 +45,7 @@ sleep 1

# Start workspace in daemon mode
echo "Starting codingbooth..."
../../../codingbooth --no-browser --daemon --variant base --port "${CB_PORT:-50161}" --name "$CONTAINER_NAME" -p "$CONTAINER_PORT":8080 || true
"$BOOTH" --no-browser --daemon --variant base --port "${CB_PORT:-50161}" --name "$CONTAINER_NAME" -p "$CONTAINER_PORT":8080 || true

# Wait for npm install to complete (up to 120 seconds)
echo "Waiting for npm install to complete..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand Down Expand Up @@ -43,7 +49,7 @@ sleep 1

# Start workspace in daemon mode with fixed port mappings
echo "Starting codingbooth..."
../../../codingbooth --no-browser --daemon --variant base --port "${CB_PORT:-50162}" --name "$CONTAINER_NAME" -p "$API_HOST_PORT":3000 -p "$VITE_HOST_PORT":5173 || true
"$BOOTH" --no-browser --daemon --variant base --port "${CB_PORT:-50162}" --name "$CONTAINER_NAME" -p "$API_HOST_PORT":3000 -p "$VITE_HOST_PORT":5173 || true

# Wait for npm install to complete (up to 120 seconds)
echo "Waiting for npm install to complete..."
Expand Down Expand Up @@ -78,16 +84,20 @@ echo "Starting server inside container..."
docker exec "$CONTAINER_NAME" bash -c "cd /home/coder/code && just start" > /dev/null 2>&1
pass "Server started"

# Wait for server to be ready
sleep 2

# Check servers are accessible from host
# Check servers are accessible from host, polling while they start
# (the tsx-compiled API server can take well over a few seconds)
echo "Checking servers from host..."
if API_PORT=$API_PORT VITE_PORT=$VITE_PORT ./check-server.sh --expect=up; then
pass "Servers accessible from host"
else
fail "Servers should be accessible from host"
fi
WAIT_COUNT=0
until API_PORT=$API_PORT VITE_PORT=$VITE_PORT ./check-server.sh --expect=up > /dev/null 2>&1; do
WAIT_COUNT=$((WAIT_COUNT + 1))
if [ "$WAIT_COUNT" -ge 60 ]; then
API_PORT=$API_PORT VITE_PORT=$VITE_PORT ./check-server.sh --expect=up || true
fail "Servers should be accessible from host"
fi
sleep 1
done
API_PORT=$API_PORT VITE_PORT=$VITE_PORT ./check-server.sh --expect=up
pass "Servers accessible from host"

# Stop server
echo "Stopping server..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

set -euo pipefail

# Locate the booth wrapper from this script's own location, so it works from any cwd.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
BOOTH="$REPO_ROOT/booth"
[ -x "$BOOTH" ] || BOOTH="$REPO_ROOT/codingbooth"
[ -x "$BOOTH" ] || { echo "booth wrapper not found under $REPO_ROOT" >&2; exit 1; }

cd "$(dirname "$0")/.."

GREEN='\033[0;32m'
Expand Down Expand Up @@ -60,7 +66,7 @@ sleep 1

# Start booth in daemon mode
echo "Starting booth with KinD..."
../../../codingbooth --no-browser --keep-alive --daemon --variant base --port "${CB_PORT:-50171}" --name "$CONTAINER_NAME"
"$BOOTH" --no-browser --keep-alive --daemon --variant base --port "${CB_PORT:-50171}" --name "$CONTAINER_NAME"

# Wait for booth to be ready (up to 60 seconds)
echo "Waiting for booth container to start..."
Expand Down
Loading
Loading