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

Fix pytest tests #198

Open
9 of 10 tasks
zeromind opened this issue Feb 4, 2022 · 0 comments
Open
9 of 10 tasks

Fix pytest tests #198

zeromind opened this issue Feb 4, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@zeromind
Copy link
Collaborator

zeromind commented Feb 4, 2022

There are quite a few pytest tests failing, we should fix the code/tests.

10 failed, 184 passed, 332 warnings in 112.17s (0:01:52)

  • tests/allocator_test.py AllocatorTest::test_delegation_not_subnetFAILED #205

    FAILED tests/allocator_test.py::AllocatorTest::test_delegation_not_subnet - sqlalchemy.exc.IntegrityError: (MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '83076749736557242056487941267521536-64-384' for key 'address'")

  • tests/commands_test.py
    CommandsTest::test_pool_report

    FAILED tests/commands_test.py::CommandsTest::test_pool_report - AssertionError: assert '444 IPs are still free' in 'Pool pool\ndays 1 7 30\nusage 24 ... 64\n444.0 IPs are still free\nBased on data from the last 30 days, the pool will be full in 208.1 days.\n'

    The called function does division and returns a float of number of IPs, but there can't be fractions of IPs, code should be adjusted to return int.

  • tests/commands_test.py CommandsTest::test_pool_reportv6

    FAILED tests/commands_test.py::CommandsTest::test_pool_reportv6 - AssertionError: assert '448 /64 blocks are still free' in 'Pool pool\ndays 1 7 30\nusage 20 ... 60\n448.0 /64 blocks are still free\nBased on data from the last 30 days, the pool will be full in 224.0 days.\n'

    The called function does division and returns a float of number of IPs, but there can't be fractions of IPs, code should be adjusted to return int.

  • tests/dns_test.py test_validate_strings

    FAILED tests/dns_test.py::test_validate_strings - ValueError: Invalid escape sequence: \223

    Related to unicode in TXT records #72 and remove dependency on six #176

  • tests/dns_test.py ZoneTest::test_subzone

    FAILED tests/dns_test.py::ZoneTest::test_subzone - dim.errors.InvalidZoneError: Zone company.com does not exist`

    Test creates the parent zone with wrong name.

  • tests/dns_test.py TXT::test_parse

    FAILED tests/dns_test.py::TXT::test_parse - dim.errors.InvalidParameterError: Invalid escape sequence: \100`

    Related to unicode in TXT records #72 and remove dependency on six #176

  • tests/dns_test.py RRReferencesTest::test_edit_comment_ttl

    FAILED tests/dns_test.py::RRReferencesTest::test_edit_comment_ttl - AssertionError: assert {'graph': {1:...}], 'root': 2} == {'graph': {1:...}], 'root': 2}`

  • tests/dns_test.py RRReferencesTest::test_get_references

    FAILED tests/dns_test.py::RRReferencesTest::test_get_references - AssertionError: assert {'graph': {1:...}], 'root': 2} == {'graph': {1:...}], 'root': 2}`

  • tests/dnssec_test.py test_ds_hash

    FAILED tests/dnssec_test.py::DNSKEYTest::test_ds_hash - TypeError: owner must be of type bytes, got <class 'str'>`

    The called function expects bytes for owner, but the test sets str; adjust to .encode('utf-8').

  • tests/pool_test.py PoolTest::test_priority

    FAILED tests/pool_test.py::PoolTest::test_priority - TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'`

@zeromind zeromind added the bug Something isn't working label Feb 4, 2022
zeromind added a commit to zeromind/dim that referenced this issue Feb 4, 2022
use correct parent zone name

for ionos-cloud#198
zeromind added a commit to zeromind/dim that referenced this issue Feb 4, 2022
`ds_hash()` expect bytes, encode string in test

for ionos-cloud#198
zeromind added a commit to zeromind/dim that referenced this issue Feb 7, 2022
adjust the db model for `Pool` to return the list of subnets
sorted by priority, which prohbably is what a user expects in general

additionally, fix `assertDictSubset()` to make sure msg is a string,
as it would sometimes fail, see ionos-cloud#198
zeromind added a commit to zeromind/dim that referenced this issue Feb 8, 2022
make order for reference records returned by `rr_get_references()`
persistent by sorting them by their `id` attribute

this makes `RRReferencesTest::test_get_references` work, see ionos-cloud#198
zeromind added a commit to zeromind/dim that referenced this issue Feb 8, 2022
this should make the results in the report more correct,
* floor `current_free`
* ceil used ips

make sure the numbers in the report are integers, see ionos-cloud#198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant