-
Notifications
You must be signed in to change notification settings - Fork 29
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
Closes #633 Tests not passing locally but are in CI - replaced #664
Closes #633 Tests not passing locally but are in CI - replaced #664
Conversation
test user password environment variables. Closes GeekZoneHQ#633 Tests not passing locally but are in CI.
environment variables to align with web/.env.dev Closes GeekZoneHQ#633 Tests not passing locally but are in CI.
Kudos, SonarCloud Quality Gate passed! |
There's a failing check in CircleCI regarding Snyk and a missing api code - I don't believe this happened when I sent my draft commit 5 days ago. Does anyone know if this is already captured as an outstanding issue? |
This is the Snyk error I'm seeing, by clicking through the details button above. I don't know if I get this fully, but I'm assuming that Snyk is performing security checks within CircleCI, but is missing the Snyk auth token in environment variables. What I don't understand currently is how environment variables are set in circle CI - I'm assuming we have some sort of secrets manager to provide this. I'm going to message on the dev channel for assistance on this one. |
@giulio-giunta Are you aware of this? |
@anettleship The SNYK token is configured as an environment variable in the 'web' project settings, so that's where Circleci pulls it from. I'll take a look at this issue later in the afternoon. |
Hi @anettleship, In order to commit your work, you'll need to clone the "web" project and create a new branch and PR. |
Oh shoot, my mistake, I'll look into that and update the PR, thanks for looking into it! |
You're welcome
…On Tue, 16 May 2023, 22:38 anettleship, ***@***.***> wrote:
Oh shoot, my mistake, I'll look into that and update the PR, thanks for
looking into it!
—
Reply to this email directly, view it on GitHub
<#664 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANPJIC6OG472O5SC77PCZUDXGPXW7ANCNFSM6AAAAAAX5BUPUY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Closing this Pull request in favour of this: #667 |
Problem:
When running python3 manage.py test locally in WSL, it runs all 33 tests but FAILED (failures=1, errors=6)
The same tests are all passing in CircleCI.
Solution
Amend project readme.md file, where dev set up is documented, to instruct user to create test user environment variables for TEST_USER_PASSWORD and TEST_USER_PASSWORD_BAD in web/.env to align with values currently present in web/.env.dev.
The readme directs the user to create a file at web/.env with the following commands listed below. These do not currently create the two environment variables and values:
TEST_USER_PASSWORD=k38m1KIhIUzeA^UL
TEST_USER_PASSWORD_BAD=password
When tests run locally, these environment variables are null. This caused the errors reported in the bug report (failures=1, errors=6). For the failing test: test_signed_in_users_cannot_register, the test failed as it was unable to login successfully with a null password, so after failing to log in, the test was able to register a new user, so it returned http 200 for success rather than the 302 redirect.
I have amended the two commands provided in the readme that create the .env file for unix and windows users from and to...
Windows Before:
echo "DEBUG=1
DATABASE_USER=postgres
DATABASE_NAME=postgres
DATABASE_HOST=localhost
DATABASE_PASSWORD=postgres
DATABASE_PORT=5432" | tee web/.env
Windows After:
echo "DEBUG=1
DATABASE_USER=postgres
DATABASE_NAME=postgres
DATABASE_HOST=localhost
DATABASE_PASSWORD=postgres
DATABASE_PORT=5432
TEST_USER_PASSWORD=k38m1KIhIUzeA^UL
TEST_USER_PASSWORD_BAD=password" | tee web/.env
Unix Before:
cat < web/.env
DEBUG=1
DATABASE_USER=postgres
DATABASE_NAME=postgres
DATABASE_HOST=localhost
DATABASE_PASSWORD=postgres
DATABASE_PORT=5432
EOF
Unix After:
cat < web/.env
DEBUG=1
DATABASE_USER=postgres
DATABASE_NAME=postgres
DATABASE_HOST=localhost
DATABASE_PASSWORD=postgres
DATABASE_PORT=5432
TEST_USER_PASSWORD=k38m1KIhIUzeA^UL
TEST_USER_PASSWORD_BAD=password
EOF
Related Issue
#633
Motivation and Context
Tests were failing, now they pass.
How Has This Been Tested?
I've tested this fully on Linux to determine that the tests fail in the expected places following the readme and using the first command, but when the .env file is created with the amended command instead - i.e. the two new environment variable are present in web/.env, all tests pass.
On Windows I have tested the powershell command to ensure that the .env file is created correctly with the additional lines, but I have not set up the project and run the tests.
Types of changes
Checklist: