diff --git a/Dockerfile b/Dockerfile index 16e7ed0..120f6d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,12 @@ ARG TARGETARCH # Copy binary from builder +RUN apk add --no-cache wget curl bash jq + RUN mkdir -p /sos && mkdir -p /data/storage COPY --chmod=0755 output/simple_object_storage.${TARGETARCH} /sos/sos -COPY --chmod=0644 testing/sos_config.json /testing/sos_config.json +COPY testing/ /testing/ # Expose port EXPOSE 80 diff --git a/testing/compose.yaml b/testing/compose.yaml index 551ca02..6b210a0 100644 --- a/testing/compose.yaml +++ b/testing/compose.yaml @@ -1,6 +1,6 @@ services: sos: - image: gitea.jde.nz/public/simple-object-storage:test + image: simple-object-storage-test container_name: sos-test network_mode: "host" ports: diff --git a/testing/sos_config.json b/testing/sos_config.json index 85e7f75..39a4372 100644 --- a/testing/sos_config.json +++ b/testing/sos_config.json @@ -8,5 +8,6 @@ "auth_rate_limit": 5, "auth_window_seconds": 2 }, - "port": 7703 + "port": 7703, + "host": "127.0.0.1" } diff --git a/testing/test-docker.sh b/testing/test-docker.sh index bc95d81..059f8cb 100755 --- a/testing/test-docker.sh +++ b/testing/test-docker.sh @@ -52,7 +52,7 @@ title "Building amd64 executable" #------------------------------------------------------------------------------------------------ # build the docker image title "Building docker image" -docker buildx build --no-cache --load -t gitea.jde.nz/public/simple-object-storage:test --platform linux/amd64 "${MAIN_DIR}" +docker buildx build --no-cache --load -t simple-object-storage-test --platform linux/amd64 "${MAIN_DIR}" #------------------------------------------------------------------------------------------------ # run the docker container @@ -84,7 +84,8 @@ if ! wait_for_container "sos-test"; then fi # run the tests. Docker inside docker support! -"${SCRIPT_DIR}/test.sh" "http://127.0.0.1:7703" +docker exec -it sos-test ls /testing || true +docker exec -it sos-test /bin/bash -c "cd /testing && ./test.sh http://127.0.0.1:7703" RESULT=$? # clean up. diff --git a/testing/test_1GB_file_upload.sh b/testing/test_1GB_file_upload.sh index 00bf1a6..5d81497 100755 --- a/testing/test_1GB_file_upload.sh +++ b/testing/test_1GB_file_upload.sh @@ -1,6 +1,5 @@ #!/bin/bash - # read ~/.config/simple_object_storage/sos_config.json CONFIG_PATH="./sos_config.json" if [ ! -f "${CONFIG_PATH}" ]; then @@ -19,8 +18,6 @@ echo "Calculating original file hash..." ORIGINAL_HASH=$(sha256sum test_file.bin | cut -d' ' -f1) echo "Original hash: $ORIGINAL_HASH" - - # get the host and port from the config HOST=$(echo "$CONFIG" | jq -r '.host') PORT=$(echo "$CONFIG" | jq -r '.port')