From 0ee4dac5396566bb91c48c7e6b76dd9b6aacbca0 Mon Sep 17 00:00:00 2001 From: Esteban Ricardo Mirizio Date: Thu, 13 Jul 2023 16:38:56 -0300 Subject: [PATCH] test new workflow --- .github/workflows/tests.yml | 79 ++++++++++++------------------------- auto/deps.yml | 9 +---- auto/pro.yml | 20 +++------- auto/test.env | 10 ++--- 4 files changed, 38 insertions(+), 80 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 52ab8886..73d29eb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,47 +55,9 @@ permissions: contents: read # This is required for actions/checkout jobs: - ecr-login: - name: ecr-passwd - runs-on: ubuntu-latest - - outputs: - aws-ecr-pass: ${{ steps.ecr-pass.outputs.ECR_PASS }} - - steps: - - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk - role-session-name: cipush - aws-region: eu-central-1 - - - name: Get ecr password - id: ecr-pass - run: | - echo "ECR_PASS=$(aws ecr get-login-password --region eu-central-1)" >> "$GITHUB_OUTPUT" - - - name: Create shared docker Volumes for DinD - run: | - docker volume create confs_volume - docker volume create gw_certs_volume - docker volume create graphql_volume - - - -# The job id corresponds to the environment type that the tests will run on pro: name: tyk-automated-tests on Tyk Pro runs-on: ubuntu-latest - needs: ecr-login - container: - image: 754489498669.dkr.ecr.eu-central-1.amazonaws.com/tyk-automated-tests:1.0.0-rc1 - credentials: - username: AWS - password: ${{ needs.ecr-login.outputs.aws-ecr-pass }} - volumes: - - confs_volume:/confs - - gw_certs_volume:/certs - - graphql_volume:/graphql steps: - uses: aws-actions/configure-aws-credentials@v2 @@ -104,22 +66,35 @@ jobs: role-session-name: cipush aws-region: eu-central-1 - - id: ecr - uses: aws-actions/amazon-ecr-login@v1 + - uses: aws-actions/amazon-ecr-login@v1 + id: ecr - uses: actions/checkout@v3 - - - name: Copy files to shared volumes + + - name: env up + working-directory: auto + env: + confs_dir: /__w/tyk-pro/tyk-pro/auto/pro run: | - cp -r $GITHUB_WORKSPACE/auto/pro/* /confs - cp -r /app/ci/certs/* /certs - cp -r /app/ci/graphql-faker/* /graphql + echo "registry=${{ steps.ecr.outputs.registry }} + tyk_sink_image=\${registry}/tyk-sink:${{ inputs.tyk-sink-version || 'v2.1.1' }} + tyk_image=\${registry}/tyk:${{ inputs.tyk-version || 'v4.3.4' }} + tyk_analytics_image=\${registry}/tyk-analytics:${{ inputs.tyk-analytics-version || 'v4.3.3' }} + tyk_pump_image=\${registry}/tyk-pump:${{ inputs.tyk-pump-version || 'v1.7.0' }}" > versions.env + # bring up env + cat versions.env + docker compose -f ${{ github.job }}.yml -f deps.yml --env-file versions.env --env-file tat.env up --quiet-pull -d - name: env up working-directory: auto - # env: - # confs_dir: /__w/tyk-pro/tyk-pro/auto/pro + env: + confs_dir: /__w/tyk-pro/tyk-pro/auto/pro + graphql_data: /__w/tyk-pro/tyk-pro/compose/volumes/test/graphql-faker + certs_dir: /__w/tyk-pro/tyk-pro/compose/volumes/gw/certs run: | + ls $confs_dir + ls $graphql_data + ls $certs_dir echo "registry=${{ steps.ecr.outputs.registry }} tyk_sink_image=\${registry}/tyk-sink:${{ inputs.tyk-sink-version || 'v2.1.1' }} tyk_image=\${registry}/tyk:${{ inputs.tyk-version || 'v4.3.4' }} @@ -132,11 +107,11 @@ jobs: - name: Docker ps if: ${{always()}} run: docker ps - + - name: Docker Compose logs if: ${{failure()}} working-directory: auto - run: docker compose -f ${{ github.job }}.yml -f deps.yml --env-file versions.env --env-file tat.env logs + run: docker compose -f ${{ github.job }}.yml -f deps.yml --env-file versions.env --env-file tat.env logs - name: Waiting for dashboard shell: bash @@ -147,14 +122,12 @@ jobs: docker ps -a docker logs tyk-analytics done - timeout-minutes: 15 + timeout-minutes: 15 - name: Run pytest working-directory: /app run: | - echo "Curl dashboard" - ls . $GITHUB_WORKSPACE/auto/test.env echo "this are env vars" env - pytest tests/gateway_api + docker run ${{ steps.ecr.outputs.registry }}/tyk-automated-tests:1.0.0-rc1 pytest /app/tests/gateway_api diff --git a/auto/deps.yml b/auto/deps.yml index 21c9d18f..9087460c 100644 --- a/auto/deps.yml +++ b/auto/deps.yml @@ -61,8 +61,7 @@ services: container_name: graphql-faker image: apisguru/graphql-faker:latest volumes: - - graphql_volume:/workdir/ - # - ${graphql_data}:/workdir/faker-schema.graphql + - ${graphql_data}:/workdir/faker-schema.graphql command: "faker-schema.graphql" ports: - "9002:9002" @@ -86,8 +85,4 @@ services: redis: condition: service_healthy mongo: - condition: service_healthy - -volumes: - graphql_volume: - external: true \ No newline at end of file + condition: service_healthy \ No newline at end of file diff --git a/auto/pro.yml b/auto/pro.yml index 1e647fbf..05edaa04 100644 --- a/auto/pro.yml +++ b/auto/pro.yml @@ -6,10 +6,8 @@ services: env_file: - tyk.env volumes: - # - ${certs_dir}:/etc/ssl/certs - - gw_certs_volume:/etc/ssl/certs/ - # - ${confs_dir}:/conf/ - - confs_volume:/conf/ + - ${certs_dir}:/etc/ssl/certs + - ${confs_dir}:/conf/ ports: - "6000:6000" - "8003:8003" @@ -25,8 +23,7 @@ services: container_name: tyk-analytics image: ${tyk_analytics_image} volumes: - # - ${confs_dir}:/conf/ - - confs_volume:/conf/ + - ${confs_dir}:/conf/ ports: - "3000:3000" - "5000:5000" @@ -40,8 +37,7 @@ services: container_name: tyk-pump image: ${tyk_pump_image} volumes: - # - ${confs_dir}:/conf/ - - confs_volume:/conf + - ${confs_dir}:/conf/ ports: - "8061:8061" env_file: @@ -72,10 +68,4 @@ services: image: hello-world:linux depends_on: gateway-checker: - condition: service_healthy - -volumes: - confs_volume: - external: true - gw_certs_volume: - external: true + condition: service_healthy \ No newline at end of file diff --git a/auto/test.env b/auto/test.env index 2e33ab73..d4f6fb61 100644 --- a/auto/test.env +++ b/auto/test.env @@ -1,10 +1,10 @@ -TYK_TEST_BASE_URL=http://localhost:3000/ -TYK_TEST_GW_URL=https://localhost:8080/ -TYK_TEST_MONGODB=localhost:27017 -TYK_TEST_REDIS=localhost +TYK_TEST_BASE_URL=http://tyk-analytics:3000/ +TYK_TEST_GW_URL=https://tyk:8080/ +TYK_TEST_MONGODB=mongo:27017 +TYK_TEST_REDIS=redis TYK_TEST_DB_ADMIN=12345 TYK_TEST_GW_SECRET=352d20ee67be67f6340b4c0605b044b7 TYK_TEST_DB_NAME=tyk_analytics TYK_TEST_FEDERATION_HOST=federation TYK_TEST_GRAPHQL_FAKER_HOST=graphql-faker -TYK_TEST_GRAPHQL_FAKER_SCHEMA_PATH=test-data/graphql-faker/faker-schema.graphql +TYK_TEST_GRAPHQL_FAKER_SCHEMA_PATH=test-data/graphql-faker/faker-schema.graphql \ No newline at end of file