findify / s3mock

Embedded S3 server for easy mocking
MIT License
387 stars 107 forks source link

Typesafe config fails with s3mock #56

Open SrikanthTati opened 7 years ago

SrikanthTati commented 7 years ago

Typesafe config's load() methods fails If I start s3mock. Not sure what is the link between the two. May be classloader issues??

This is how I start s3mock new S3Mock.Builder().withPort(8001).withInMemoryBackend().build().start

There are other tests that follow which loads config using ConfigFactory.load(). Load() fails only if I start s3mock.

shuttie commented 7 years ago

Can you show the stacktrace of the failure? As I also use TypesafeConfig in my apps and it works quite fine.

SrikanthTati commented 7 years ago

Sorry for the delay in response. Got pulled into something else.

There isn't a stack trace. ConfigFactory.load() just fails to load application conf. If I do ConfigFactory.parseFile(new File(path)) its able to load. But if I set system property config.url and use ConfigFactory.load() then it fails to load from the set URL. The same test case runs fine if I don't run the tests that use S3Mock.

If I exclude tests that use S3Mock, then reader.getConfig("MyConfig") returns expected configs. If I include all test(the ones that use S3Mock also), then reader.getConfig("MyConfig") fails because "MyConfig" is not found. Both attempts set the same value of config.url

SrikanthTati commented 7 years ago

I've created a test app to reproduce this easily. https://github.com/SrikanthTati/S3Mock-Test You can run this locally with sbt test to see the failure.

SrikanthTati commented 7 years ago

Were you able to reproduce this with the test app I built?