Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive admin search, testing updates and manager setting of notes and report status #281

Merged
merged 60 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3524e9e
Remove --runInBand
dcloud Jan 27, 2021
60b68e0
Add some docs around testing
dcloud Feb 1, 2021
bb1a516
Merge branch 'main' into dcloud/test-failure-fixes
dcloud Feb 1, 2021
8484d6e
Allow search to be case-insensitive
Feb 1, 2021
4ef5971
Fix Eslint issue
Feb 1, 2021
3f43234
Fix example
dcloud Feb 1, 2021
deac317
Rename docker-compose file used for dynamic security scans
dcloud Jan 26, 2021
f3f9022
Create bin/docker script, which will make command composition easier
dcloud Jan 27, 2021
44af291
Remove --runInBand
dcloud Jan 27, 2021
9b422f3
Add option parsing and rename docker script
dcloud Jan 27, 2021
84b24b8
Multiple docker-compose configs for multiple environments
dcloud Jan 27, 2021
92a41c4
bin/docker-run fixes, improvements
dcloud Jan 28, 2021
32f38c8
Minor docker-run improvements
dcloud Jan 28, 2021
de13b1f
Change 'conf' to be a string, since that's how it gets used. Echo cmd…
dcloud Jan 29, 2021
a232a91
docker-run: 'test' uses test env by default
dcloud Jan 29, 2021
ac43405
Undo the composed compose files; docker-compose wasn't handling diffe…
dcloud Jan 29, 2021
188b05f
Remove 2-liners in favor of echo_exec function
dcloud Jan 29, 2021
ece7bb4
docker-run: Make default config a readonly var
dcloud Jan 29, 2021
c8886f0
Add simpler run-tests script. Improve docker-compose.test.yml with na…
dcloud Feb 1, 2021
8b0bece
Remove bin/docker-run since we are no longer composing multiple
dcloud Feb 1, 2021
43e18c9
One last rename
dcloud Feb 1, 2021
90c4e50
Managers can add notes and set status of reports
jasalisbury Feb 2, 2021
975711e
Add API docs
jasalisbury Feb 2, 2021
fe19276
Update DB diagram
jasalisbury Feb 2, 2021
58b12ac
Merge branch 'main' into dcloud/test-failure-fixes
dcloud Feb 2, 2021
13ff30f
Simplify networking, remove unused containers per @dcmcand
dcloud Feb 2, 2021
e56cf18
update failing tests
Feb 2, 2021
43ed721
Merge branch 'main' into js-137-manager-approves-report
jasalisbury Feb 2, 2021
486acd4
Add section on caveats with creating/deleting databas records
dcloud Feb 2, 2021
6dee177
Merge branch 'main' into dcloud/test-failure-fixes
dcloud Feb 2, 2021
b14eeb9
Split run-test into multiple steps, per @dcmcand
dcloud Feb 2, 2021
11b92b9
Fix API docs. Split review page into components. Add DECIMAL_BASE
jasalisbury Feb 2, 2021
f698be6
Merge branch 'js-137-manager-approves-report' of github.com:adhocteam…
jasalisbury Feb 2, 2021
25e5f1f
Switch shortcut, also per @dcmcand
dcloud Feb 2, 2021
d227006
Merge branch 'main' into dcloud/split-docker-local-test
dcloud Feb 2, 2021
0a785fd
Merge branch 'main' into 274-allow-case-insensitive-search
gopar Feb 3, 2021
4eadc38
Merge branch 'main' into dcloud/test-failure-fixes
dcloud Feb 3, 2021
b3fb374
Merge branch 'main' into dcloud/test-failure-fixes
dcloud Feb 3, 2021
9e05993
Merge pull request #134 from adhocteam/dcloud/test-failure-fixes
dcloud Feb 3, 2021
b80d852
Merge branch 'main' into dcloud/split-docker-local-test
dcloud Feb 3, 2021
e976f8a
Merge branch 'main' into 274-allow-case-insensitive-search
gopar Feb 3, 2021
db9cb58
Merge pull request #138 from adhocteam/dcloud/split-docker-local-test
dcloud Feb 3, 2021
2956987
Merge branch 'main' into 274-allow-case-insensitive-search
gopar Feb 3, 2021
eb867ac
Merge pull request #137 from adhocteam/274-allow-case-insensitive-search
gopar Feb 3, 2021
75e4df0
Merge branch 'main' into js-137-manager-approves-report
jasalisbury Feb 4, 2021
d31f14f
Merge pull request #139 from adhocteam/js-137-manager-approves-report
jasalisbury Feb 4, 2021
a50285f
Increase wait time for the server to spin up in cucummber ci tests
jasalisbury Feb 4, 2021
ba18d84
Merge pull request #145 from adhocteam/js-increase-ci-cucumber-wait-time
jasalisbury Feb 4, 2021
d29a75d
Document bin/run-tests, make sure frontend tests run in frontend inst…
dcloud Feb 4, 2021
3f47788
Feedback from PR
jasalisbury Feb 4, 2021
c99ba9a
Add frontend tests
jasalisbury Feb 4, 2021
e027cdf
Remove unused import
jasalisbury Feb 4, 2021
c6f62d6
Merge pull request #147 from adhocteam/dcloud/docker-tests-changes-pe…
dcloud Feb 4, 2021
4680a12
Merge branch 'main' into js-manager-notes-feedback
jasalisbury Feb 5, 2021
5a31b94
Merge pull request #148 from adhocteam/js-manager-notes-feedback
jasalisbury Feb 5, 2021
c08eb4c
Somehow service == container_name for docker-compose exec
dcloud Feb 5, 2021
6cf1025
Add param to run-tests to choose to run only frontend or backend test…
dcloud Feb 5, 2021
c4c7bd4
Check exit codes of docker cmds, and 'log' errors. Return exit_code e…
dcloud Feb 5, 2021
68a76de
Merge branch 'main' into dcloud/test-script-improvements
dcloud Feb 5, 2021
f327246
Merge pull request #149 from adhocteam/dcloud/test-script-improvements
dcloud Feb 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ docker exec test-backend bash -c "yarn db:seed;"
docker exec test-backend bash -c "yarn test:ci"

