-
Notifications
You must be signed in to change notification settings - Fork 917
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
Fix Elasticsearch index creation in functional tests #3954
Fix Elasticsearch index creation in functional tests #3954
Conversation
f66832b
to
fdd452e
Compare
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.
🙏
15ab8b0
to
2c109de
Compare
2c109de
to
e2031fe
Compare
return err | ||
} | ||
if exists { | ||
logger.Info("Index already exists.", tag.ESIndex(esConfig.GetVisibilityIndex())) |
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.
logger.Warn
maybe? It seems that it should never happen.
However, I did see sometimes integration tests failing because index already existed.
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.
This is what I initially tried to address in this PR. It shouldn't happen in CI anymore. But locally, in debugging, if you stop debugger, for example, tests are not teared down properly.
@@ -252,6 +258,70 @@ func NewCluster(options *TestClusterConfig, logger log.Logger) (*TestCluster, er | |||
return &TestCluster{testBase: testBase, archiverBase: archiverBase, host: cluster}, nil | |||
} | |||
|
|||
func setupIndex(esConfig *esclient.Config, logger log.Logger) error { | |||
esClient, err := esclient.NewIntegrationTestsClient(esConfig, logger) |
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 difference between NewIntegrationTestsClient
and NewClient
? L180 above uses the second one.
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.
NewIntegrationTestsClient
is more like admin client which supports operation that are needed for tests only to do operations which are normally made outside of server (index template creation, index creation, etc). I have TODO there to properly separate them or, vice versa, merge in one.
What changed?
Fix Elasticsearch index creation in functional tests.
Why?
Recreation of index led to
flaky error.
How did you test it?
Run tests.
Potential risks
No risks.
Is hotfix candidate?
No.