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

Pytest Github Action #274

Merged
merged 1 commit into from
May 7, 2024
Merged

Pytest Github Action #274

merged 1 commit into from
May 7, 2024

Conversation

MelissaAutumn
Copy link
Member

  • Runs on master or PRs for master
  • Runs the full suite except for elasticsearch tests
  • Has to patch django to fix isolate transaction issue for mysql 8.0~
  • Uses production image from dockerhub

This should help us keep an eye on the state of tests as we break more things add new features 😄

@MelissaAutumn MelissaAutumn self-assigned this May 3, 2024
run: docker exec atn bash -c "make -f Makefile-docker update_deps"

- name: Patch Django
run: docker exec atn bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py"
Copy link
Member Author

Choose a reason for hiding this comment

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

MySQL 8+ swaps TX_ISOLATION for transaction_isolation. This only breaks in tests because Django uses it to keep test runs clean iirc.

docker run --add-host host.docker.internal:host-gateway --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=verysecurepw -e MYSQL_DATABASE=test_olympia -d mysql:8.0 --default-authentication-plugin=mysql_native_password
sleep 15
docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "CREATE USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'verysecurepw';"
docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1';"
Copy link
Member Author

Choose a reason for hiding this comment

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

We could have probably used an empty password but I felt like it may cause unexpected issues, so I went with an extremely secure password.

It doesn't matter that is is exposed as it's just a test db that dies at the end of the run.

run: docker exec atn bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py"

- name: Run tests
run: docker exec atn bash -c "python -m pytest -m 'not es_tests' src/olympia/"
Copy link
Member Author

Choose a reason for hiding this comment

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

Run all test suites except for elasticsearch. Because we don't have one running here.

@MelissaAutumn
Copy link
Member Author

MelissaAutumn commented May 3, 2024

(This is supposed to fail for now.)

@MelissaAutumn MelissaAutumn requested review from Sancus and removed request for Sancus May 3, 2024 20:52
Copy link

github-actions bot commented May 3, 2024

Test Results

5 481 tests   5 393 ✅  27m 47s ⏱️
    1 suites     26 💤
    1 files       62 ❌

For more details on these failures, see this check.

Results for commit 12d22c1.

♻️ This comment has been updated with latest results.

@MelissaAutumn
Copy link
Member Author

Since the test suite is incredibly large and noisy I've added a github action to display the results from the xml report.

@MelissaAutumn
Copy link
Member Author

Okay I had to add ES, but now the tests run without errors. There's still failures, but no errors!

* Runs on master or PRs for master
* Runs the full suite except for elasticsearch tests
* Uses elasticsearch though...
* Has to patch django to fix isolate transaction issue for mysql 8.0~
* Uses production image from dockerhub
* Generates report
* Displays report on Github PR
@Sancus Sancus merged commit c8e9457 into master May 7, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants