Skip to content

Commit 114a0ca

Browse files
bwang-icfclewellyn-navaryan-morosaJamesDemeryNavaannamontare-nava
authored
Brandon/bb2 4669 selenium redo (#1638)
* initial commit * add more boiler code * initial attempt at running api in codebuild runner * renive okd byukd oridyctuib cide * re-enable workflow dispatch * typo in compose * fix dockerfile * final initial changset 400 * fix path * 3rd time is the charm * path change again * fixed part 1003231 * fixing paths * use make for codebuild instance * I don't understand file paths * using the power of root paths * what if there were even more path changes * fix path * fix some more stuff * more path fixes * minor spelling mistake * one day..... * more path fixes * more changes * cooking with gas * maybe last changes but probably not * remove debugpy * cleaning some stuff up * remove return exit code * check db path * remove readonly from codebuild * attempt number 5000 * added integration tests and teardown * paths!!! * paths part 2 * almost there * still file paths * I hate you file paths * more path shenanigans * tests run but they error out now * unnecessary makefile changes * makefile beautification (also fix relative paths for docker) * make migrate simpler (scope creep) * cleanup env, make some make changes, migrate and collectstatic work * change mslsx for better teardown * podman support (does the database need a persistence volume?) * persist database locally * this worked before and now it doesn't * test certificate issue * tabs * not sure what changed here * change podman tmpfs which doesnt work in docker * cleaning up files * change makefile targets * lower tmp size in codebuild * check memory in action * not anything * add explicit env file * up memory limit on tmp * add container env to codebuild instance, remove from integration test * remove unused envvars * MAYBE? * ruff failure * Fail unit tests * change unit tests back * ruff failure * fail unit test * Fix unit tests * BB2-4183: Dynamic v3 Permissions Screen (#1531) * BB2-4183: Dynamic permissions screen for v3 * Add unit testing * Raise a no scopes provided error if there are no scopes in the DB for an app, or if the scopes passed in the scope param has no overlap with an app's scopes in DB * Ensure v3 only shows scopes that are both requested/in the DB * Add another unit test * Added bene name, some styling * Add svg icon, modify some styling, add unit tests * Finish up styling and make sure Rubik font shows correctly * New tab for privacy policy/ToS links and add icon for those as well * Modify format_patient_name, add profile to list of scopes that shows patient info on v3 permissions screen * BB2-4676: SAMHSA filtering v3 EOB calls (#1595) * Add param support for EOB call * BB2-4676: Add SAMHSA filtering for v3 EOB calls based on include_samhsa value * Add back ioncorrectly removed tag and override_switch on integration test * Use httpstatus.ok instead of 200 and remove commented out line * Address PR feedback * anna/bb2 4818 display app contact in permissions screen (#1606) Displays an application's contact email in the v3 permissions screen. * add application support email to v3 permissions screen * add changes to authorize_v3_coverage_only.html * match wording in figma files * fix template formatting * update contributors information (#1608) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Make apt get install Debian:13 lcms2 to version 2.16-2+deb13u2 (#1610) * Bump the pip group across 1 directory with 2 updates (#1601) * Bump the pip group across 1 directory with 2 updates Bumps the pip group with 2 updates in the /requirements directory: [idna](https://github.com/kjd/idna) and [urllib3](https://github.com/urllib3/urllib3). Updates `idna` from 3.7 to 3.15 - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md) - [Commits](kjd/idna@v3.7...v3.15) Updates `urllib3` from 2.6.3 to 2.7.0 - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](urllib3/urllib3@2.6.3...2.7.0) --- updated-dependencies: - dependency-name: idna dependency-version: '3.15' dependency-type: direct:production - dependency-name: urllib3 dependency-version: 2.7.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Add back our via value --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Demery <jamesdemery@navapbc.com> * (NFC) Update synthetic beneficiary test password (#1609) * Fix integration test (#1600) * ryan-morosa/bb2-4860-respect-app-settings-follow-up (#1603) * Fix the search vs.read functionality * Work on more testing * Get unit tests to work for FHIRResourcesReadSearchTest * BB2-4183: Dynamic v3 Permissions Screen (#1531) * BB2-4183: Dynamic permissions screen for v3 * Add unit testing * Raise a no scopes provided error if there are no scopes in the DB for an app, or if the scopes passed in the scope param has no overlap with an app's scopes in DB * Ensure v3 only shows scopes that are both requested/in the DB * Add another unit test * Added bene name, some styling * Add svg icon, modify some styling, add unit tests * Finish up styling and make sure Rubik font shows correctly * New tab for privacy policy/ToS links and add icon for those as well * Modify format_patient_name, add profile to list of scopes that shows patient info on v3 permissions screen * BB2-4676: SAMHSA filtering v3 EOB calls (#1595) * Add param support for EOB call * BB2-4676: Add SAMHSA filtering for v3 EOB calls based on include_samhsa value * Add back ioncorrectly removed tag and override_switch on integration test * Use httpstatus.ok instead of 200 and remove commented out line * Address PR feedback * Fix some more integration tests * Get more integration tests to pass * Get all tests passing * Do some cleanup * Cleanup database setup commands * Remove from audit logger * Final cleanup * Cleanup some of the app scope permission code * Add app scope permission class to insurance card view * Add bundle for dic endpoint * Get insurance card endpoint to work with app scope permissions too * Update logic in read/search section of app scope permissions * Get rid of is_not_empty and rename dictionary lookup --------- Co-authored-by: James Demery <jamesdemery@navapbc.com> * BB2-4817 run scheduled django commands on GitHub Actions (#1604) Run scheduled Django management commands on GitHub actions. * add workflow_call to run-manage-command.yml and add scheduled commands workflow * add name for workflow * fix syntax * fix syntax (2) * fix syntax (3) * fix syntax (4) * update input description * add fail-fast: false and inherit secrets --------- Co-authored-by: James Demery <jamesdemery@navapbc.com> * update contributors information (#1612) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Noor1027/bb2 4604 prod fargate release clean (#1611) * BB2-4604: add prod SOPS config and fix ACM cert lookup for prod environment Set ACM domain to api.bluebutton.cms.gov in 20-microservices platform module since the default domain pattern does not match the prod cert. Add encrypted SOPS config for the prod environment. * updated SOPS and softlink * skip environment protection for workflow_call * fix environment protection bypass using skip_protection input * Rename test job to unit-test in workflow (#1613) Co-authored-by: ryan-morosa <Ryan.Morosa@icf.com> * BB2-4781: Revoke prior tokens on new auth flow (#1605) * BB2-4781: Revoke prior tokens on new auth flow * Ensure token revocation only happens on v3 auth flows * Move the revocation of prior tokens to form_valid of AuthorizationView from post of TokenView. Revoke all previous tokens as the newest one will not have been created yet at that point * Address PR feedback, remove no longer needed test * Address feedback - use previously existing utils function * Fix typo * Add unit test coverage * Delete unit test yaml file * Try to run sequentially * Add some debugging steps * change some of the commands * Get rid of inspection * Get back to normal * added validation around code_challenge_method to reject non S256 values (#1599) * added validation around code_challenge_method to reject non S256 values * intermediate commit * Fix authorize POST param handling in code_challenge_method validation Agent-Logs-Url: https://github.com/CMSgov/bluebutton-web-server/sessions/ec2649c7-d427-4f59-ad18-098613b75e4e Co-authored-by: bwang-icf <178809349+bwang-icf@users.noreply.github.com> * Remove stale commented lines in authorization GET handler Agent-Logs-Url: https://github.com/CMSgov/bluebutton-web-server/sessions/ec2649c7-d427-4f59-ad18-098613b75e4e Co-authored-by: bwang-icf <178809349+bwang-icf@users.noreply.github.com> * cleanup of previous pkce setup * removing unnecessary error handling * adding updated tests with pkce params as part of enforcing pkce params on auth * adding extra tests for pkce param verification before login * removing unnecessary change for this pr * reverting code_challenge_method back to post_auth * removing invalid code challenge method printing --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bwang-icf <178809349+bwang-icf@users.noreply.github.com> Co-authored-by: annamontare-nava <267455234+annamontare-nava@users.noreply.github.com> * Noor1027/bb2 4816 release notes missing last commit (#1616) * Bug fix publish-release.yml always drops the oldest commit from release notes * temp change to run GHA * Revert "temp change to run GHA" This reverts commit dae8864. * BB2-4675: Add SAMHSA checkbox to v3 permissions screen (#1607) * BB2-4675: Add SAMHSA checkbox to v3 permissions screen * Use cache.add instead of cache.set, modify default for code * Address PR feedback - add docstrings * Add a new table to track user SAMHSA preferences rather than use caching * Address PR feedback * Remove commented out line * Address copilot feedback * Convert share_samhsa_data to a BooleanField to make the code less confusing * Revert "BB2-4675: Add SAMHSA checkbox to v3 permissions screen (#1607)" (#1619) This reverts commit e1b0b7b. * BB2-4890 - Add Fargate pre-deploy migrations safety gate * Revert "BB2-4890 - Add Fargate pre-deploy migrations safety gate" This reverts commit ffc450b. * update sops values (#1617) Co-authored-by: James Demery <jamesdemery@navapbc.com> * BB2-4851: Update lodash (#1621) * BB2-4851: Update lodash * Fix new vulnerability that popped up * BB2-4845: Update libgnutls (#1618) * BB2-4845: Update libgnutls * Update bb-css Dockerfile * Update gnutls in mslsx Dockerfile * Revert file mode change * docs(contributor): contributors readme action update (#1624) * update contributors information * Trigger unit tests --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: James Demery <jamesdemery@navapbc.com> * BB2-4574: Run unit and integration tests with pytest (#1614) * BB2-4574: Install pytest-django and add .ini file * Add conftest.py file, skip one test file, add a fixture * Add pytest.mark.integration, update ini file * Ensure all unit and integration tests pass with pytest, update some docs * removed unneeded code from conftest.py * Update unit test command for GHA * Remove commented out code * Address most PR feedback - still have documentation updates to make * Update documentation to reflect latest * Add strict-markers to toml file * B2-4890 Add pre/post-deploy migration support to Fargate deploy workflow (#1623) * masking hostname and removed gates * Update run-manage-command.yml * updated task def * removed multiple env for confirm apporvals * Updated Gate Approval for Post deploy * Fix New Relic reporting 401, 403, and 405 errors in Fargate * Fix New Relic ignoring status codes by dynamically creating config file on startup --------- Co-authored-by: jimmyfagan <90421499+jimmyfagan@users.noreply.github.com> * upgrading with npm --legacy-peer-deps (#1626) * Change workflow to run on push to any branch * Try just one test * Update docker compose codebuild to have no volumes * Roll back to run all integration tests * change it to run integration tests with pytest * Add aws credentials setup * testing certs * catch OOM traceback * Update Makefile * masking for test * test with codebuild VPC updates * Target impl for integration tests * adding health to chek certs are exisit * See if integration tag is working properly * Change the github action to use pytest instead of the old way * Separate out ruff and unit test jobs * Change back to regular integration testing bfd test * Only collect the ones that are deselected to compare * Put the collected tests into a file * Upload collected tests as an artifact to compare locally * Show integration and deslected that weren't integration * try to get deselected test summary in gha * BB2-4675: v3 Permissions Screen SAMHSA Checkbox (#1620) * BB2-4675: Add SAMHSA checkbox to v3 permissions screen * Use cache.add instead of cache.set, modify default for code * Address PR feedback - add docstrings * Add a new table to track user SAMHSA preferences rather than use caching * Address PR feedback * Remove commented out line * Address copilot feedback * Convert share_samhsa_data to a BooleanField to make the code less confusing * Small changes to get it back to the way it was * Delete unit tests yml since it is absorbed by pr checks now * Ensure runnign with bfd sbx locally still works * Help consolidate some of the make file selenium building and running locally * Comment changes * Make test names plural * Ensure we use make integration-test in make file * Change it back to pytest command * attempting selenium tests from exisiting folder * adding trigger to run on push for testing purposes * trying to add AWS creds to see if that allows selenium to work right * fixing external network issue * adding changes from master * explicitly adding localhost * adding wait for chrome * adding build css * changing to install * adding test for medicare.gov connectivity * changing to less specific css click * trying to remove possible duplicate click * committing for now * adding iproute2 * changing update location * adding bind-utils and pull_policy * attempting to run within codebuild * removing needs requirement * adding true to medicare login button * Merge and add Akamai diagnostic step * Merge and add Akamai diagnostic step * MSLSX auth mock for Selenium CI tests * removing requirement on push * removing curl command to akamai * cleanup * making readme updates and removing integration test dependency for now * attempting to fix local running issues --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: clewellyn-nava <connorlewellyn@navapbc.com> Co-authored-by: Ryan Morosa <Ryan.Morosa@icf.com> Co-authored-by: James Demery <jamesdemery@navapbc.com> Co-authored-by: annamontare-nava <267455234+annamontare-nava@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jimmyfagan <90421499+jimmyfagan@users.noreply.github.com> Co-authored-by: noor1027 <noorulla@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bwang-icf <178809349+bwang-icf@users.noreply.github.com>
1 parent 2948606 commit 114a0ca

14 files changed

Lines changed: 273 additions & 29 deletions

.github/workflows/pull-request-checks.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name: Pull Request Checks
33
on:
44
pull_request:
55
branches: [master]
6-
paths-ignore:
7-
- 'docs/**'
8-
- '*.md'
96
workflow_dispatch:
107

118
jobs:
@@ -92,3 +89,58 @@ jobs:
9289
run: |
9390
cd ./ops/containers/bb-api
9491
make teardown-codebuild
92+
93+
selenium-tests:
94+
env:
95+
AWS_REGION: us-east-1
96+
97+
permissions:
98+
id-token: write
99+
contents: read
100+
101+
# This will only run on test
102+
runs-on: codebuild-bb-test-web-server-${{ github.run_id }}-${{ github.run_attempt }}
103+
104+
steps:
105+
- name: Checkout Code
106+
uses: actions/checkout@v4
107+
108+
- name: Setup AWS credentials
109+
uses: ./.github/actions/setup-tofu
110+
with:
111+
environment: test
112+
non-prod-account: ${{ secrets.NON_PROD_ACCOUNT }}
113+
prod-account: ${{ secrets.PROD_ACCOUNT }}
114+
test-role-id: ${{ secrets.TEST_AWS_ROLE_ID_MASK }}
115+
prod-role-id: ${{ secrets.PROD_AWS_ROLE_ID_MASK }}
116+
117+
- name: Build MSLSX
118+
run: |
119+
cd ./ops/containers/mslsx
120+
make build-local
121+
122+
- name: Build BBAPI
123+
run: |
124+
cd ./ops/containers/bb-api
125+
make build-codebuild
126+
127+
- name: Build Selenium
128+
run: |
129+
cd ./ops/containers/bb-api
130+
make build-selenium
131+
132+
- name: Start Stack
133+
run: |
134+
cd ./ops/containers/bb-api
135+
make run-codebuild-mock
136+
137+
- name: Execute Selenium Tests
138+
run: |
139+
cd ./ops/containers/bb-api
140+
make run-codebuild-selenium
141+
142+
- name: Teardown Stack
143+
if: always()
144+
run: |
145+
cd ./ops/containers/bb-api
146+
make teardown-codebuild-selenium

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM --platform=linux/amd64 python:3.12
22
ENV PYTHONUNBUFFERED 1
33
ENV PYDEVD_DISABLE_FILE_VALIDATION 1
4-
RUN apt-get update && apt-get install -y gettext liblcms2-2=2.16-2+deb13u2 libgnutls30t64=3.8.9-3+deb13u4
4+
RUN apt-get update && apt-get install -y gettext liblcms2-2=2.16-2+deb13u2 libgnutls30t64=3.8.9-3+deb13u4 libssh2-1t64=1.11.1-1+deb13u1
55
RUN useradd -m -s /bin/bash DEV
66
USER DEV
77
ADD . /code

apps/dot_ext/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def validate_client_id(client_id: str) -> None:
4747
InvalidClientError: If the client_id does not match the expected pattern.
4848
"""
4949
env = os.environ.get('TARGET_ENV', 'local')
50-
if env == 'local':
50+
if env in ('local', 'codebuild'):
5151
return
5252
if not CLIENT_ID_PATTERN.fullmatch(client_id):
5353
raise InvalidClientError(

ops/containers/bb-api/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ RUN dnf install -y \
3535
awscli \
3636
procps-ng \
3737
python3.12 \
38+
bind-utils \
3839
shadow-utils && dnf clean all && rm -rf /var/cache/dnf
3940

4041
#################################################################

ops/containers/bb-api/Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ bfd ?= test
55
env ?= local
66
auth ?= live
77

8-
.PHONY: build-local build-local-no-cache build-codebuild run-codebuild \
9-
run-codebuild-integration teardown-codebuild run-local
8+
.PHONY: build-local build-local-no-cache build-codebuild build-selenium \
9+
run-codebuild run-codebuild-mock run-codebuild-integration run-codebuild-selenium \
10+
teardown-codebuild teardown-codebuild-selenium run-local
1011

1112
build-local:
1213
@echo "Building local"
@@ -29,11 +30,19 @@ build-codebuild:
2930
--build-arg BUILD_TARGET="codebuild" \
3031
-t bb-api:codebuild -f Dockerfile ../../..
3132

33+
build-selenium:
34+
$(MAKE) -C ../selenium build-selenium
35+
3236
run-codebuild:
3337
@echo "Running codebuild environment"
3438
bfd="test" env="test" auth="live" TARGET_ENV="codebuild" \
3539
bash $(ROOT_DIR)/scripts/external/prepare-environment.bash
3640

41+
run-codebuild-mock:
42+
@echo "Running codebuild environment with auth=mock"
43+
bfd="test" env="test" auth="mock" TARGET_ENV="codebuild" \
44+
bash $(ROOT_DIR)/scripts/external/prepare-environment.bash
45+
3746
run-codebuild-integration:
3847
@echo "integration tests in Codebuild"
3948
docker compose \
@@ -43,6 +52,16 @@ run-codebuild-integration:
4352
teardown-codebuild:
4453
docker compose -f ../docker-compose-codebuild.yaml down -v
4554

55+
run-codebuild-selenium:
56+
@echo "selenium tests in Codebuild"
57+
docker compose \
58+
-f ../docker-compose-codebuild-selenium.yaml \
59+
run --rm selenium-tests
60+
61+
teardown-codebuild-selenium:
62+
docker compose -f ../docker-compose-codebuild-selenium.yaml down -v || true
63+
docker compose -f ../docker-compose-codebuild.yaml down -v
64+
4665
run-local:
4766
bfd="$(bfd)" env="$(env)" auth="$(auth)" TARGET_ENV="local" \
4867
bash $(ROOT_DIR)/scripts/external/prepare-environment.bash

ops/containers/bb-api/scripts/external/prepare-environment-support.bash

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,17 @@ configure_slsx () {
248248
export DJANGO_USER_ID_ITERATIONS="2"
249249
DJANGO_MEDICARE_SLSX_REDIRECT_URI="http://localhost:8000/mymedicare/sls-callback"
250250
DJANGO_MEDICARE_SLSX_LOGIN_URI="http://localhost:8080/sso/authorize?client_id=bb2api"
251-
DJANGO_SLSX_HEALTH_CHECK_ENDPOINT="http://msls:8080/health"
252-
DJANGO_SLSX_TOKEN_ENDPOINT="http://msls:8080/sso/session"
253-
DJANGO_SLSX_SIGNOUT_ENDPOINT="http://msls:8080/sso/signout"
254-
DJANGO_SLSX_USERINFO_ENDPOINT="http://msls:8080/v1/users"
251+
252+
if [[ "${TARGET_ENV}" == "codebuild" ]]; then
253+
MSLSX_HOST="localhost"
254+
else
255+
MSLSX_HOST="mslsx"
256+
fi
257+
258+
DJANGO_SLSX_HEALTH_CHECK_ENDPOINT="http://${MSLSX_HOST}:8080/health"
259+
DJANGO_SLSX_TOKEN_ENDPOINT="http://${MSLSX_HOST}:8080/sso/session"
260+
DJANGO_SLSX_SIGNOUT_ENDPOINT="http://${MSLSX_HOST}:8080/sso/signout"
261+
DJANGO_SLSX_USERINFO_ENDPOINT="http://${MSLSX_HOST}:8080/v1/users"
255262

256263
DJANGO_SLSX_CLIENT_ID=bb2api
257264
DJANGO_SLSX_CLIENT_SECRET="xxxxx"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
services:
2+
####################
3+
# Selenium Tests - Codebuild
4+
selenium-tests:
5+
image: selenium-local:latest
6+
command: /code/ops/containers/selenium/start-selenium-codebuild.sh
7+
network_mode: "host"
8+
depends_on:
9+
chrome:
10+
condition: service_healthy
11+
environment:
12+
- HOSTNAME_URL=http://localhost:8000
13+
- USE_MSLSX=true
14+
- USE_LOGIN_WITH_MEDICARE_BUTTON=true
15+
- USE_NEW_PERM_SCREEN=true
16+
- DJANGO_SETTINGS_MODULE=hhs_oauth_server.settings.test
17+
- SELENIUM_GRID=true
18+
- SELENIUM_GRID_HOST=localhost
19+
- DEBUG_MODE=false
20+
- TARGET_ENV=codebuild
21+
- PYTEST_SHOW_TRACE_OPT=
22+
volumes:
23+
- type: bind
24+
source: ../..
25+
target: /code
26+
####################
27+
# Chrome for Selenium Remote
28+
chrome:
29+
image: selenium/standalone-chromium
30+
hostname: chrome
31+
network_mode: "host"
32+
healthcheck:
33+
test: ["CMD-SHELL", "curl -f http://localhost:4444/wd/hub/status || exit 1"]
34+
interval: 5s
35+
timeout: 3s
36+
retries: 10
37+
start_period: 10s

ops/containers/docker-compose-codebuild.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33
# Blue Button - Codebuild
44
bb-api:
55
image: bb-api:codebuild
6+
pull_policy: never
67
network_mode: "host"
78
env_file: ./bb-api/files/external/.env.codebuild
89
healthcheck:
@@ -11,3 +12,11 @@ services:
1112
timeout: 2s
1213
retries: 30
1314
start_period: 90s
15+
16+
####################
17+
# Local MSLS server for Selenium Auth Mock
18+
mslsx:
19+
image: mslsx:latest
20+
pull_policy: never
21+
network_mode: "host"
22+
command: scripts/internal/entrypoint.bash

ops/containers/selenium/Dockerfile.selenium

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM selenium/standalone-chromium
22

33
USER root
44

5-
RUN apt-get update ; apt-get install -yq python3 python3-venv socat
5+
RUN apt-get update ; apt-get install -yq python3 python3-venv socat iproute2
66
RUN ln -s /usr/bin/python3 /usr/local/bin/python
77

88
# switch to existing seluser from selenium docker

ops/containers/selenium/README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ This document describes the selenium test harness for Blue Button
77
## Overview
88

99
- Selenium tests are run inside a Docker image (`selenium-local:latest`) defined in `ops/containers/selenium/Dockerfile.selenium`.
10-
- The compose file `ops/containers/selenium/docker-compose-selenium.yaml` starts two services:
10+
- Locally, the compose file `ops/containers/selenium/docker-compose-selenium.yaml` starts two services:
1111
- `selenium-tests` — Django app / Selenium instance / do-it-all
1212
- `chrome` — a standalone Chrome instance for hitting local and remote
13-
- Tests are invoked via the helper Makefile in `ops/containers`
13+
- In CI (CodeBuild), the compose file `ops/containers/docker-compose-codebuild-selenium.yaml` starts:
14+
- `selenium-tests` — runs the pytest Selenium suite
15+
- `chrome` — standalone Chrome
16+
- `mslsx` — the mock SLS (Medicare login) service used in place of live SLSx
17+
- Tests are invoked via the helper Makefiles in `ops/containers/bb-api` (CI) and `ops/containers/selenium` (local).
1418

1519
---
1620

@@ -63,3 +67,51 @@ All of these can be run from root.
6367
make run-selenium-local auth=live debug=true
6468

6569
---
70+
71+
## CI / Pull Request Checks
72+
73+
The `selenium-tests` job in `.github/workflows/pull-request-checks.yml` runs the
74+
Selenium suite inside the CodeBuild runner on every pull request against `master`
75+
(and on new commits pushed to a PR branch). It uses the **mock SLS** (`mslsx`)
76+
service rather than the live SLSx endpoints.
77+
78+
All commands are driven through the helper targets in
79+
`ops/containers/bb-api/Makefile`. The job runs them in this order:
80+
81+
1. **Build MSLSX**`cd ops/containers/mslsx && make build-local`
82+
Builds the `mslsx:latest` mock Medicare login image.
83+
84+
2. **Build BBAPI**`cd ops/containers/bb-api && make build-codebuild`
85+
Builds the `bb-api:codebuild` application image.
86+
87+
3. **Build Selenium**`cd ops/containers/bb-api && make build-selenium`
88+
Delegates to `ops/containers/selenium` to build `selenium-local:latest`.
89+
90+
4. **Start Stack**`cd ops/containers/bb-api && make run-codebuild-mock`
91+
Brings up the CodeBuild stack with `auth=mock`, so `bb-api` points at the
92+
`mslsx` endpoints instead of live SLSx.
93+
94+
5. **Execute Selenium Tests**`cd ops/containers/bb-api && make run-codebuild-selenium`
95+
Runs the `selenium-tests` service from
96+
`ops/containers/docker-compose-codebuild-selenium.yaml`, which also starts the
97+
`mslsx` and `chrome` services.
98+
99+
6. **Teardown Stack**`cd ops/containers/bb-api && make teardown-codebuild-selenium`
100+
Tears down both the selenium and codebuild compose stacks (runs with
101+
`if: always()`).
102+
103+
### Mock SLS networking
104+
105+
In CodeBuild, all compose services use `network_mode: "host"`, so there is no
106+
Docker DNS. Containers reach each other over `localhost`:
107+
108+
- `mslsx` listens on `localhost:8080`
109+
- `bb-api` listens on `localhost:8000`
110+
111+
`configure_slsx` in
112+
`ops/containers/bb-api/scripts/external/prepare-environment-support.bash` uses
113+
`localhost` for the `mslsx` endpoints when `TARGET_ENV=codebuild`, and the Docker
114+
DNS name `mslsx` when running locally.
115+
116+
---
117+

0 commit comments

Comments
 (0)