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

Fix mongodb test #396

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Fix mongodb test #396

merged 1 commit into from
Aug 27, 2020

Conversation

unsortedhashsets
Copy link
Contributor

We need to pass variable to the mongodb.host in format mongodb://user:pass@domain otherway:
[ERROR] CamelSinkMongoDBITCase.setUp:63 » IllegalArgument The connection string is inv...
[ERROR] CamelSourceMongoDBITCase.setUp:66 » IllegalArgument The connection string is i...

But if we pass in that format we receive mongodb://mongodb://user:pass@domain:port and:
[ERROR] Failures:
[ERROR] CamelSinkMongoDBITCase.testBasicSendReceive:120->runTest:100 Condition not met within timeout 30000. The connector CamelMongoDBSinkConnector did not start within a reasonable time
[ERROR] Errors:
[ERROR] CamelSourceMongoDBITCase.testFindAll » Timeout testFindAll() timed out after 9...

With that fix - test will pass (tested with remote mongodb)

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

@orpiske can you have a look? This will break the build I suppose

@orpiske
Copy link
Contributor

orpiske commented Aug 26, 2020

@oscerd sure thing, I will take a look :)

@orpiske
Copy link
Contributor

orpiske commented Aug 26, 2020

@unsortedhashsets thanks for the PR. I understand the problem you are trying to solve. Unfortunately, this way it breaks the build. The build test is failing on local mode because on local mode the service only provides the host and port (so it is not form a valid connection URL when passed to the connection bean ref). You need to adjust the patch a little bit in order to achieve the results you need in both local and remote test mode.

I would suggest replacing the getHost and getPort methods on the service [1] (and their local [2] and remote [3] implementations) with a single getConnectionUrl that provides the connection URL mongodb://mongodb://user:pass@domain:port. Therefore, instead of running the test like -Dmongodb.host=mongodb://user:password@myhostname.com -Dmongodb.port=31244 you could pass it like this -Dmongodb.url=mongodb://user:password@myhostname.com:31244.

Of course, this is just a suggestion and there may be other ways to solve this issue, but I think this would do the trick. If you have questions, feel free to ask. I can guide you.

  1. https://github.com/apache/camel-kafka-connector/blob/master/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/services/MongoDBService.java#L38
  2. https://github.com/apache/camel-kafka-connector/blob/master/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/services/MongoDBLocalContainerService.java
  3. https://github.com/apache/camel-kafka-connector/blob/master/tests/itests-mongodb/src/test/java/org/apache/camel/kafkaconnector/mongodb/services/RemoteMongoDBService.java

@orpiske
Copy link
Contributor

orpiske commented Aug 26, 2020

@unsortedhashsets I've just tested the changes and they are working well for local mode. Thanks!!!

c/c @oscerd

@unsortedhashsets
Copy link
Contributor Author

Oh, sorry I have just finished remote test (success) and updated repo .

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

LGTM, @orpiske can you retake a look?

@orpiske
Copy link
Contributor

orpiske commented Aug 27, 2020

LGTM, @orpiske can you retake a look?

Sure thing! I have just run the test again, with the latest changes from @unsortedhashsets and it is working. IMHO, it's good to merge.

@oscerd oscerd merged commit 766e05d into apache:master Aug 27, 2020
@oscerd
Copy link
Contributor

oscerd commented Aug 27, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants