java-e2e.sh
1 #!/bin/bash 2 # Copyright 2025 Alibaba Group Holding Ltd. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 set -euxo pipefail 17 18 TAG=${TAG:-latest} 19 20 REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" 21 22 # build execd image locally (context must include internal/) 23 docker build -f components/execd/Dockerfile -t opensandbox/execd:local "${REPO_ROOT}" 24 25 # prepare required images from registry 26 docker pull opensandbox/code-interpreter:${TAG} 27 echo "-------- Eval test images --------" 28 docker images 29 30 # prepare hostpath volume for e2e test 31 mkdir -p /tmp/opensandbox-e2e/host-volume-test 32 mkdir -p /tmp/opensandbox-e2e/logs 33 echo "opensandbox-e2e-marker" > /tmp/opensandbox-e2e/host-volume-test/marker.txt 34 chmod -R 755 /tmp/opensandbox-e2e 35 36 # prepare Docker named volume for pvc e2e test 37 docker volume rm opensandbox-e2e-pvc-test 2>/dev/null || true 38 docker volume create opensandbox-e2e-pvc-test 39 # seed the named volume with a marker file and subpath test data via a temporary container 40 docker run --rm -v opensandbox-e2e-pvc-test:/data alpine sh -c "\ 41 echo 'pvc-marker-data' > /data/marker.txt && \ 42 mkdir -p /data/datasets/train && \ 43 echo 'pvc-subpath-marker' > /data/datasets/train/marker.txt" 44 echo "-------- JAVA E2E test logs for execd --------" > /tmp/opensandbox-e2e/logs/execd.log 45 46 # setup server 47 cd server 48 export OPENSANDBOX_INSECURE_SERVER=YES 49 uv sync && uv run python -m opensandbox_server.main > server.log 2>&1 & 50 cd .. 51 52 # wait for server 53 sleep 10 54 55 cd sdks/sandbox/kotlin 56 ./gradlew clean publishToMavenLocal --no-build-cache 57 cd ../../../ 58 59 cd sdks/code-interpreter/kotlin 60 ./gradlew clean publishToMavenLocal --no-build-cache -PuseMavenLocal 61 cd ../../../ 62 63 # run Java e2e 64 cd tests/java 65 ./gradlew test