Spaces:
Running
Running
Download test_grid_world.sh from openenv/grid_world_env: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/spaces/openenv/grid_world_env/resolve/main/test_grid_world.sh
- Command line
-
hf download hf://spaces/openenv/grid_world_env/test_grid_world.sh
-
curl -L -o test_grid_world.sh https://huggingface.co/spaces/openenv/grid_world_env/resolve/main/test_grid_world.sh
3.07 kB
| # Grid World Environment Integration Test Script | |
| set -e # Exit on error | |
| echo "ββββββββββββββββββββββββββββββββββββββββ" | |
| echo "π Grid World Environment Test Script" | |
| echo "ββββββββββββββββββββββββββββββββββββββββ" | |
| echo "" | |
| # FIX 1: Check for pyproject.toml to confirm we are at the root | |
| if [ ! -f "pyproject.toml" ]; then | |
| echo "β Error: Please run this script from the root 'OpenEnv' directory." | |
| exit 1 | |
| fi | |
| echo "π Working directory: $(pwd)" | |
| echo "" | |
| # Step 1: Check for base image | |
| echo "Step 1: Checking for base image (envtorch-base:latest)..." | |
| if docker images | grep -q "envtorch-base.*latest"; then | |
| echo "β envtorch-base:latest found" | |
| else | |
| echo "β οΈ envtorch-base:latest not found - building it now..." | |
| # FIX 2: Correct path found via your 'find' command | |
| docker build -t envtorch-base:latest -f src/openenv/core/containers/images/Dockerfile . | |
| echo "β Base image built successfully" | |
| fi | |
| echo "" | |
| # Step 2: Build Grid World environment | |
| echo "Step 2: Building Grid World environment image (grid-world-env:latest)..." | |
| # FIX 3: Correct path to your environment Dockerfile | |
| docker build --no-cache -f envs/grid_world_env/server/Dockerfile -t grid-world-env:latest . | |
| echo "β Grid World environment built successfully" | |
| echo "" | |
| # Step 3: Start container | |
| echo "Step 3: Starting Grid World container..." | |
| docker stop grid-world-test 2>/dev/null || true | |
| docker rm grid-world-test 2>/dev/null || true | |
| docker run -d -p 8000:8000 --name grid-world-test grid-world-env:latest | |
| echo "β³ Waiting for container to start..." | |
| sleep 5 | |
| echo "β Container is running" | |
| echo "" | |
| # Step 4: Test health endpoint | |
| echo "Step 4: Testing health endpoint..." | |
| HEALTH_RESPONSE=$(curl -s http://localhost:8000/health) | |
| if echo "$HEALTH_RESPONSE" | grep -q "healthy"; then | |
| echo "β Health check passed" | |
| else | |
| echo "β Health check failed! Response: $HEALTH_RESPONSE" | |
| exit 1 | |
| fi | |
| echo "" | |
| # Step 5: Test reset endpoint | |
| echo "Step 5: Testing reset endpoint..." | |
| RESET_RESPONSE=$(curl -s -X POST http://localhost:8000/reset) | |
| if echo "$RESET_RESPONSE" | grep -q "Welcome"; then | |
| echo "β Reset successful" | |
| else | |
| echo "β Reset failed! Response: $RESET_RESPONSE" | |
| exit 1 | |
| fi | |
| echo "" | |
| # Step 6: Test step endpoint | |
| echo "Step 6: Testing step endpoint..." | |
| STEP1=$(curl -s -X POST http://localhost:8000/step \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"action": {"action": "DOWN"}}') | |
| echo "β Step tests successful" | |
| echo "" | |
| # Step 7: Test state endpoint | |
| echo "Step 7: Testing state endpoint..." | |
| STATE_RESPONSE=$(curl -s http://localhost:8000/state) | |
| if echo "$STATE_RESPONSE" | grep -q "step_count"; then | |
| echo "β State endpoint working" | |
| else | |
| echo "β State endpoint failed! Response: $STATE_RESPONSE" | |
| exit 1 | |
| fi | |
| echo "" | |
| # Step 8: Cleanup | |
| echo "Step 8: Cleanup..." | |
| docker stop grid-world-test | |
| docker rm grid-world-test | |
| echo "β Cleanup complete" |