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

functionaltest: Add one re-route processor test #15960

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

ericywl
Copy link
Contributor

@ericywl ericywl commented Mar 3, 2025

Changes

Based on #15951

  • Add CreateRerouteProcessors and PerformManualRollovers to ES client
  • Add re-route processor test for 8.13.4 -> 8.16.0
  • Parallelize functional tests

How to test these changes

Run functional test on this branch.

Test run: https://github.com/elastic/apm-server/actions/runs/13675996351

Copy link
Contributor

mergify bot commented Mar 3, 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 Mar 4, 2025
@ericywl ericywl force-pushed the functionaltests-reroute-processor branch from c5c9d1f to 7abe748 Compare March 4, 2025 07:24
@endorama
Copy link
Member

endorama commented Mar 4, 2025

Given that this PR is in draft, but is also doing a refactoring that may block other work (see #16011 for example) can you please extract the refactoring in a separate PR so we can merge it faster?

@ericywl
Copy link
Contributor Author

ericywl commented Mar 5, 2025

Given that this PR is in draft, but is also doing a refactoring that may block other work (see #16011 for example) can you please extract the refactoring in a separate PR so we can merge it faster?

The refactoring is in #15951.

Copy link
Contributor

mergify bot commented Mar 5, 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-reroute-processor upstream/functionaltests-reroute-processor
git merge upstream/main
git push upstream functionaltests-reroute-processor

@ericywl ericywl changed the base branch from main to functionaltests-refactor March 5, 2025 02:54
@ericywl ericywl force-pushed the functionaltests-reroute-processor branch from 06c0c1b to 469b30b Compare March 5, 2025 03:00
Copy link
Contributor

mergify bot commented Mar 5, 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-reroute-processor upstream/functionaltests-reroute-processor
git merge upstream/functionaltests-refactor
git push upstream functionaltests-reroute-processor

@ericywl ericywl force-pushed the functionaltests-reroute-processor branch from 469b30b to 0eb5de2 Compare March 5, 2025 03:05
@ericywl ericywl force-pushed the functionaltests-reroute-processor branch from 0eb5de2 to 53468ac Compare March 5, 2025 03:12
Copy link
Contributor

mergify bot commented Mar 5, 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-reroute-processor upstream/functionaltests-reroute-processor
git merge upstream/functionaltests-refactor
git push upstream functionaltests-reroute-processor

@ericywl ericywl force-pushed the functionaltests-reroute-processor branch from a60e228 to d26c69a Compare March 5, 2025 11:15
Base automatically changed from functionaltests-refactor to main March 5, 2025 12:21
Copy link
Contributor

mergify bot commented Mar 5, 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-reroute-processor upstream/functionaltests-reroute-processor
git merge upstream/main
git push upstream functionaltests-reroute-processor

@ericywl ericywl requested a review from endorama March 6, 2025 03:03
@ericywl ericywl marked this pull request as ready for review March 6, 2025 03:04
@ericywl ericywl requested a review from a team as a code owner March 6, 2025 03:04
@ericywl ericywl marked this pull request as draft March 6, 2025 07:26
@ericywl
Copy link
Contributor Author

ericywl commented Mar 6, 2025

Moved back to draft since it's failing.

@@ -22,6 +22,7 @@ import (
)

func TestUpgrade_8_18_0_to_9_0_0(t *testing.T) {
t.Parallel()
Copy link
Member

Choose a reason for hiding this comment

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

let's do this in a separate PR

// CreateRerouteProcessors creates re-route processors with the specified namespace for logs, metrics and traces.
//
// Refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/reroute-processor.html.
func (c *Client) CreateRerouteProcessors(ctx context.Context, name string) error {
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to name this:

Suggested change
func (c *Client) CreateRerouteProcessors(ctx context.Context, name string) error {
func (c *Client) CreateRerouteIngestPipeline(ctx context.Context, name string) error {

To make this method more generic, what do you think about having a CreateIngestPipeline method that accepts a []types.ProcessorContainer?

return nil
}

func (c *Client) performManualRollover(ctx context.Context, dataStream string) error {
Copy link
Member

Choose a reason for hiding this comment

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

If this method is not used anywhere else, let's just include it in the public one. It reduces the API surface we will need to maintain.

If this is done to have a generic implementation (that does not use fixed data stream names for example) I would suggest to promote this as the public method on this struct and create a test helper func in the main tests folder.

// assertDocCount check if specified document count is equal to expected minus
// documents count from a previous state.
func assertDocCount(t *testing.T, docsCount, previous, expected esclient.APMDataStreamsDocCount) {
func assertDocCount(t *testing.T, docsCount, previous, expected esclient.APMDataStreamsDocCount, skippedDataStreams []string) {
Copy link
Member

Choose a reason for hiding this comment

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

What's the benefit of introducing skippedDataStreams?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my case, it's so that we can assert if there are some unexpected data streams. It was helpful for the reroute test as it helped identify that I forgot to change the expected data streams to rerouted (i.e. the assertions weren't happening because it was trying to find default).

@@ -34,6 +34,37 @@ import (
"github.com/elastic/apm-server/functionaltests/internal/terraform"
)

type dependencies struct {
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of adding this fields to the test struct? As these are part of the test itself, I see this struct as tightly coupled with the test one, and I think this would be better expressed by having these fields there.

return newDefaultConfigWithNamespace(defaultNamespace)
}

type additionalFn func(t *testing.T, ctx context.Context, cfg *config, deps dependencies) (continueTest bool)
Copy link
Member

Choose a reason for hiding this comment

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

What is the benefit of the pointer to config here? Do you expect this func to change the configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case of reroute, I used this config to change the expected docs and skipped data streams midtest.

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