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

feat: Validate app processes are alphabetically sorted #64

Merged
merged 4 commits into from
Jan 28, 2025

Conversation

prbn021
Copy link
Contributor

@prbn021 prbn021 commented Dec 16, 2024

This feature introduces a validation to ensure that app processes are defined in alphabetical order. Improving consistency and predictability when managing apps via Terraform.

changes:

  • Added a validation function to check the sorting of processes during app creation and update.
  • Added a new test case to verify the behavior when processes are not sorted alphabetically.

@@ -230,6 +230,10 @@ func resourceTsuruApplicationCreate(ctx context.Context, d *schema.ResourceData,
if m, ok := d.GetOk("process"); ok {
processes := processesFromResourceData(m)
if processes != nil {
err := isProcessListSorted(processes)
Copy link
Contributor

Choose a reason for hiding this comment

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

The name isProcessListSorted makes me believe this returns true or false, but thats not the case here.
Mais something like sortProcessesList could work better here? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right—isProcessListSorted suggests a boolean return, which no longer reflects this function behavior after the recent changes.

@wpjunior wpjunior merged commit 745efb1 into tsuru:main Jan 28, 2025
1 check passed
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