Skip to content

Add a check to the data migration test#3338

Merged
dnephin merged 2 commits intomainfrom
dnephin/migration-test-check-missing-cleanup
Sep 28, 2022
Merged

Add a check to the data migration test#3338
dnephin merged 2 commits intomainfrom
dnephin/migration-test-check-missing-cleanup

Conversation

@dnephin
Copy link
Contributor

@dnephin dnephin commented Sep 27, 2022

This will ensure that we don't leave stale test data in the database, which could cause subsequent test cases to fail.

Also adds a missing DELETE to cleanup some stale entries from an existing test case.

@dnephin dnephin force-pushed the dnephin/migration-test-check-missing-cleanup branch 2 times, most recently from 68643a6 to 0caf9cf Compare September 27, 2022 20:45
stmts, err := schema.TrimComments(data)
assert.NilError(t, err)

if !assert.Check(t, is.Equal(stmts, "")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line here should print something like this when it finds stale data:

        --- stmts
        +++ →
        @@ -1,3 +1 @@
        -INSERT INTO testing.identities_groups VALUES (1003, 1001);
        -INSERT INTO testing.identities_groups VALUES (1004, 1002);

Copy link
Collaborator

@BruceMacD BruceMacD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes what I ran into, thanks

dnephin and others added 2 commits September 27, 2022 19:27
To ensure each test case does the necessary cleanup.
Co-authored-by: Michael Yang <michael.yang@infrahq.com>
@dnephin dnephin force-pushed the dnephin/migration-test-check-missing-cleanup branch from 31d918e to 052d3c2 Compare September 28, 2022 15:37
@dnephin dnephin merged commit 0c0b485 into main Sep 28, 2022
@dnephin dnephin deleted the dnephin/migration-test-check-missing-cleanup branch September 28, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants