-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/elasticsearchreceiver] Add elasticsearch integration test #10361
[receiver/elasticsearchreceiver] Add elasticsearch integration test #10361
Conversation
require.NoError(t, err) | ||
|
||
scrapertest.CompareMetrics(expectedMetrics, actualMtrics, scrapertest.IgnoreMetricValues()) | ||
//err = scrapertest.CompareMetrics(expectedMetrics, actualMtrics, scrapertest.IgnoreMetricValues()) |
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.
Were you able to run this receiver locally against the container? (Is that how you generated the result?)
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.
yes, I run this reveiver locally and get the result. I have checked the es container by call http://localhost:9200
,its seem running well.
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 it's working for you locally, then I suspect this is an issue with not using a "wait strategy" to verify that the application is ready. Without a wait strategy, the container may start, but the application within it may not be ready to respond by the time the scraper tries to query it.
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.
thx ,I will have a try...
receiver/elasticsearchreceiver/testdata/integration/expected.7_9.json
Outdated
Show resolved
Hide resolved
receiver/elasticsearchreceiver/testdata/integration/Dockerfile.elasticsearch.7_9_3
Outdated
Show resolved
Hide resolved
receiver/elasticsearchreceiver/testdata/integration/Dockerfile.elasticsearch
Outdated
Show resolved
Hide resolved
require.NoError(t, err) | ||
|
||
scrapertest.CompareMetrics(expectedMetrics, actualMtrics, scrapertest.IgnoreMetricValues()) | ||
//err = scrapertest.CompareMetrics(expectedMetrics, actualMtrics, scrapertest.IgnoreMetricValues()) |
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 it's working for you locally, then I suspect this is an issue with not using a "wait strategy" to verify that the application is ready. Without a wait strategy, the container may start, but the application within it may not be ready to respond by the time the scraper tries to query it.
Co-authored-by: Daniel Jaglowski <[email protected]>
|
||
f := NewFactory() | ||
cfg := f.CreateDefaultConfig().(*Config) | ||
cfg.Endpoint = net.JoinHostPort(hostname, "9200") |
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 figure out what is going on, this line set cfg.Endpoint="localhost:9200"
, actullay, we need http://localhost:9200
.
# Conflicts: # receiver/elasticsearchreceiver/go.sum
hi, after that problem, I scraped the data from es container, and the
I think, its probably fine for the test. pls review :) |
@Frapschen A similar issue has prompted #10129. For this immediate problem, I am ok with the fact that the resource attribute is unpredictable. However, the test will of course need to pass. One way to make this work immediately would be to override the attribute in either the expected or actual resource, or both. |
@djaglowski I can override the expected resource, but I don't know that can achieve the test purpose, or we just write the actual resource and ignore the err? |
@Frapschen, I think in this case it is ok to overwrite the randomly generated value of |
@djaglowski I override the |
@Frapschen, #10828 was just merged, which should provide you with a CompareOption to ignore the attribute value (rather than having to overwrite it). Will you please switch to using that? |
# Conflicts: # CHANGELOG.md # receiver/elasticsearchreceiver/go.sum
@djaglowski used |
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.
Thank you @Frapschen!
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.
Looks like we need to figure out what's going on with this test on windows:
=== CONT TestElasticsearchIntegration/Running_elasticsearch_7.9
integration_test.go:91:
Error Trace: integration_test.go:91
integration_test.go:50
Error: Received unexpected error:
Error response from daemon: could not find plugin bridge in v1 plugin registry: plugin not found: failed to create container
Test: TestElasticsearchIntegration/Running_elasticsearch_7.9
--- FAIL: TestElasticsearchIntegration (0.00s)
--- FAIL: TestElasticsearchIntegration/Running_elasticsearch_7.9 (15.12s)
…pen-telemetry#10361) * init elasticsearch integration test. * Add elasticsearch integration test. * Apply suggestions from code review Co-authored-by: Daniel Jaglowski <[email protected]> * resolve endpoint miss schema * resolve conflict. * update changelog * save * update * override the attribute to the expected one * apply reviewer's suggestion. * Update integration_test.go Co-authored-by: Daniel Jaglowski <[email protected]>
Description:
Add elasticsearch integration test.