Skip to content

test(sqldef): add unit tests for rollback stage, utils, and provider - #52

Open
vanshika2720 wants to merge 2 commits into
pipe-cd:mainfrom
vanshika2720:test/sqldef-coverage
Open

test(sqldef): add unit tests for rollback stage, utils, and provider#52
vanshika2720 wants to merge 2 commits into
pipe-cd:mainfrom
vanshika2720:test/sqldef-coverage

Conversation

@vanshika2720

Copy link
Copy Markdown

What this PR does

Adds unit tests for previously uncovered SQLDef plugin logic, including executeRollbackStage, findFirstSQLFile edge cases, SqldefProviderImpl, and plugin dispatch, versioning, and strategy methods.

Adds deterministic tests using temporary directories and a fake sqldef executable, without requiring a network connection or real database.

Improves plugins/sqldef coverage from 48.2% to 96.4%, with deployment and provider reaching 100% coverage.

Why we need it / Without this PR, what is the problem?

Several important SQLDef plugin paths had little or no test coverage, making regressions harder to detect.

These tests cover success and failure paths, edge cases, stage dispatch, and provider behavior while keeping the tests isolated from external services. No production code was changed.

Cover executeRollbackStage, findFirstSQLFile edge cases, the
SqldefProviderImpl exec wrapper, and Plugin dispatch/versioning
methods that previously had no test coverage.

Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
ExecuteStage's panic on an unrecognized stage name is unsafe behavior
that is being replaced with an error return in a separate fix. Encoding
the panic as expected here would make this coverage-only PR conflict
with that fix once merged, so leave the regression test for the fix
that changes the behavior.

Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
@vanshika2720

Copy link
Copy Markdown
Author

@khanhtc1202 @t-kikuc

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.

1 participant