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

[#442] account for lists in YamlUtils#loadYaml #443

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

ewilkins-csi
Copy link
Contributor

Also fixes a bug with the hasDouble, hasInt, and hasBoolean methods of YamlObject. Adds tests for YamlUtils including one to catch the root list issue. Finally, also updates the POM migration to account for POMs without dependency management sections.

Also fixes a bug with the `hasDouble`, `hasInt`, and `hasBoolean`
methods of `YamlObject`. Adds tests for `YamlUtils` including one to
catch the root list issue. Finally, also updates the POM migration to
account for POMs without dependcy management sections.
@@ -78,23 +97,23 @@ public String getString(String... path) {
}

public boolean hasInt(String... path) {
return hasValue(int.class, path);
return hasValue(Integer.class, path);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I: these were returning false when they shouldn't have as the map has the boxed version of the value so isInstance was failing.

@@ -73,7 +73,8 @@
"implementation": "com.boozallen.aissemble.upgrade.migration.v1_10_0.DeltaSparkYamlMigration",
"fileSets": [
{
"includes": ["**/*.yaml"]
"includes": ["**/*.yaml"],
"excludes": ["**/target/**", "**/templates/**"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I: Not strictly necessary but this cuts down significantly on the number of output lines talking about un-parseable helm templates.

public void theDecimalValueOfThePropertyIs(String name, double value) {
String type = yaml.get(name).getClass().getSimpleName();
assertTrue("Property was not loaded as double: " + name + " (was " + type + ")", yaml.hasDouble(name));
assertEquals("Property value does not match for: " + name, value, yaml.getDouble(name), 0.01);
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: 0.01?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a delta param that they added to floating point assertions. Avoids the tricky floating point rounding issues where you get 0.000000000001 or some other minuscule difference just from how FP is represented. So this says treat the numbers as equal if they are within 0.01 of each other.

@ewilkins-csi ewilkins-csi merged commit 8b52e0e into dev Oct 28, 2024
@ewilkins-csi ewilkins-csi deleted the 442-fix-delta-migration branch October 28, 2024 21:29
@ewilkins-csi ewilkins-csi linked an issue Oct 29, 2024 that may be closed by this pull request
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.

BUG: Delta Spark migrations fail for some YAML & POM files
3 participants