diff --git a/.github/workflows/build-and-deploy-test-stack.yml b/.github/workflows/build-and-deploy-test-stack.yml
index 4528dab7d..76a40607f 100644
--- a/.github/workflows/build-and-deploy-test-stack.yml
+++ b/.github/workflows/build-and-deploy-test-stack.yml
@@ -5,6 +5,7 @@ on:
push:
branches:
- test
+ - infra/test-chores
env:
ENVIRONMENT: "test"
@@ -21,7 +22,7 @@ jobs:
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
GTM_ID: ${{ secrets.GTM_ID }}
NPMRC_TOKEN: ${{ secrets.NPMRC_TOKEN }}
- SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
+ SENTRY_DSN_FRONTEND: ${{ secrets.INTERSECT_SENTRY_DSN_FRONTEND }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
steps:
diff --git a/tests/load-testing/pom.xml b/tests/load-testing/pom.xml
index f79842b88..5f4ab6722 100644
--- a/tests/load-testing/pom.xml
+++ b/tests/load-testing/pom.xml
@@ -4,7 +4,7 @@
4.0.0
io.gatling.govtool
govtool-backend
- 0.0.1
+ 1.0.0
1.8
@@ -12,7 +12,7 @@
UTF-8
- 3.9.5
+ 3.11.3
4.5.0
3.11.0
3.3.1
@@ -28,17 +28,17 @@
io.gatling
gatling-app
- 3.9.5
+ 3.11.3
io.gatling
gatling-core
- 3.9.5
+ 3.11.3
io.gatling
gatling-recorder
- 3.9.5
+ 3.11.3
org.bouncycastle
diff --git a/tests/test-infrastructure/.env.example b/tests/test-infrastructure/.env.example
index 81ff08a2b..ace81dd8f 100644
--- a/tests/test-infrastructure/.env.example
+++ b/tests/test-infrastructure/.env.example
@@ -1,4 +1,7 @@
PROJECT_NAME=govtool
+NPMRC_TOKEN=
+SENTRY_DSN_FRONTEND=
+SENTRY_DSN_BACKEND=
CARDANO_NETWORK=sanchonet
BASE_DOMAIN=govtool.cardanoapi.io
GOVTOOL_TAG=test
\ No newline at end of file
diff --git a/tests/test-infrastructure/build-images.sh b/tests/test-infrastructure/build-images.sh
index e86103e7a..f420231b3 100755
--- a/tests/test-infrastructure/build-images.sh
+++ b/tests/test-infrastructure/build-images.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/e bash
set -e
export BASE_IMAGE_NAME="govtool"
BASE_IMAGE_EXISTS=$(docker images -q "$BASE_IMAGE_NAME"/backend-base)
diff --git a/tests/test-infrastructure/configs_template/backend_config.json b/tests/test-infrastructure/configs_template/backend_config.json
index 43cf7f251..24737a7c0 100644
--- a/tests/test-infrastructure/configs_template/backend_config.json
+++ b/tests/test-infrastructure/configs_template/backend_config.json
@@ -9,7 +9,7 @@
"port" : 8080,
"host" : "0.0.0.0",
"cachedurationseconds": 20,
- "sentrydsn": "https://username:password@senty.host/id",
- "metadatavalidationhost": "http://metadata-validation",
+ "sentrydsn": "${SENTRY_DSN_BACKEND:-https://username:password@senty.host/id}",
+ "metadatavalidationhost": "${METADATA_VALIDATION_URL:-http://metadata-validation}",
"metadatavalidationport": 3000
}
\ No newline at end of file
diff --git a/tests/test-infrastructure/docker-compose-govtool.yml b/tests/test-infrastructure/docker-compose-govtool.yml
index b31f5b9ae..eebd897e0 100644
--- a/tests/test-infrastructure/docker-compose-govtool.yml
+++ b/tests/test-infrastructure/docker-compose-govtool.yml
@@ -40,6 +40,9 @@ services:
context: ../../govtool/frontend
args:
VITE_BASE_URL: "/api"
+ VITE_SENTRY_DSN: ${SENTRY_DSN_FRONTEND}
+ NPMRC_TOKEN: ${NPMRC_TOKEN}
+ VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: "true"
environment:
VIRTUAL_HOST: https://${BASE_DOMAIN}
networks:
diff --git a/tests/test-infrastructure/gen-configs.sh b/tests/test-infrastructure/gen-configs.sh
index 7d8d83e65..2d87ef363 100755
--- a/tests/test-infrastructure/gen-configs.sh
+++ b/tests/test-infrastructure/gen-configs.sh
@@ -72,13 +72,13 @@ generate_secret "POSTGRES_PASSWORD" "./secrets/postgres_password"
for CONFIG_FILE in $(ls ./configs_template)
do
echo -n "Config ${PROJECT_NAME}_${CONFIG_FILE}: "
- envsubst < "./configs_template/$CONFIG_FILE" > "./configs/${CONFIG_FILE}"
+ ./scripts/envsubst.py < "./configs_template/$CONFIG_FILE" > "./configs/${CONFIG_FILE}"
done
for SECRET_FILE in $(ls ./secrets_template)
do
echo -n "Secret ${PROJECT_NAME}_${SECRET_FILE}: "
- envsubst < "./secrets_template/$SECRET_FILE" > "./secrets/${SECRET_FILE}"
+ ./scripts/envsubst.py < "./secrets_template/$SECRET_FILE" > "./secrets/${SECRET_FILE}"
done
################################################################################
diff --git a/tests/test-infrastructure/playbook.yml b/tests/test-infrastructure/playbook.yml
index 37656787a..a9a166ef5 100644
--- a/tests/test-infrastructure/playbook.yml
+++ b/tests/test-infrastructure/playbook.yml
@@ -19,4 +19,6 @@
chdir: "/opt/govtool/tests/test-infrastructure"
environment:
GOVTOOL_TAG: "{{ lookup('env', 'GOVTOOL_TAG') }}"
+ NPMRC_TOKEN: "{{ lookup('env','NPMRC_TOKEN'}}"
+ SENTRY_DSN_FRONTEND: "{{ lookup ('env', 'SENTRY_DSN_FRONTEND'}} "
become: yes
\ No newline at end of file
diff --git a/tests/test-infrastructure/scripts/deploy-stack.sh b/tests/test-infrastructure/scripts/deploy-stack.sh
index 38920f07e..a84bdd279 100755
--- a/tests/test-infrastructure/scripts/deploy-stack.sh
+++ b/tests/test-infrastructure/scripts/deploy-stack.sh
@@ -62,6 +62,6 @@ function deploy-stack(){
EXTENSION="${FILENAME##*.}"
FILENAME_WITHOUT_EXT="${FILENAME%.*}"
RENDERED_FILENAME="${FILENAME_WITHOUT_EXT}-rendered.${EXTENSION}"
- envsubst < "$COMPOSE_FILE" > "$RENDERED_FILENAME"
+ ./scripts/envsubst.py < "$COMPOSE_FILE" > "$RENDERED_FILENAME"
docker stack deploy -c "$RENDERED_FILENAME" ${STACK_NAME}
}
\ No newline at end of file
diff --git a/tests/test-infrastructure/scripts/envsubst.py b/tests/test-infrastructure/scripts/envsubst.py
new file mode 100755
index 000000000..eb60c4c8b
--- /dev/null
+++ b/tests/test-infrastructure/scripts/envsubst.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python3
+import os
+import re
+import sys
+
+def envsubst(template_str, env=os.environ):
+ """Substitute environment variables in the template string, supporting default values."""
+ pattern = re.compile(r'\$\{([^}:\s]+)(?::-(.*?))?\}')
+
+ def replace(match):
+ var = match.group(1)
+ default_value = match.group(2) if match.group(2) is not None else ''
+ return env.get(var, default_value)
+
+ return pattern.sub(replace, template_str)
+
+def main():
+ if len(sys.argv) > 2:
+ print("Usage: python envsubst.py [template_file]")
+ sys.exit(1)
+
+ if len(sys.argv) == 2:
+ template_file = sys.argv[1]
+ with open(template_file, 'r') as file:
+ template_str = file.read()
+ else:
+ template_str = sys.stdin.read()
+
+ result = envsubst(template_str)
+
+ print(result)
+
+if __name__ == "__main__":
+ main()