Skip to content

functionaltests: Add 7x to 8x standalone to managed test #16503

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 20 commits into from
Apr 14, 2025

Conversation

ericywl
Copy link
Contributor

@ericywl ericywl commented Apr 2, 2025

Motivation/summary

Add tests for 7.x -> 8.x:

  • 7.x standalone -> 8.x standalone -> 8.x managed
  • 7.x standalone -> 7.x managed -> 8.x managed

Note: Requires #16537 to be merged first.

How to test these changes

Run functionaltests with this branch: https://github.com/elastic/apm-server/actions/runs/14436234632.

@ericywl ericywl self-assigned this Apr 2, 2025
@ericywl ericywl requested a review from a team as a code owner April 2, 2025 09:46
Copy link
Contributor

mergify bot commented Apr 2, 2025

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

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-9./d is the label to automatically backport to the 9./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@ericywl ericywl added the backport-skip Skip notification from the automated backport with mergify label Apr 2, 2025
@ericywl ericywl force-pushed the functionaltests-7to8 branch from 472a2d7 to e3a5884 Compare April 2, 2025 10:12
@ericywl ericywl changed the base branch from main to functionaltests-add-v7-support April 2, 2025 10:12
@ericywl ericywl force-pushed the functionaltests-7to8 branch 3 times, most recently from f2283ee to e7ca71c Compare April 2, 2025 12:09
Copy link
Contributor

mergify bot commented Apr 2, 2025

This pull request is now in conflicts. Could you fix it @ericywl? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b functionaltests-7to8 upstream/functionaltests-7to8
git merge upstream/functionaltests-add-v7-support
git push upstream functionaltests-7to8

@ericywl ericywl force-pushed the functionaltests-7to8 branch from 85cc1dd to b198e3a Compare April 2, 2025 12:12
@ericywl ericywl changed the base branch from functionaltests-add-v7-support to main April 2, 2025 12:12
@ericywl ericywl changed the base branch from main to functionaltests-add-v7-support April 2, 2025 12:12
@ericywl ericywl force-pushed the functionaltests-7to8 branch from b198e3a to 002e828 Compare April 2, 2025 12:13
Base automatically changed from functionaltests-add-v7-support to main April 3, 2025 02:32
Copy link
Contributor

mergify bot commented Apr 3, 2025

This pull request is now in conflicts. Could you fix it @ericywl? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b functionaltests-7to8 upstream/functionaltests-7to8
git merge upstream/main
git push upstream functionaltests-7to8

@ericywl ericywl force-pushed the functionaltests-7to8 branch from 002e828 to e4af556 Compare April 3, 2025 02:58
@ericywl ericywl requested a review from endorama April 3, 2025 10:32
@ericywl ericywl force-pushed the functionaltests-7to8 branch from 810fcac to 22a570a Compare April 4, 2025 14:54
@ericywl ericywl changed the base branch from main to functionaltests-minor-refactor April 4, 2025 14:56
Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

I see that the tests are still failing for 8.x, maybe it needs to ignore 7.x data stream as well?

As the above issue needs to be addressed, I'd suggest to extract some small refactoring into separate PRs to focus on the 7 to 8 test that is already quite sizeable.

The code for the 7 to 8 test looks good to me, so if tests are green we can move forward merging this :)

Copy link
Contributor

mergify bot commented Apr 7, 2025

This pull request is now in conflicts. Could you fix it @ericywl? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b functionaltests-7to8 upstream/functionaltests-7to8
git merge upstream/functionaltests-minor-refactor
git push upstream functionaltests-7to8

@ericywl ericywl force-pushed the functionaltests-7to8 branch from f8b5976 to b5ccd1a Compare April 7, 2025 08:05
@ericywl ericywl force-pushed the functionaltests-minor-refactor branch from c364715 to 4143bdf Compare April 7, 2025 08:22
Copy link
Contributor

mergify bot commented Apr 7, 2025

This pull request is now in conflicts. Could you fix it @ericywl? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b functionaltests-7to8 upstream/functionaltests-7to8
git merge upstream/functionaltests-minor-refactor
git push upstream functionaltests-7to8

@ericywl ericywl force-pushed the functionaltests-7to8 branch from b5ccd1a to ef29ad0 Compare April 7, 2025 08:25
@ericywl ericywl requested a review from endorama April 7, 2025 08:25
Base automatically changed from functionaltests-minor-refactor to main April 10, 2025 02:09
Copy link
Contributor

mergify bot commented Apr 10, 2025

This pull request is now in conflicts. Could you fix it @ericywl? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b functionaltests-7to8 upstream/functionaltests-7to8
git merge upstream/main
git push upstream functionaltests-7to8

@ericywl ericywl force-pushed the functionaltests-7to8 branch from 100e2df to 2de3459 Compare April 10, 2025 02:26
@endorama
Copy link
Member

The last run had 2 failures

A failure in TestUpgrade_7_17_to_8_x_Snapshot_Standalone_to_Managed/UpgradeFirst, this is a terraform error, see https://github.com/elastic/apm-server/actions/runs/14399137531/job/40380766371#step:7:163

A failure in TestUpgrade_9_0_to_9_1_Snapshot both default and reroute, related to these errors:

"[
{2025-04-11 08:44:25.414 +0000 UTC refresh cache error: refresh cache elasticsearch returned status 403 agentcfg}
{2025-04-11 08:44:25.414 +0000 UTC stopping refresh cache background job: elasticsearch config is invalid agentcfg}
]"

Inspecting the logs it seems the error "recovers" to become a 503. I'm thinking this may be due to the fleet server bootstrapping the apm server. I'm not 100% confident this is the right choice but it feels safe to ignore (probably worth checking with the Fleet team though).

Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

minor comments for the PR but there are test failures to address.

IndicesManagedBy: []string{managedByILM, managedByILM},
}

check := map[string]asserts.CheckDataStreamIndividualWant{
Copy link
Member

@endorama endorama Apr 11, 2025

Choose a reason for hiding this comment

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

The next step here would be to refactor all data stream check to follow a similar pattern: instead of a list checked in a order sensitive manner, use a map where the checker can match keys to data streams and then use the specific check value for assertions. Not to be addressed in this PR.

Comment on lines 104 to 115
if !e.integrations {
idxDocCount := getDocCountPerIndexV7(t, ctx, e.esc)
asserts.CheckDocCountV7(t, idxDocCount, previousRes.IndicesDocCount,
expectedIndicesIngest())
return testStepResult{IndicesDocCount: idxDocCount}
}

// Managed, check data streams
dsDocCount := getDocCountPerDSV7(t, ctx, e.esc, e.dsNamespace)
asserts.CheckDocCount(t, dsDocCount, previousRes.DSDocCount,
expectedDataStreamsIngestV7(e.dsNamespace))
return testStepResult{DSDocCount: dsDocCount}
Copy link
Member

Choose a reason for hiding this comment

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

Why are we also checking non standalone DS here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean by this? When we ingest in managed mode, we check the data streams.

Copy link
Member

Choose a reason for hiding this comment

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

My confusion stemmed from using legacy here. In this case this step is used for 7.x tests in both standalone and managed modes, so it's correct that is checking data streams. Thanks for clarifying that.

@ericywl ericywl requested a review from endorama April 14, 2025 02:38
@ericywl
Copy link
Contributor Author

ericywl commented Apr 14, 2025

Updated and ran new passing run: https://github.com/elastic/apm-server/actions/runs/14436234632.

@ericywl ericywl merged commit c795a41 into main Apr 14, 2025
19 checks passed
@ericywl ericywl deleted the functionaltests-7to8 branch April 14, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants