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

Ensure unique ID for dynamic variable replacement. #1866

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Dec 1, 2022

What does this PR do?

This updates the ID of an input to concat the current ID with the unique ID of the variable context from the dynamic provided that provided the replacement.

The original ID is moved to original_id and the new id is placed on the input.

Why is it important?

Ensures that when a variable substitution is performed for an input definition duplicate of that input results in a unique ID for that newly defined input.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@blakerouse blakerouse added the Team:Elastic-Agent Label for the Agent team label Dec 1, 2022
@blakerouse blakerouse self-assigned this Dec 1, 2022
@mergify
Copy link
Contributor

mergify bot commented Dec 1, 2022

This pull request does not have a backport label. Could you fix it @blakerouse? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip label Dec 1, 2022
@blakerouse blakerouse added backport-v8.6.0 Automated backport with mergify and removed backport-skip labels Dec 1, 2022
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
8.0% 8.0% Duplication

@blakerouse blakerouse marked this pull request as ready for review December 1, 2022 21:08
@blakerouse blakerouse requested a review from a team as a code owner December 1, 2022 21:08
@blakerouse blakerouse requested review from AndersonQ and michel-laterman and removed request for a team December 1, 2022 21:08
@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 1, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-01T21:07:31.201+0000

  • Duration: 18 min 18 sec

Test stats 🧪

Test Results
Failed 0
Passed 4661
Skipped 13
Total 4674

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Contributor

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.333% (59/60) 👍
Files 69.082% (143/207) 👍
Classes 69.133% (271/392) 👍
Methods 53.958% (818/1516) 👍 0.096
Lines 39.083% (8841/22621) 👍 0.059
Conditionals 100.0% (0/0) 💚

@blakerouse blakerouse merged commit c3f216c into elastic:main Dec 2, 2022
mergify bot pushed a commit that referenced this pull request Dec 2, 2022
* Ensure unique ID for dynamic variable replacement.

* Add changelog.

(cherry picked from commit c3f216c)
@blakerouse blakerouse deleted the ensure-unique-input-ids branch December 2, 2022 14:09
@cmacknz
Copy link
Member

cmacknz commented Dec 2, 2022

The changes here themselves look good, but I don't see any new tests added. Did the existing tests reproduce this problem with the additional ID field? How did we verify this? Do we need to follow up and add a regression test for this?

blakerouse added a commit that referenced this pull request Dec 2, 2022
* Ensure unique ID for dynamic variable replacement.

* Add changelog.

(cherry picked from commit c3f216c)

Co-authored-by: Blake Rouse <[email protected]>
@blakerouse
Copy link
Contributor Author

@cmacknz The existing tests where modified to cover it. So it's fully covered and if a regression happens the tests would catch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.6.0 Automated backport with mergify Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Input IDs are not unique at runtime when dynamic providers are used
4 participants