From 1e1f4674dda5524bf583039363301004860116a3 Mon Sep 17 00:00:00 2001 From: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com> Date: Wed, 17 May 2023 19:42:09 +0530 Subject: [PATCH] test: use local httpbin container on github CI's (#29067) --- .github/workflows/ci-test-e2e.yml | 17 +++++++++++++++++ .../end-to-end/api/livechat/06-integrations.ts | 7 +++---- docker-compose-ci.yml | 5 +++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-test-e2e.yml b/.github/workflows/ci-test-e2e.yml index a091508b0fa3..2fca0c3e36ac 100644 --- a/.github/workflows/ci-test-e2e.yml +++ b/.github/workflows/ci-test-e2e.yml @@ -96,6 +96,23 @@ jobs: - uses: dtinth/setup-github-actions-caching-for-turbo@v1 + - name: Start httpbin container and wait for it to be ready + run: | + docker run -d -p 10000:80 --name httpbin-container kennethreitz/httpbin + i=0 + while [ $i -lt 10 ]; do + if curl -s -o /dev/null http://localhost:10000; then + echo "httpbin is running" + break + fi + i=$((i + 1)) + sleep 5 + done + if [ $i -eq 10 ]; then + echo "Failed to verify httpbin is running" + exit 1 + fi + - name: yarn build run: yarn build diff --git a/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts b/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts index 64a447a4ac47..a772ee87cd8c 100644 --- a/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts +++ b/apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts @@ -122,6 +122,7 @@ describe('LIVECHAT - Integrations', function () { }); describe('Livechat - Webhooks', () => { + const webhookUrl = process.env.WEBHOOK_TEST_URL || 'https://httpbin.org'; describe('livechat/webhook.test', () => { it('should fail when user doesnt have view-livechat-webhooks permission', async () => { await updatePermission('view-livechat-webhooks', []); @@ -136,14 +137,12 @@ describe('LIVECHAT - Integrations', function () { expect(response.body).to.have.property('success', false); }); it('should return true if webhook test went good', async () => { - await updateSetting('Livechat_webhookUrl', 'https://httpbin.org/status/200'); - await setTimeout(() => null, 1000); + await updateSetting('Livechat_webhookUrl', `${webhookUrl}/status/200`); const response = await request.post(api('livechat/webhook.test')).set(credentials).expect(200); expect(response.body.success).to.be.true; }); it('should fail if webhook test went bad', async () => { - await updateSetting('Livechat_webhookUrl', 'https://httpbin.org/status/400'); - await setTimeout(() => null, 1000); + await updateSetting('Livechat_webhookUrl', `${webhookUrl}/status/400`); await request.post(api('livechat/webhook.test')).set(credentials).expect(400); }); }); diff --git a/docker-compose-ci.yml b/docker-compose-ci.yml index 160cd869056f..b5462cd1f7e3 100644 --- a/docker-compose-ci.yml +++ b/docker-compose-ci.yml @@ -15,6 +15,7 @@ services: - 'TRANSPORTER=${TRANSPORTER}' - MOLECULER_LOG_LEVEL=info - 'ROCKETCHAT_LICENSE=${ENTERPRISE_LICENSE}' + - 'WEBHOOK_TEST_URL=host.docker.internal:10000' extra_hosts: - 'host.docker.internal:host-gateway' depends_on: @@ -110,7 +111,7 @@ services: - 'host.docker.internal:host-gateway' depends_on: - nats - + queue-worker-service: platform: linux/amd64 build: @@ -126,7 +127,7 @@ services: - 'host.docker.internal:host-gateway' depends_on: - nats - + omnichannel-transcript-service: platform: linux/amd64 build: