-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate cassie.py from deprecated pycassa to cassandra-driver ORM #4
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…type handling Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…ncoding Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
|
@copilot * In a dedicated folder, please generate one tiny Python script per function you modified.
|
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Created 27 example scripts (one per modified function) in |
|
@copilot Please add a call to |
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Added |
The oopses._insert() function is already doing other counter updates, and those are the ones that are actually useful. The ones from daisy.submit look more like legacy than anything else, so let's stop incrementing them.
f0b609b to
6f5ffc6
Compare
|
|
||
|
|
||
| class TestPrune: | ||
| def test_get_package_crash_rate_increase_rate(self, datetime_now, cassandra_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- First, start a Cassandra test database from Docker with:
docker run --name cassandra --network host --rm -d -e HEAP_NEWSIZE=10M -e MAX_HEAP_SIZE=200M docker.io/cassandra. - This file is testing only the
get_package_crash_rate()function from thesrc/errors/cassie.pyfile. - You can add more sample data to the Cassandra database in file
src/tests/conftest.py, in thecassandra_datafixture. - This is how to run the tests from the
srcfolder:python3 -m pytest ./tests -k cassie. This command must not fail. Tests must keep passing. - Have a look at the existing test, and add more to cover additional situations. In particular, the
increasekey of the output dictionary must vary fromTruetoFalsein many different cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 5 new test cases for get_package_crash_rate() covering different scenarios where increase varies between True and False:
- No crashes today (increase=False) - new version has no crashes today
- Few crashes (increase=False) - only 2 crashes today, below threshold of 3
- New package (increase=True) - no old version data exists
- Low difference (increase=False) - crash rate similar between versions (difference ≤ 1)
- All proposed (increase=False) - all today's crashes from proposed repo with exclude_proposed=True
All 6 tests (original + 5 new) pass successfully. Test data added to cassandra_data fixture in conftest.py. Also removed debug print statements from cassie.py. See commit 537f8ba.
This brings better precision on when crashes actually occur, and eases a bit the testing of things, because the tests can now create crashes in the past way more easily.
The goal here is to have the bare minimum working, and throw that at Copilot to see how it goes.
… increase/no-increase scenarios Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
537f8ba to
35b4cd2
Compare
Summary
Successfully migrated all 30+ functions in
cassie.pyfrom the deprecatedpycassalibrary to the moderncassandra-driverORM. All pycassa references have been removed and replaced with equivalent ORM queries. Added comprehensive example scripts demonstrating usage of each migrated function, with proper Cassandra connection initialization.Test Coverage
Added comprehensive test coverage for
get_package_crash_rate()function with 6 test cases covering different scenarios:All tests pass successfully and validate the different conditions where the
increasekey varies betweenTrueandFalse.Original prompt
pycassa#3💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.