Skip to content

Commit

Permalink
test: use local httpbin container on github CI's (#29067)
Browse files Browse the repository at this point in the history
  • Loading branch information
murtaza98 authored and sampaiodiego committed Jun 7, 2023
1 parent 924c3ef commit 1e1f467
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions apps/meteor/tests/end-to-end/api/livechat/06-integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
Expand All @@ -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);
});
});
Expand Down
5 changes: 3 additions & 2 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -110,7 +111,7 @@ services:
- 'host.docker.internal:host-gateway'
depends_on:
- nats

queue-worker-service:
platform: linux/amd64
build:
Expand All @@ -126,7 +127,7 @@ services:
- 'host.docker.internal:host-gateway'
depends_on:
- nats

omnichannel-transcript-service:
platform: linux/amd64
build:
Expand Down

0 comments on commit 1e1f467

Please sign in to comment.