|
| 1 | +# Copyright AGNTCY Contributors (https://github.com/agntcy) |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +--- |
| 5 | +version: '3' |
| 6 | + |
| 7 | +silent: true |
| 8 | + |
| 9 | +vars: |
| 10 | + KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME | default "agntcy-test" }}' |
| 11 | + |
| 12 | + ## Image config |
| 13 | + IMAGE_REPO: '{{ .IMAGE_REPO | default "ghcr.io/agntcy" }}' |
| 14 | + GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.3.2" }}' |
| 15 | + |
| 16 | + IMAGE_BAKE_OPTS: '{{ .IMAGE_BAKE_OPTS | default "--set *.platform=linux/arm64" }}' |
| 17 | + TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.3" }}' |
| 18 | + |
| 19 | + AZURE_OPENAI_API_KEY: '{{ .AZURE_OPENAI_API_KEY | default "" }}' |
| 20 | + AZURE_OPENAI_ENDPOINT: '{{ .AZURE_OPENAI_ENDPOINT | default "" }}' |
| 21 | + |
| 22 | + HELM_NAMESPACE: '{{ .HELM_NAMESPACE | default "default" }}' |
| 23 | + |
| 24 | + REMOVE_CONTAINERS: '{{ .REMOVE_CONTAINERS | default "true" }}' |
| 25 | + |
| 26 | + RUNNER_TYPE: '{{ .RUNNER_TYPE | default "docker" }}' |
| 27 | + |
| 28 | +tasks: |
| 29 | + k8s:port-forward:setup: |
| 30 | + internal: true |
| 31 | + cmds: |
| 32 | + - kubectl port-forward svc/agntcy-agp -n {{ .HELM_NAMESPACE }} 46357 & |
| 33 | + - sleep 1 |
| 34 | + |
| 35 | + k8s:port-forward:teardown: |
| 36 | + internal: true |
| 37 | + cmds: |
| 38 | + - kill -9 $(ps aux | grep port-forward | grep agntcy-agp | awk '{print $2}') || true |
| 39 | + |
| 40 | + test-env:deploy: |
| 41 | + desc: Deploy agntcy gateway test env |
| 42 | + cmds: |
| 43 | + - | |
| 44 | + kubectl config use-context kind-{{ .KIND_CLUSTER_NAME }} && |
| 45 | + helm dependency build ./components/helm |
| 46 | + helm upgrade agntcy-agp \ |
| 47 | + ./components/helm \ |
| 48 | + --set agp.image.tag="{{ .GATEWAY_IMAGE_TAG }}" \ |
| 49 | + --namespace {{ .HELM_NAMESPACE }} \ |
| 50 | + --create-namespace \ |
| 51 | + --install \ |
| 52 | + --wait \ |
| 53 | + --wait-for-jobs \ |
| 54 | + --timeout "15m" |
| 55 | +
|
| 56 | + test-env:cleanup: |
| 57 | + desc: Remove agent gateway test env |
| 58 | + cmds: |
| 59 | + - kubectl config use-context kind-{{ .KIND_CLUSTER_NAME }} && |
| 60 | + - helm delete --namespace {{ .HELM_NAMESPACE }} agntcy-agp |
| 61 | + |
| 62 | + build:agentic-apps: |
| 63 | + desc: Build agentic containers |
| 64 | + dir: ./agentic-apps |
| 65 | + cmds: |
| 66 | + - IMAGE_TAG={{ .TEST_APP_TAG }} docker buildx bake {{ .IMAGE_BAKE_OPTS }} --load |
| 67 | + |
| 68 | + test:autogen-agent:run: |
| 69 | + internal: true |
| 70 | + cmds: |
| 71 | + - | |
| 72 | + hostNetFlag="" |
| 73 | + hostMachine=http://host.docker.internal:46357 |
| 74 | + unameOut=$(uname -s) |
| 75 | + case ${unameOut} in |
| 76 | + Linux*) |
| 77 | + hostMachine=http://127.0.0.1:46357 |
| 78 | + hostNetFlag="--net=host" |
| 79 | + ;; |
| 80 | + Darwin*) |
| 81 | + hostMachine=http://host.docker.internal:46357 |
| 82 | + ;; |
| 83 | + *) |
| 84 | + esac |
| 85 | + echo "gw host: ${hostMachine}" |
| 86 | +
|
| 87 | + docker run -d --rm \ |
| 88 | + -e AZURE_OPENAI_API_KEY={{.AZURE_OPENAI_API_KEY}} \ |
| 89 | + -e AZURE_OPENAI_ENDPOINT={{.AZURE_OPENAI_ENDPOINT}} \ |
| 90 | + ${hostNetFlag} \ |
| 91 | + --name autogen-agent \ |
| 92 | + {{ .IMAGE_REPO }}/csit/test-autogen-agent:{{ .TEST_APP_TAG }} \ |
| 93 | + poetry run python autogen_agent.py -g ${hostMachine} |
| 94 | +
|
| 95 | + test:autogen-agent:remove: |
| 96 | + internal: true |
| 97 | + cmds: |
| 98 | + - docker stop $(docker ps -a --no-trunc --filter name=^/autogen-agent$ -q) |
| 99 | + |
| 100 | + test: |
| 101 | + desc: All gateway test |
| 102 | + cmds: |
| 103 | + - task: k8s:port-forward:setup |
| 104 | + - defer: { task: k8s:port-forward:teardown } |
| 105 | + - task: test:autogen-agent:run |
| 106 | + - defer: { task: test:autogen-agent:remove } |
| 107 | + - docker pull {{ .IMAGE_REPO }}/csit/test-langchain-agent:{{ .TEST_APP_TAG }} |
| 108 | + - REMOVE_CONTAINERS={{.REMOVE_CONTAINERS}} RUNNER_TYPE={{.RUNNER_TYPE}} IMAGE_REPO={{.IMAGE_REPO}} TEST_APP_TAG={{.TEST_APP_TAG}} go test ./tests -v -failfast -test.v -test.paniconexit0 -ginkgo.timeout 30m -timeout 30m -ginkgo.v |
0 commit comments