Skip to content

Awkward test: SqlLifecycleTest #12642

@paul-rogers

Description

@paul-rogers

SqlLifecycleTest is structured poorly. Rather than verify the contract that this class must provide, the code uses mocks to verify the implementation. That is, the tests verify that SqlLifecycleTest makes certain calls in a certain order to DruidPlanner.

In general, implementation evolves, but the contract (interface) tends to evolve slower. Tests want to verify that SqlLifecycle does what it advertises to do. Testing the implementation leads to brittle tests. Further, such test don't actually tell us that the class performs its function, only that it is going through the motions.

This test should be rewritten to use a real DruidPlanner (which enforces its own lifecycle) and to verify that each public method does what it advertises to do. Omit the part of the tests which verify implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions