Skip to content

Sort Fleet integration policy inputs to ensure consistency #494

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

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

taylor-swanson
Copy link
Contributor

  • When new inputs are read from the Fleet API, the list is sorted according to the existing plan. Any new inputs added from the API will be moved to the end of the list. This ensures a consistency of inputs and prevents unnecssary changes from appearing.

Closes #473

- When new inputs are read from the Fleet API, the list is sorted
according to the existing plan. Any new inputs added from the API
will be moved to the end of the list. This ensures a consistency
of inputs and prevents unnecssary changes from appearing.
@taylor-swanson taylor-swanson added the bug Something isn't working label Nov 28, 2023
@taylor-swanson taylor-swanson self-assigned this Nov 28, 2023
@taylor-swanson taylor-swanson marked this pull request as ready for review November 28, 2023 18:49
tobio
tobio previously approved these changes Nov 29, 2023
Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

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

Trying to think of how we could test this, which seems quite tricky. Maybe we could just have a unit test around the sorting logic?

@taylor-swanson
Copy link
Contributor Author

Trying to think of how we could test this, which seems quite tricky. Maybe we could just have a unit test around the sorting logic?

I was thinking the same thing. I originally thought of doing a full acceptance test, but it would be tricky to get that right, and more importantly, keep it right over time.

I'll go ahead and write up a unit test.

@tobio tobio merged commit 6c2f52b into elastic:main Nov 29, 2023
@taylor-swanson taylor-swanson deleted the bug/integ-policy-input-sort branch November 29, 2023 20:21
daemitus pushed a commit to daemitus/terraform-provider-elasticstack that referenced this pull request Nov 30, 2023
* Sort Fleet integration policy inputs to ensure consistency

- When new inputs are read from the Fleet API, the list is sorted
according to the existing plan. Any new inputs added from the API
will be moved to the end of the list. This ensures a consistency
of inputs and prevents unnecssary changes from appearing.

* Changelog

* Extract sort function and add unit test
daemitus pushed a commit to daemitus/terraform-provider-elasticstack that referenced this pull request Nov 30, 2023
* Sort Fleet integration policy inputs to ensure consistency

- When new inputs are read from the Fleet API, the list is sorted
according to the existing plan. Any new inputs added from the API
will be moved to the end of the list. This ensures a consistency
of inputs and prevents unnecssary changes from appearing.

* Changelog

* Extract sort function and add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Idempotency issue while having multiple inputs using elasticstack_fleet_package_policy
2 participants