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

Introduce support for primitive types in new changes #5360

Merged
merged 8 commits into from
Jan 5, 2024

Conversation

fbiville
Copy link
Contributor

@fbiville fbiville commented Dec 12, 2023

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This adds support for primitive types, particularly for custom change fields.

Things to be aware of

It could potentially change the converted value type of existing changes, but that's unlikely as the modified function only returns primitive types if explicitly requested.
Since such requests would fail in the past, I doubt this change will have an impact.

Things to worry about

Changing existing Change subclasses to migrate from boxed types to primitive types is likely a bad idea since it may change the generated check sum.
The general change proposed here is however useful for new changes.

Additional Context

N/A

@fbiville fbiville marked this pull request as ready for review December 15, 2023 12:44
@fbiville fbiville force-pushed the primitive_type_support branch 2 times, most recently from ced80a0 to 064ebe4 Compare December 15, 2023 12:55
@filipelautert filipelautert self-assigned this Dec 18, 2023
@filipelautert filipelautert added the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Dec 18, 2023
@rberezen
Copy link
Contributor

Hi @fbiville , could you please take a look at the unit test failures in this link: https://github.com/liquibase/liquibase/actions/runs/7265842115/job/19796976554?pr=5360? Your assistance in resolving them would be greatly appreciated. Thank you!
cc @filipelautert

@MalloD12
Copy link
Contributor

MalloD12 commented Dec 28, 2023

Hi @fbiville,

I have fixed some unit tests that were failing and made some changes to some tests that were not running all the scenarios specified in the where sections. One StringChangeLogSerializerTest test is failing only under Windows check. Would you mind taking a look and fixing that scenario?

Test error:

Error:  Failures: 
Error:    StringChangeLogSerializerTest.general field serialization check:248 Condition failed with Exception:

setFields(change)
|         |
|         primitiveChange
java.lang.AssertionError: Unknown field type in com.example.liquibase.change.ChangeWithPrimitiveFields: byte
	at org.junit.Assert.fail(Assert.java:89)
	at liquibase.serializer.core.string.StringChangeLogSerializerTest.setFields(StringChangeLogSerializerTest.groovy:365)
	at liquibase.serializer.core.string.StringChangeLogSerializerTest.general field serialization check(StringChangeLogSerializerTest.groovy:248)

Thanks,
Daniel.

@fbiville
Copy link
Contributor Author

fbiville commented Jan 2, 2024

Hello, I'm back from vacation, I will have a look now.

fbiville and others added 3 commits January 2, 2024 11:23
- Removed PrimitiveSetterChange inner class and use ChangeWithPrimitiveFields one instead.
- Trivial spock test clean up.
@fbiville
Copy link
Contributor Author

fbiville commented Jan 2, 2024

@MalloD12 I cannot reproduce the issue, the ChangeWithPrimitiveFields class does not seem to be included in the changes tested by StringChangeLogSerializerTest

@MalloD12
Copy link
Contributor

MalloD12 commented Jan 2, 2024

Details

Hi @fbiville,

Same here, I cannot reproduce that issue locally either (but that's because I'm on a Mac) I'll ask someone from the team for some assistance trying to reproduce this issue. I do have not a clear understanding of why that test is failing, or what is the relationship between the type returned by ChangeWithPrimitiveFields and what's being tested in StringChangeLogSerializerTest.

Thanks,
Daniel.

This prevents the change from leaking to other tests
@fbiville
Copy link
Contributor Author

fbiville commented Jan 2, 2024

As discussed on Slack, it turns out the issue came from the fact that the test I added registered a custom change but did not unregister it when the test ended, which had the unwanted effect of keeping that specific change available for other tests.

Copy link
Contributor

@MalloD12 MalloD12 left a comment

Choose a reason for hiding this comment

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

Approved.

Code changes look good to me. Thank you @fbiville for this PR and fixing up the last failing test.

Build and most of the test checks have been successfully executed, except for the functional test suite failing for a known issue when downloading artifacts.

@filipelautert filipelautert added this to the 1NEXT milestone Jan 5, 2024
@filipelautert filipelautert merged commit 8d22eaf into liquibase:master Jan 5, 2024
29 of 31 checks passed
@filipelautert filipelautert changed the title Introduce support for primitive types Introduce support for primitive types in new changes Jan 5, 2024
@fbiville fbiville deleted the primitive_type_support branch January 8, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions TypeEnhancement
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants