test: Fix Caddy route tests with custom Caddy (#32675)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated base Docker image and installation processes for tools within the Docker environment. - **Chores** - Modified scripts to enhance file handling and environment variable configurations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
2ac328449c
commit
0a9f9b9043
|
|
@ -1,7 +1,22 @@
|
|||
FROM node:lts-alpine
|
||||
FROM appsmith/base-ce:release
|
||||
|
||||
RUN apk add --no-cache bash caddy \
|
||||
&& apk add --no-cache hurl mkcert --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
SHELL ["bash", "-eux", "-c"]
|
||||
|
||||
RUN <<END
|
||||
version="$(basename "$(curl -sS --write-out '%{redirect_url}' 'https://github.com/Orange-OpenSource/hurl/releases/latest')")"
|
||||
curl -sS --location "https://github.com/Orange-OpenSource/hurl/releases/download/$version/hurl-$version-$(uname -m)-unknown-linux-gnu.tar.gz" \
|
||||
| tar xvz -C /tmp --strip-components 1
|
||||
mv /tmp/hurl /bin
|
||||
chmod +x /bin/hurl
|
||||
|
||||
version="$(basename "$(curl -sS --write-out '%{redirect_url}' 'https://github.com/FiloSottile/mkcert/releases/latest')")"
|
||||
curl -sS --location "https://github.com/FiloSottile/mkcert/releases/download/$version/mkcert-$version-linux-$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" \
|
||||
-o /bin/mkcert
|
||||
|
||||
chmod +x /bin/mkcert
|
||||
END
|
||||
|
||||
ENV PATH=/opt/caddy:/opt/node/bin:$PATH
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
||||
GET http://127.0.0.1
|
||||
HTTP 200
|
||||
|
|
@ -12,7 +12,7 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
||||
GET http://local.com
|
||||
HTTP 200
|
||||
|
|
@ -20,7 +20,7 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
||||
GET http://localhost/some/non/handled/path
|
||||
HTTP 200
|
||||
|
|
@ -28,7 +28,7 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
||||
GET http://127.0.0.1/some/non/handled/path
|
||||
HTTP 200
|
||||
|
|
@ -36,7 +36,7 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
||||
GET http://local.com/some/non/handled/path
|
||||
HTTP 200
|
||||
|
|
@ -44,4 +44,4 @@ Content-Type: text/html; charset=utf-8
|
|||
Content-Security-Policy: frame-ancestors {{frame_ancestors}}
|
||||
[Asserts]
|
||||
header "Server" not exists
|
||||
body == "index.html body"
|
||||
body == "actual index.html body"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
|
@ -44,8 +44,11 @@ echo
|
|||
export TMP=/tmp/appsmith
|
||||
export WWW_PATH="$TMP/www"
|
||||
|
||||
mkdir -p "$WWW_PATH"
|
||||
echo -n 'index.html body' > "$WWW_PATH/index.html"
|
||||
# Fake files needed by the caddy-reconfigure script
|
||||
mkdir -p "$WWW_PATH" /opt/appsmith/editor
|
||||
echo -n 'index.html body, this will be replaced' > "$WWW_PATH/index.html"
|
||||
echo '{}' > /opt/appsmith/info.json
|
||||
echo -n 'actual index.html body' > /opt/appsmith/editor/index.html
|
||||
mkcert -install
|
||||
|
||||
# Start echo server
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ docker run \
|
|||
--name ar \
|
||||
--rm \
|
||||
"${args[@]}" \
|
||||
-e OPEN_SHELL=${OPEN_SHELL-} \
|
||||
-e OPEN_SHELL="${OPEN_SHELL-}" \
|
||||
--volume "$(dirname "$PWD")/fs/opt/appsmith/caddy-reconfigure.mjs:/caddy-reconfigure.mjs:ro" \
|
||||
--volume ".:/code:ro" \
|
||||
ar
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user