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

Add compliance tests for 3.1.0 #709

Merged
merged 4 commits into from
Feb 2, 2024
Merged

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Feb 1, 2024

What does this PR do?

Add compliance tests for features added in 3.1.0.

For that I had to migrate to the untyped Elasticsearch API as the typed one doesn't have a way to see if a field is using subobjects or not.

Why is it important?

To validate if we can increase the max version supported by Kibana.

@jsoriano jsoriano self-assigned this Feb 1, 2024
Scenario: Installer leverages subobjects false
Given the "subobjects_false" package is installed
And a policy is created with "subobjects_false" package
Then index template "metrics-subobjects_false.foo" has a field "foo.object" with "subobjects:false"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main reason to stop using the typed API, with this one there is no way to check if a property has the subobjects property:

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to be able to use the typed API, but it's true that not using it give us more flexibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the typed API is quite nice, but limited for some things, and complicated for dynamic objects in responses.

}
nextProperties, ok := nextPropertiesValue.Interface().(map[string]types.Property)
if !ok {
return nil, fmt.Errorf("property %q not found in index template, cannot convert properties", name)
Copy link
Member Author

@jsoriano jsoriano Feb 1, 2024

Choose a reason for hiding this comment

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

Another problem of the typed API is that we ended up relying on reflection for some things.

@jsoriano jsoriano marked this pull request as ready for review February 1, 2024 17:57
@jsoriano jsoriano requested a review from a team as a code owner February 1, 2024 17:57
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @jsoriano

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM!
Just a doubt about whether or not set the current next release (3.0.5)

@@ -26,7 +26,8 @@ steps:
EOF

# Generate each test we want to do.
compliance_test 8.10.0-SNAPSHOT 2.10.0
compliance_test 8.13.0-SNAPSHOT 3.1.0
compliance_test 8.12.0 3.0.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be used a non released spec version here too ? Would it make sense ?

I was thinking of adding here also the current 3.0.5-next version as a version to comply too (so we have the stable and the next one).

Suggested change
compliance_test 8.12.0 3.0.4
compliance_test 8.12.0 3.0.5-next
compliance_test 8.12.0 3.0.4

Or just use compliance_test 8.12.0 3.0.5-next ?
It's also true that there is no test package with version 3.0.* currently

Copy link
Member Author

Choose a reason for hiding this comment

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

Umm, actually I did some changes to be able to test with unreleased versions, in principle we could have tested 3.0.5 without the next suffix, as is done with 3.1.0.

Scenario: Installer leverages subobjects false
Given the "subobjects_false" package is installed
And a policy is created with "subobjects_false" package
Then index template "metrics-subobjects_false.foo" has a field "foo.object" with "subobjects:false"
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to be able to use the typed API, but it's true that not using it give us more flexibility.

@jsoriano jsoriano merged commit f59296c into elastic:main Feb 2, 2024
3 checks passed
@jsoriano jsoriano deleted the compliance-3.1.0 branch February 2, 2024 10:18
@jsoriano jsoriano mentioned this pull request Feb 2, 2024
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