Skip to content

Add accept_ignored_values to field spec#743

Merged
jsoriano merged 6 commits intoelastic:mainfrom
flash1293:flash1293/accept-ignored-values
May 13, 2024
Merged

Add accept_ignored_values to field spec#743
jsoriano merged 6 commits intoelastic:mainfrom
flash1293:flash1293/accept-ignored-values

Conversation

@flash1293
Copy link
Contributor

@flash1293 flash1293 commented May 3, 2024

What does this PR do?

This PR adds a new property skip_ignored_fields to the system test spec which is planned to be used in the elastic-package system tests.

Why is it important?

As discussed in elastic/elastic-package#1738 , it's sometimes important to mute errors during testing because they are not indicative of a real problem but related to the test setup.

This addition allows to override test failures similar to comments muting linting errors in source code.

Checklist

@flash1293 flash1293 requested a review from a team as a code owner May 3, 2024 13:57
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

If needed, I think we should make this a test config setting rather than part of the field definition.

@ShourieG
Copy link
Contributor

ShourieG commented May 7, 2024

@flash1293 Are we supporting this in the validation.yml or directly in the field definition in the fields.yml, ecs.yml files ?

@flash1293
Copy link
Contributor Author

@ShourieG This was an old version, I just pushed a change, could you have a look? I added it to the system test definition now.

@ShourieG
Copy link
Contributor

ShourieG commented May 7, 2024

@flash1293 Having this tied to the package-spec forces us to increase the format_version, which in turn can cause un-intended errors while building with elastic-package, having all integrations using the latest format_version might have limitations, is there any other way we can include this, example adding it in the validations.yml file ?

@flash1293
Copy link
Contributor Author

flash1293 commented May 7, 2024

is there any other way we can include this, example adding it in the validations.yml file

@ShourieG I think it should be a per-field setting, not a wholesale config to ignore all ignored fields in all tests as this would shadow newly introduced issues. Is there a way to do this without releasing a new package spec version?

@ShourieG
Copy link
Contributor

ShourieG commented May 7, 2024

is there any other way we can include this, example adding it in the validations.yml file

@ShourieG I think it should be a per-field setting, not a wholesale config to ignore all ignored fields in all tests as this would shadow newly introduced issues. Is there a way to do this without releasing a new package spec version?

@flash1293 Is the validations.yml file a valid approach here ? Since at the end of the day we are having to define the excluded fids for each integration test config, having it be a part of the validation file which is now supported by all existing integrations would be an easier trade-off?

@flash1293
Copy link
Contributor Author

@ShourieG I might misunderstand, but in order to extend the validation.yml to also take a list of fields to not check _ignored for, don't we need to release a version of the package spec as well? By my understanding currently validation.yml can only completely exclude certain checks, which is not what we want here

@flash1293
Copy link
Contributor Author

Hmm, maybe we could have something like SVR00006:<field name> would be an option (but it still seems like a workaround):

errors:
  exclude_checks:
   - "SVR00006:error.message" # do not fail on error.message getting ignored

What do you think @jsoriano ? To me it seems like the system test config is the right place for this, but I don't have a strong opinion really.

@jsoriano
Copy link
Member

jsoriano commented May 8, 2024

What do you think @jsoriano ? To me it seems like the system test config is the right place for this, but I don't have a strong opinion really.

Yeah, I prefer to have it in the test config.

Having this tied to the package-spec forces us to increase the format_version

The spec for test config files is barely validated, we accept almost anything there (due to this additionalProperties: true), so using this feature won't force to increase the format_version, at least as it is now being considered.

@jsoriano jsoriano dismissed their stale review May 8, 2024 08:30

Changed approach.

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

This approach LGTM, let's solve the issues with CI. Thanks!

for the specified field names can't be indexed for any incoming documents. This
should only be used if the failure is related to the test environment
and wouldn't happen in production. Mitigate the issue via mapping or
pipeline changes otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -1,2 +1,4 @@
wait_for_data_timeout: 10m
skip_ignored_fields:
- error.message
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Could we also add a good example in the good_v3 package?

@jsoriano
Copy link
Member

jsoriano commented May 8, 2024

As this change is not required for elastic/elastic-package#1738, could you include the implementation for this feature there before merging this?
Thanks!

@elasticmachine
Copy link

💚 Build Succeeded

History

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Please consider adding the implementation for this in elastic/elastic-package#1738 before merging 🙏

Thanks!

@flash1293
Copy link
Contributor Author

elastic/elastic-package#1738 is merged, could you merge @jsoriano ? (I don't have the permission to do so)

@jsoriano jsoriano merged commit a32f972 into elastic:main May 13, 2024
@jsoriano
Copy link
Member

Merged, thanks!

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.

5 participants