-
Notifications
You must be signed in to change notification settings - Fork 528
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
base: main
Are you sure you want to change the base?
Conversation
This pull request does not have a backport label. Could you fix it @ericywl? 🙏
|
c5c9d1f
to
7abe748
Compare
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? |
This pull request is now in conflicts. Could you fix it @ericywl? 🙏
|
06c0c1b
to
469b30b
Compare
This pull request is now in conflicts. Could you fix it @ericywl? 🙏
|
469b30b
to
0eb5de2
Compare
0eb5de2
to
53468ac
Compare
This pull request is now in conflicts. Could you fix it @ericywl? 🙏
|
a60e228
to
d26c69a
Compare
This pull request is now in conflicts. Could you fix it @ericywl? 🙏
|
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() |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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:
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 { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Changes
Based on #15951
CreateRerouteProcessors
andPerformManualRollovers
to ES clientHow to test these changes
Run functional test on this branch.
Test run: https://github.com/elastic/apm-server/actions/runs/13675996351