# Test frontend
docker exec test-backend bash -c "yarn --cwd frontend run test:ci"
docker exec test-frontend bash -c "yarn --cwd frontend run test:ci"
Copy link
Contributor

@rahearn rahearn Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work. Looks like a missing container_name for the frontend service. --cwd frontend is also unnecessary (though doesn't break anything) in the frontend container.

Screen Shot 2021-02-05 at 9 35 36 AM

That also exposes that this script papers over any failures if you don't read the output carefully. Since this is not used in CI/CD I think I'm ok with that, but I think it'd be good to collect exit statuses and exit the script with non-zero if any individual step exits with non-zero, or just bail out as soon as we get a non-zero.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I've run this a few times and haven't seen this problem. I'll take a look again. Could you get me the output of docker-compose -f docker-compose.test.yml ps --all on your machine?

As for handing failures, it was intentional that we didn't error out if one of the intermediate steps threw an error. We could catch those statuses, but I'm not sure we want to prevent frontend tests from running if the backend tests fail, for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to prevent frontend tests from running if the backend tests fail, for example

Yeah, I went back and forth on that. I'm 100% fine with all the steps running as long as I get a nice clear indication that at least one step failed when the script exits.

Here's the ps output:

Screen Shot 2021-02-05 at 10 20 14 AM

Copy link
Contributor

@dcloud dcloud Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick check of the doc page for docker-compose exec, it sounds like that command takes a service name rather than a container name, so that might be related.

While we're discussing, I had originally considered having the frontend and backend tests run as separate scripts, since it seems like engineers might be focused on either frontend or backend during development. Would you be interested in making this accept an optional frontend/backend param?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be interested in making this accept an optional frontend/backend param

If it's quick, sure, but that's pretty low priority to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was quick: https://github.com/adhocteam/Head-Start-TTADP/pull/149/files

I also added some logging of errors and have the script return an exit code value equal to the number of script failures.


# Cleanup
docker-compose \
Expand Down
6 changes: 6 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ When writing tests that create database records, it might also help to use a `tr

## Testing in Docker

### Using `./bin/run-tests`

To simplify running tests in Docker, there is a bash script, `./bin/run-tests` that will run the appropriate commands to start `test-` variations of the services used in tests. You should be able to run tests using that command while your development Docker environment is running. The script uses a separate `docker-compose.test.yml` which does not create a user-accessible network and cleans up after itself once tests have run.

### Running tests in your development Docker environment

When running tests in Docker, be aware that there are tests that will modify/delete database records. For tests to run, the 'db' service needs to exist and `db:migrate` and `db:seed` need to have been run (to create the tables and populate certain records).

In the `docker-compose.yml` configuration, the database is set up to persist to a volume, "dbdata", so database records will persist between runs of the 'db' service, unless you remove that volume explicitly (e.g. `docker volume rm` or `docker-compose down --volumes`).
Expand Down