-
Notifications
You must be signed in to change notification settings - Fork 201
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
GitHub-issue#253 : Implemented GeoIP processor integration test #2927
GitHub-issue#253 : Implemented GeoIP processor integration test #2927
Conversation
Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com>
Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com>
String cityUrl = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=" + maxmindLicenseKey + URL_SUFFIX; | ||
String countryUrl = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=" + maxmindLicenseKey + URL_SUFFIX; | ||
|
||
String pipelineConfig = " aws:\n" + |
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.
Usually, you can do this by Mocking the config. There are many IT.java files where you can see how to do this. Take a look at ./data-prepper-plugins/aggregate-processor/src/test/java/org/opensearch/dataprepper/plugins/processor/aggregate/AggregateProcessorIT.java
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.
As per David suggestion, we have added yaml input (configuration) in other plugins like S3Source.
For example in S3Source: S3SelectCSVOptionTest.java, S3ScanScanOptionsTest.java.
In case integration testing, the mocking should be avoided as much as possible.
geoData = geoIPProcessorService.getGeoData(inetAddress, null); | ||
|
||
assertThat(geoData.get("country_iso_code"), equalTo("US")); | ||
assertThat(geoData.get("ip"), equalTo("/8.8.8.8")); |
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.
Why is it "/8.8.8.8" and not "8.8.8.8"?
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.
Updated the code to get the valid IP in PR#2925 also updated assertion statement with "8.8.8.8" instead of "/8.8.8.8".
Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com>
Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com>
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.
@venkataraopasyavula There's a build failure. Can you take a look?
if (IPValidationcheck.isPublicIpAddress(ipAddress)) {
^
symbol: method isPublicIpAddress(String)
location: class IPValidationcheck
/home/runner/work/data-prepper/data-prepper/data-prepper-plugins/geoip-processor/src/integrationTest/java/org/opensearch/dataprepper/plugins/processor/GeoIPProcessorUrlServiceIT.java:95: error: method getGeoData in class GeoIPProcessorService cannot be applied to given types;
geoData = geoIPProcessorService.getGeoData(inetAddress, null);
^
required: InetAddress,List<String>,ZonedDateTime
found: InetAddress,<null>
reason: actual and formal argument lists differ in length
2 errors
FAILURE: Build failed with an exception.
Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com>
* GitHub-issue#253 : Implemented GeoIP processor integration test Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com> * GitHub-issue#253 : Implemented GeoIP processor integration test Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com> * GitHub-issue#253 : Implemented GeoIP processor integration test Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com> * GitHub-issue#253 : Implemented GeoIP processor integration test Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com> * GitHub-issue#253 : Implemented GeoIP processor integration test Signed-off-by: venkataraopasyavula <venkataraopasyavula@gmail.com> Signed-off-by: George Chen <qchea@amazon.com>
Description
Integration Test
Issues Resolved
GitHub-issue #253
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.