From e4f182a77fa49780249b566d87b593ab36ec1e42 Mon Sep 17 00:00:00 2001 From: rpigneri-vol Date: Tue, 10 Dec 2024 16:21:37 -0500 Subject: [PATCH] A few updates to some README.md's in areas where I struggled in my first local build. --- README.md | 4 ++-- backend/README.md | 7 +++++++ backend/tests/README.md | 16 ++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4390078de..1c42af30c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ This method uses Docker to run the complete application stack. 3. Build and run the project. ``` -docker-compose build && docker-compose up -d && docker-compose logs -f +docker compose build && docker compose up -d && docker compose logs -f ``` ## Installation (Frontend Only) @@ -51,7 +51,7 @@ All code must pass the unit tests and style checks before it can be merged into ``` -docker exec -it "police-data-trust-api-1" /bin/bash +docker exec -it "police-data-trust_api_1" /bin/bash ``` diff --git a/backend/README.md b/backend/README.md index 90b954bab..eff16eb3a 100644 --- a/backend/README.md +++ b/backend/README.md @@ -2,6 +2,13 @@ This is the backend for the National Police Data Index project. It is a Python Flask application that serves as the API for the front end. +--- +**NOTE:** + +If you are having trouble running your backend tests for the first time, you might be interested in [this README.md](tests/README.md) rather than this one :-). + +--- + ## Database The backend uses a PostgreSQL database to store data. The database schema is defined in [database/models](https://github.com/codeforboston/police-data-trust/tree/a743c232b5737b193086264e1364b1475873a884/backend/database/models). diff --git a/backend/tests/README.md b/backend/tests/README.md index a4e8fe4ef..3dd0ba0ea 100644 --- a/backend/tests/README.md +++ b/backend/tests/README.md @@ -2,12 +2,12 @@ To run backend tests locally: ## Pytest (Unit Tests) -1. Start the application cluster with `docker-compose up` +1. Start the application cluster with `docker compose up` -2. Start the test database with `docker-compose --profile test up`. +2. Start the test database with `docker compose --profile test up`. Yes, you should start the test database separately. It'll be more likely to boot properly this way. -3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructions below. +3. Add a test marker to the test DB. This will allow the DB to clear itself after each test run. See instructions[below](#adding-a-test-marker-to-the-test-database). 4. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`. @@ -20,22 +20,22 @@ Yes, you should start the test database separately. It'll be more likely to boot 1. With the test database running, navigate to `localhost:7474` in your browser. -2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database. +2. On the Neo4J web interface, select `neo4j://127.0.0.1:7688` as the connection URL. Otherwise, you will connect to the main database. You can connect to a new DB by typing the following into the command bar at the very top of your browser window: `:server connect neo4j://127.0.0.1:7688` and pressing Enter or clicking the run button. The command bar often starts with `neo4j$ ` at the beginning. -3. Log in with the username `neo4j` and the password `test_pwd`. - -4. Run the following query to add a test marker to the database: +3. Run the following query to add a test marker to the database: ``` MERGE (n:TestMarker {name: 'TEST_DATABASE'}); ``` +This command can also be run from the command bar at the top of your screen. + 5. You can now run the tests. The database will clear itself after each test run. ## Flake8 (Linting) -1. Start the application cluster with `docker-compose up` +1. Start the application cluster with `docker compose up` 2. Connect to the API container with `docker exec -it "police-data-trust-api-1" /bin/bash`. You can find the container name by running `docker ps`.