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

Tests should use postgresql #1144

Open
pefoley2 opened this issue May 29, 2021 · 2 comments
Open

Tests should use postgresql #1144

pefoley2 opened this issue May 29, 2021 · 2 comments
Milestone

Comments

@pefoley2
Copy link
Member

It appears that https://github.com/tjcsl/ion/blob/master/ci/spec.yml#L242 is not actually running all the tests.

./setup.py test produces:
Ran 285 tests in 96.273s

OK

But installing/running pytest-django gives:
======================================================= short test summary info ========================================================FAILED intranet/apps/api/tests.py::ApiTest::test_api_bus_detail - django.db.utils.DataError: value too long for type character varyin...FAILED intranet/apps/api/tests.py::ApiTest::test_api_bus_list - django.db.utils.DataError: value too long for type character varying(5) FAILED intranet/apps/bus/tests.py::BusTest::test_route_representation - django.db.utils.DataError: value too long for type character ...FAILED intranet/apps/bus/tests.py::BusTest::test_routes - django.db.utils.DataError: value too long for type character varying(5) FAILED intranet/apps/eighth/tests/test_attendance.py::EighthAttendanceTestCase::test_take_attendance - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_attendance.py::EighthAttendanceTestCase::test_take_attendance_google_meet_csv - AssertionError...FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_all_associated_rooms - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_blacklist - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_both_blocks - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_cancel_uncancel - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_passes - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_room_use - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_signups - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_general.py::EighthTest::test_true_capacity - AssertionError: 200 != 302 FAILED intranet/apps/eighth/tests/test_profile.py::EighthProfileTest::test_profile_signup_view - AssertionError: 58 != 56 FAILED intranet/apps/eighth/tests/test_signup.py::EighthSignupTest::test_eighth_multi_signup_view - KeyError: '1' FAILED intranet/apps/eighth/tests/admin/test_admin_attendance.py::EighthAdminAttendanceTest::test_take_attendance_cancelled - Asserti...FAILED intranet/apps/eighth/tests/admin/test_admin_attendance.py::EighthAdminAttendanceTest::test_take_attendance_zero - AssertionErr...FAILED intranet/apps/eighth/tests/admin/test_admin_groups.py::EighthAdminGroupsTest::test_download_group_csv_view - django.db.utils.D...FAILED intranet/apps/eighth/tests/admin/test_admin_groups.py::EighthAdminGroupsTest::test_eighth_admin_distribute_action - django.db....FAILED intranet/apps/eighth/tests/admin/test_admin_groups.py::EighthAdminGroupsTest::test_eighth_admin_distribute_group - django.db.u...FAILED intranet/apps/eighth/tests/admin/test_admin_groups.py::EighthAdminGroupsTest::test_eighth_admin_distribute_unsigned - django.d...FAILED intranet/apps/eighth/tests/admin/test_admin_groups.py::EighthAdminGroupsTest::test_eighth_admin_signup_group - django.db.utils...FAILED intranet/apps/events/tests.py::EventsTest::test_add_event - AssertionError: 'Error adding event.' != 'Because you are an admin...FAILED intranet/apps/events/tests.py::EventsTest::test_modify_event - AssertionError: 'Error modifying event.' != 'Successfully modif...FAILED intranet/apps/schedule/tests.py::ScheduleTest::test_schedule_context - AssertionError: <Day: 2021-03-22: Test Day> != None FAILED intranet/apps/search/tests.py::SearchTestCase::test_eighth_activity_search - AssertionError: '123' not found in 'b'\n\n<!DO...======================================= 27 failed, 258 passed, 29 warnings in 212.30s (0:03:32) ========================================

To pick a concrete example, bus_number is limited to len(5) here:
https://github.com/tjcsl/ion/blob/master/intranet/apps/bus/models.py#L11

But the api test tries to make an entry of len(6) here: https://github.com/tjcsl/ion/blob/master/intranet/apps/api/tests.py#L510

which results in an error like:
E django.db.utils.DataError: value too long for type character varying(5)

So for whatever reason, ./setup.py test isn't doing what it should...

See #1143 for an example.

@pefoley2
Copy link
Member Author

See #1143 (comment) for what the current set of failures exposed by switching to pytest looks like.

@pefoley2 pefoley2 changed the title Tests not being run Tests should use postgresql Jun 11, 2021
@pefoley2
Copy link
Member Author

The issue is actually that we're using sqlite in the test suite, which does much less sanity checking than postgres:
See #1143 (comment)

@pefoley2 pefoley2 mentioned this issue Jun 11, 2021
@Laur04 Laur04 added this to the Backlog milestone Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants