From f18919ff1576bfe49fe3a9a4fbd0a0e08107cdad Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Wed, 12 Feb 2025 17:25:02 -0800 Subject: [PATCH] run tests --- .github/workflows/validate_arch_config.yml | 31 +++++++++++++++++++ arch/Dockerfile | 2 ++ arch/validate_arch_config.sh | 20 ++++++++++++ arch/validate_schema.sh | 1 + .../currency_exchange/arch_config.yaml | 11 ++++--- 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/validate_arch_config.yml create mode 100644 arch/validate_arch_config.sh create mode 100644 arch/validate_schema.sh diff --git a/.github/workflows/validate_arch_config.yml b/.github/workflows/validate_arch_config.yml new file mode 100644 index 00000000..2507fae4 --- /dev/null +++ b/.github/workflows/validate_arch_config.yml @@ -0,0 +1,31 @@ +name: e2e archgw tests + +on: + push: + branches: + - main + pull_request: + +jobs: + e2e_archgw_tests: + runs-on: ubuntu-latest + defaults: + run: + working-directory: . + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: build arch docker image + run: | + docker build -f arch/Dockerfile . -t katanemo/archgw + + - name: validate arch config + run: | + sh arch/validate_arch_config.sh diff --git a/arch/Dockerfile b/arch/Dockerfile index 2c3c8744..62b92f38 100644 --- a/arch/Dockerfile +++ b/arch/Dockerfile @@ -24,8 +24,10 @@ RUN pip install -r requirements.txt COPY arch/tools/cli/config_generator.py . COPY arch/envoy.template.yaml . COPY arch/arch_config_schema.yaml . +COPY arch/validate_schema.sh . RUN pip install requests RUN touch /var/log/envoy.log +RUN chmod a+x validate_schema.sh ENTRYPOINT ["sh","-c", "python config_generator.py && envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && envoy -c /etc/envoy.env_sub.yaml --component-log-level wasm:debug 2>&1 | tee /var/log/envoy.log"] diff --git a/arch/validate_arch_config.sh b/arch/validate_arch_config.sh new file mode 100644 index 00000000..ccc119c0 --- /dev/null +++ b/arch/validate_arch_config.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +failed_files=() + +for file in $(find . -name arch_config.yaml -o -name arch_config_full_reference.yaml); do + echo "Validating $file..." + if ! docker run --rm -v "$(pwd)/$file:/app/arch_config.yaml:ro" --entrypoint /bin/sh katanemo/archgw:latest -c "python config_generator.py" 2>&1 > /dev/null ; then + echo "Validation failed for $file" + failed_files+=("$file") + fi +done + +# Print summary of failed files +if [ ${#failed_files[@]} -ne 0 ]; then + echo -e "\nValidation failed for the following files:" + printf '%s\n' "${failed_files[@]}" + exit 1 +else + echo -e "\nAll files validated successfully!" +fi diff --git a/arch/validate_schema.sh b/arch/validate_schema.sh new file mode 100644 index 00000000..fb5a8679 --- /dev/null +++ b/arch/validate_schema.sh @@ -0,0 +1 @@ +python config_generator.py diff --git a/demos/samples_python/currency_exchange/arch_config.yaml b/demos/samples_python/currency_exchange/arch_config.yaml index 89a9e65b..6a682926 100644 --- a/demos/samples_python/currency_exchange/arch_config.yaml +++ b/demos/samples_python/currency_exchange/arch_config.yaml @@ -1,10 +1,11 @@ version: v0.1 -listener: - address: 0.0.0.0 - port: 10000 - message_format: huggingface - connect_timeout: 0.005s +listeners: + prompt_gateway: + address: 0.0.0.0 + port: 10000 + message_format: openai + timeout: 30s llm_providers: - name: gpt-4o