From ebfac3032828938c6d0993e91a6377a233e93dda Mon Sep 17 00:00:00 2001 From: Christopher Sunkel Date: Wed, 20 Nov 2024 21:38:40 +0000 Subject: [PATCH] Stop spinning up ActivityStream in e2e suite (#7333) --- docker-compose.e2e.backend.yml | 44 ------------------------------ docs/Running tests.md | 46 -------------------------------- test/end-to-end/proxy/Dockerfile | 3 --- test/end-to-end/proxy/nginx.conf | 30 --------------------- 4 files changed, 123 deletions(-) delete mode 100644 test/end-to-end/proxy/Dockerfile delete mode 100644 test/end-to-end/proxy/nginx.conf diff --git a/docker-compose.e2e.backend.yml b/docker-compose.e2e.backend.yml index bb9564c1ff5..ea4ed216835 100644 --- a/docker-compose.e2e.backend.yml +++ b/docker-compose.e2e.backend.yml @@ -16,12 +16,6 @@ services: COLUMNS: 80 DJANGO_SUPERUSER_SSO_EMAIL_USER_ID: test@gov.uk ALLOW_TEST_FIXTURE_SETUP: 'True' - ACTIVITY_STREAM_OUTGOING_URL: http://activity-feed-reverseproxy:8081/v2/activities - ACTIVITY_STREAM_OUTGOING_ACCESS_KEY_ID: incoming-some-id-1 - ACTIVITY_STREAM_OUTGOING_SECRET_ACCESS_KEY: incoming-some-secret-1 - ACTIVITY_STREAM_ACCESS_KEY_ID: some-id - ACTIVITY_STREAM_SECRET_ACCESS_KEY: some-secret - ACTIVITY_STREAM_INCOMING_SECRET_ACCESS_KEY: some-secret DATABASE_CREDENTIALS: '{"username": "postgres", "password": "datahub", "engine": "postgres", "port": 5432, "dbname": "datahub", "host": "postgres", "dbInstanceIdentifier": "db-instance"}' ports: - 8000:8000 @@ -70,41 +64,3 @@ services: - DISABLE_SECURITY_PLUGIN=true # Disables security plugin logging: driver: none - - activity-feed-reverseproxy: - build: ./test/end-to-end/proxy - ports: - - 8081:8081 - depends_on: - - activity-feed - logging: - driver: none - - activity-feed: - build: https://github.com/uktrade/activity-stream.git - depends_on: - - postgres - - opensearch - - redis - - api - ports: - - 8082:8082 - environment: - - PORT=8082 - - REDIS_URL=redis://redis:6379 - - OPENSEARCH=http://some-id:some-secret@opensearch:9200 - - SENTRY_ENVIRONMENT=test - - SENTRY_DSN=http://abc:cvb@localhost:9872/123 - - FEEDS__1__UNIQUE_ID=verification_feed_app - - FEEDS__1__SEED=http://api:8000/v3/activity-stream/event - - FEEDS__1__ACCESS_KEY_ID=some-id - - FEEDS__1__SECRET_ACCESS_KEY=some-secret - - FEEDS__1__TYPE=activity_stream - - INCOMING_ACCESS_KEY_PAIRS__1__KEY_ID=incoming-some-id-1 - - INCOMING_ACCESS_KEY_PAIRS__1__SECRET_KEY=incoming-some-secret-1 - - INCOMING_ACCESS_KEY_PAIRS__1__PERMISSIONS__activities__1=__MATCH_ALL__ - - INCOMING_ACCESS_KEY_PAIRS__1__PERMISSIONS__objects__1=__MATCH_ALL__ - - INCOMING_IP_WHITELIST__1=1.2.3.4 - - INCOMING_IP_WHITELIST__2=2.3.4.5 - logging: - driver: none diff --git a/docs/Running tests.md b/docs/Running tests.md index d9f98734952..46f72ed6f21 100644 --- a/docs/Running tests.md +++ b/docs/Running tests.md @@ -106,52 +106,6 @@ Ensure you have [node](https://nodejs.org/en/download/) v10 installed then insta 1. Add `ALLOW_TEST_FIXTURE_SETUP=True` to `.env` in Data Hub API. -### Activity feed - -Events displayed inside Datahub are provided via the [activity stream API](https://github.com/uktrade/activity-stream), which wraps an OpenSearch cluster. Events created as part of any test runs need to be visible to the activity stream so they can be viewed in the events page. The activity stream polls the Datahub API to ingest any new events created, so the `docker-compose.yml` file uses environment variables to setup the access keys to allow the communication between these 2 systems: - -#### The API environment variables that define the access keys that need to be used when activity stream call the events endpoint - -``` -ACTIVITY_STREAM_ACCESS_KEY_ID: some-id -ACTIVITY_STREAM_INCOMING_ACCESS_KEY_ID: some-id -ACTIVITY_STREAM_SECRET_ACCESS_KEY: some-secret -ACTIVITY_STREAM_INCOMING_SECRET_ACCESS_KEY: some-secret -``` - -#### The activity stream environment variables that set the API as a feed to call to ingest data from. The FEEDS**1**ACCESS_KEY_ID and FEEDS**1**SECRET_ACCESS_KEY values match the values defined in the API environment variables - -``` -FEEDS__1__UNIQUE_ID=verification_feed_app -FEEDS__1__SEED=http://api:8000/v3/activity-stream/event -FEEDS__1__ACCESS_KEY_ID=some-id -FEEDS__1__SECRET_ACCESS_KEY=some-secret -FEEDS__1__TYPE=activity_stream -``` - -The activity stream has a 2 way relationship with datahub - in addition to polling the Datahub API for any new events that can be ingested into the OpenSearch DB, it also provides an API that allows searching of the events it holds. Environment varaibles are again used to control access between these 2 systems - -#### The activity stream environment variables that define the access keys that need to be provided when any queries are made - -``` -INCOMING_ACCESS_KEY_PAIRS__1__KEY_ID=incoming-some-id-1 -INCOMING_ACCESS_KEY_PAIRS__1__SECRET_KEY=incoming-some-secret-1 -``` - -#### The API environment variables that set the activity stream endpoint to use to get a list of events - -Please see for [here](#ngnix-reverse-proxy) more detail about the reason for a reverse proxy - -``` -ACTIVITY_STREAM_OUTGOING_URL: http://activity-feed-reverseproxy:8081/v2/activities -ACTIVITY_STREAM_OUTGOING_ACCESS_KEY_ID: incoming-some-id-1 -ACTIVITY_STREAM_OUTGOING_SECRET_ACCESS_KEY: incoming-some-secret-1 -``` - -#### Ngnix reverse proxy - -The E2E tests make use of an ngnix container to replicate the GOV PAAS functionality. The activity stream requires specific HTTP Headers to be included that are provided by GOV PAAS, nginx is used here to attach those headers to all requests to the activity stream without requiring any code changes - ### Running the tests Notice that before running the tests the application should be up and running. diff --git a/test/end-to-end/proxy/Dockerfile b/test/end-to-end/proxy/Dockerfile deleted file mode 100644 index 9e620aff0e2..00000000000 --- a/test/end-to-end/proxy/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM nginx:alpine - -COPY nginx.conf /etc/nginx/nginx.conf diff --git a/test/end-to-end/proxy/nginx.conf b/test/end-to-end/proxy/nginx.conf deleted file mode 100644 index 1adf1c14ce7..00000000000 --- a/test/end-to-end/proxy/nginx.conf +++ /dev/null @@ -1,30 +0,0 @@ -worker_processes 1; - -events { worker_connections 1024; } - -http { - - sendfile on; - - upstream docker-activity-feed { - server activity-feed:8082; - } - - server { - listen 8081; - - location / { - proxy_set_header Host $host:$server_port; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For 1.2.3.4,2.3.4.5; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $host:$server_port; - - proxy_set_header Authorization $http_authorization; - proxy_pass_header Authorization; - - proxy_pass http://docker-activity-feed; - proxy_redirect off; - } - } -}