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

Fixed --verbose flag setup in unexpected-changesets #2167

Merged
merged 4 commits into from Nov 15, 2021

Conversation

nvoxland
Copy link
Contributor

@nvoxland nvoxland commented Oct 29, 2021

Description

Fixes #1987

Makes UnexpectedChangestsCommandStep.VERBOSE_ARG flag:

  • A boolean flag
  • Not required

Does not change logic of unexpected-changesets command, just fixes the argument handling in the CLI


Dev Handoff Notes (Internal Use)

Links

Testing

Dev Verification

Output without --verbose:
1 unexpected changes were found in LBUSER@jdbc:oracle:thin:@localhost:1523/ORCLPDB1

Output with --verbose:

1 unexpected changes were found in LBUSER@jdbc:oracle:thin:@localhost:1523/ORCLPDB1
     com/example/changelog.demo.xml::1.2::nvoxland

Test Requirements (Liquibase Internal QA)

This test is database-independent but bug repro was done using the attached changelogs against MySQL. The unexpected-changesets command is used to determine two things:

  1. if there are changes in the DATABASECHANGELOG table that do not correspond to a matching changeset in the changelog
  2. If there are changesets in the changelog that are not in the DATABASECHANGELOG table.

Manual Tests

Setup

  • Execute an update to put a table on the database.

liquibase update --changelog-file lb2124-changelog.xml

Validations

Verify the unexpected-changesets command does not require the verbose parameter.

liquibase unexpected-changesets --changelog-file lb2124-changelog2.xml

  • There is no error that '--verbose' is a missing required argument
  • Console output shows that there is one unexpected change set on the database:
    • 1 unexpected changes were found in

Verify the unexpected-changesests command executed with verbose outputs the unexpected changeset in the changelog along with additional detail.

liquibase unexpected-changesets --changelog-file lb2124-changelog2.xml --verbose

  • Console output shows there is one unexpected changeset.
    • 1 unexpected changes were found in
  • Console output includes changeset detail:
    • lb2124-changelog.xml::1::createTable::Liquibase User

TBD :: Verify the unexpected-changesets command executed with verbose=true outputs the unexpected changeset in the changelog along with additional detail.

liquibase unexpected-changesets --changelog-file lb2124-changelog2.xml --verbose true

  • Console output shows there is one unexpected changeset.
    • 1 unexpected changes were found in
  • Console output includes changeset detail:
    • lb2124-changelog.xml::1::createTable::Liquibase User

TBD :: Verify the unexpected-changesets command executed with verbose=false outputs that there is one unexpected changeset in the changelog.

liquibase unexpected-changesets --changelog-file lb2124-changelog2.xml --verbose

  • Console output shows there is one unexpected changeset.
  • Console output includes changeset detail:
    • lb2124-changelog.xml::1::createTable::Liquibase User

Verify unexpected-changests command executed with verbose outputs that there is one unexpected changeset in the DATABASECHANGELOG table.

  • Setup: Comment out the changeset in lb2124-changelog.xml.

liquibase unexpected-changesets --changelog-file lb2124-changelog.xml --verbose

  • Console output shows there is one unexpected changeset.
  • Console output includes the unexpected change found in the DATABASECHANGELOG TABLE:
    • lb2124-changelog.xml::1::createTable::Liquibase User

Automated Tests

A new functional tests should be added to exercise the unexpected-changesets command.

GIVEN a changelog with createTable table_lb2124

GIVEN a second changelog with createTable table_lb2124_2

WHEN I run liquibase update --changelog-file <first_changelog>

THEN I EXPECT update is successful

WHEN I run liquibase unexpected-changesets --changelog-file <second_changelog>

THEN I EXPECT the output to contain that create table_lb2124 is unexpected.

┆Issue is synchronized with this Jira Bug by Unito

- Is a boolean flag
- Is not required
@nvoxland nvoxland added this to To Do in Conditioning++ via automation Oct 29, 2021
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Oct 29, 2021
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Oct 29, 2021
@sync-by-unito
Copy link

sync-by-unito bot commented Nov 10, 2021

➤ Erzsebet Carmean commented:

PRIVATE COMMENT

@nathan Voxland ( https://liquibase.slack.com/team/U4DK1LG8P ), hi! The --verbose flag for status does not require a value. It looks like the --verbose flag for unexpected-changesets is going to require a true/false value. If so, can we make --verbose  for unexpected changesets behave the same as the --verbose for status?

Jack Odzhubeiskyi - Depending on Nathan’s answer, there are a couple of manual test cases that you will not need to execute. I’ve labeled them as TBD.

@sync-by-unito
Copy link

sync-by-unito bot commented Nov 14, 2021

➤ Jack Odzhubeiskyi commented:

Liquibase-4.6.1-fix-unexpected-changesets-SNAPSHOT #3Verify the unexpected-changesets command does not require the verbose parameter. PASS

Starting Liquibase at 15:54:23 (version 4.6.1-fix-unexpected-changesets-SNAPSHOT #3 built at 2021-11-12 20:28+0000)
Liquibase Version: 4.6.1-fix-unexpected-changesets-SNAPSHOT
Liquibase Community 4.6.1-fix-unexpected-changesets-SNAPSHOT by Liquibase
1 unexpected changes were found in root@172.19.0.1@jdbc:mysql://localhost:3306/intuser_db
Liquibase command 'unexpected-changesets' was executed successfully.Verify the unexpected-changesests command executed with verbose outputs the unexpected changeset in the changelog along with additional detail. PASS

1 unexpected changes were found in root@172.19.0.1@jdbc:mysql://localhost:3306/intuser_db
lb2124-changelog.xml::1::createTable::Liquibase UserVerify unexpected-changests command executed with verbose outputs that there is one unexpected changeset in the DATABASECHANGELOG table. PASS

1 unexpected changes were found in root@172.19.0.1@jdbc:mysql://localhost:3306/intuser_db
lb2124-changelog.xml::1::createTable::Liquibase User

@nvoxland nvoxland merged commit b26725a into master Nov 15, 2021
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Nov 15, 2021
@nvoxland nvoxland deleted the fix-unexpected-changesets branch November 15, 2021 15:41
@nvoxland nvoxland removed this from Done in Conditioning++ Dec 1, 2021
@nvoxland nvoxland added this to the v4.6.2 milestone Dec 1, 2021
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.

Getting error by using unexpectedChangeSets command.
3 participants