GoogleCloudPlatform / professional-services-data-validator

Utility to compare data between homogeneous or heterogeneous environments to ensure source and target tables match
Apache License 2.0
407 stars 119 forks source link

chore: adding unit test coverage to `__main__.py` #1329

Closed nick-redfearn closed 2 days ago

nick-redfearn commented 1 week ago

I originally started this PR with exit codes in mind, but I can see now that this is not needed.

Along the way, I added a bunch of unit test coverage to __main__.py. I feel like this is a useful addition for the future so I'm keeping the PR.

sundar-mudupalli-work commented 1 week ago

Nick,

Thank you for contributing to the DVT code base. I am not clear specifically the issue you are trying to address. Our preferred approach is to first create an issue that clearly states the problem. Using that description, we should be able to write a test case that demonstrates the problem. We often do that and use that as a means of testing fixes.

Today, when an exception is raised, a non zero status code is returned. Of course the exception trace is also included. For a tool like DVT which is used primarily by programmers and database admins, returning a non zero status along with the exception trace is sufficient, I think.

Sundar Mudupalli

helensilva14 commented 1 week ago

/gcbrun

helensilva14 commented 1 week ago

Hi @nick-redfearn! Unit tests failed in our Cloud Build execution, could you please take a look in the error below? Tks!

__________________ ERROR collecting tests/unit/test__main.py ___________________
tests/unit/test__main.py:46: in <module>
    CONFIG_RUNNER_ARGS_1 = BASE_RUNNER_ARGS | {
E   TypeError: unsupported operand type(s) for |: 'dict' and 'dict'
nick-redfearn commented 1 week ago

Thanks @helensilva14 - I think its because Python 3.8 doesnt support the | operand type, oops

Ive pushed this commit, I think it should be fine now -> https://github.com/GoogleCloudPlatform/professional-services-data-validator/pull/1329/commits/15b09907da4942de06aa5e3dc7475f1d5f199bc6

helensilva14 commented 1 week ago

/gcbrun

All good @nick-redfearn, thanks for the timely fix! Starting build again and let's see if all will pass!

helensilva14 commented 4 days ago

/gcbrun

helensilva14 commented 3 days ago

/gcbrun

nj1973 commented 2 days ago

/gcbrun