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

vdk-core: Fix destination_table referenced early #864

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

doks5
Copy link
Contributor

@doks5 doks5 commented Jun 14, 2022

In the IngesterBase class, we currently pass destination_table to the
call to _queue_payload_for_posting in cases when the objects queue is empty.
However, at this point, the destination_table is not defined, which causes an
UnboundLocalError to be raised.

This change fixes the issue by replacing destination_table with current_destination_table
(set to None by default) which is defined before the call to _queue_payload_for_posting.

Testing Done: All existing tests pass

Signed-off-by: Andon Andonov andonova@vmware.com

In the IngesterBase class, we currently pass `destination_table` to the
call to `_queue_payload_for_posting` in cases when the objects queue is empty.
However, at this point, the destination_table is not defined, which causes an
UnboundLocalError to be raised.

This change fixes the issue by replacing `destination_table` with `current_destination_table`
(set to None by default) which is defined before the call to `_queue_payload_for_posting`.

Testing Done: All existing tests pass

Signed-off-by: Andon Andonov <andonova@vmware.com>
@doks5 doks5 merged commit f1f8d0d into main Jun 15, 2022
@doks5 doks5 deleted the person/andonova/fix-dest-table branch June 15, 2022 06:28
@antoniivanov
Copy link
Collaborator

Don't forget tests, please. All bug fixes should generally have a test covering them (e.i. the test fails before the fix and passes afterwards). This way we make sure that the bug is properly fixed, that we won't regress again in the future (as bugs tend to resurface).

doks5 added a commit that referenced this pull request Jun 15, 2022
As part of #864, a change was
made that fixes an issue with destination_table referenced before assignment in
case the `_objects_queue` of the `IngesterBase` class is empty. However, the change
was merged without any tests.

This change introduces a unit test that verifies that there are no regressions.

Testing Done: Unit test introduced.

Signed-off-by: Andon Andonov <andonova@vmware.com>
doks5 added a commit that referenced this pull request Jun 15, 2022
As part of #864, a change was
made that fixes an issue with destination_table referenced before assignment in
case the `_objects_queue` of the `IngesterBase` class is empty. However, the change
was merged without any tests.

This change introduces a unit test that verifies that there are no regressions.

Testing Done: Unit test introduced.

Signed-off-by: Andon Andonov <andonova@vmware.com>
doks5 added a commit that referenced this pull request Jun 15, 2022
As part of #864, a change was
made that fixes an issue with destination_table referenced before assignment in
case the `_objects_queue` of the `IngesterBase` class is empty. However, the change
was merged without any tests.

This change introduces a unit test that verifies that there are no regressions.

Testing Done: Unit test introduced.

Signed-off-by: Andon Andonov <andonova@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants