Skip to content

Conversation

G3N7
Copy link
Contributor

@G3N7 G3N7 commented Jun 1, 2016

I am trying to get Mongo2Go working in travis-ci and could use to know where the executing test's context is that is giving me this exception.

@JohannesHoppe
Copy link
Member

I like that idea. But I wouldn't use Interpolated Strings (C# 6) here, my goal is to keep it compatible with older versions of Visual Studio, too.

@JohannesHoppe
Copy link
Member

JohannesHoppe commented Jun 1, 2016

Different topic: you wrote travis-ci.

I don't think that your plan will work that easily.
Travis-CI is a Linux environment and uses mono. So the C# part should work, but it won't be able to start the executables, since they are binaries for Windows.

However it might work to retrieve the right executables using apt-get and/or the ready-to-use database setup of travis-ci:

services:
  - mongodb

In both cases the search for the executables needs to be extended.
Something like:
public static MongoDbRunner Start(string dataDirectory = MongoDbDefaults.DataDirectory, string findFolderStartPath = null)

See https://github.com/JohannesHoppe/Mongo2Go/blob/master/src/Mongo2Go/MongoDbRunner.cs#L34 / https://github.com/JohannesHoppe/Mongo2Go/blob/master/src/Mongo2Go/MongoDbRunner.cs#L51

@G3N7
Copy link
Contributor Author

G3N7 commented Jun 1, 2016

Interesting ok sounds good, I will try those routes. Thank you for your help!

@G3N7
Copy link
Contributor Author

G3N7 commented Jun 3, 2016

OK, I moved to string.format. Thank you for your recommendation, I have moved to using the mongodb service in travis as suggested and its working like a charm.

@JohannesHoppe JohannesHoppe merged commit 9a986cb into Mongo2Go:master Jun 3, 2016
@JohannesHoppe
Copy link
Member

Do you mind to send another pull request + readme update about your work to enable Mongo2Go on Travis-CI? :-)

@G3N7
Copy link
Contributor Author

G3N7 commented Jun 8, 2016

So I actually alternate between if I use Mongo2Go or an alternate temporary DB.

I added a few comments to this commit to explain what I am doing.
G3N7/MonJobs@4e66241

@G3N7
Copy link
Contributor Author

G3N7 commented Jun 8, 2016

Take a look and let me know if you think others would benefit from this approach, the pattern I and colleges have settled on injects the IMongoDatabase. Take a look at https://github.com/G3N7/MonJobs/blob/master/MonJobs.Tests/MongoJobQueryServiceTests.cs for a few examples of how the tests end up looking.

@JohannesHoppe
Copy link
Member

This looks like serious tested and well done-work! 👍 😄

What about a pull request to the Readme.md? You could write that it's technically possible to run this on travis and that people should refer to MonJobs to figure out how it works!

There are other people that are trying the same right now:
see #9

@G3N7
Copy link
Contributor Author

G3N7 commented Jul 6, 2016

That sounds great, thanks for taking a look. I will send you a pull request sometime next week once my family has left from visiting.

JohannesHoppe added a commit that referenced this pull request Jul 24, 2016
all the stuff from #8, #9, #10, #11
@krippz @G3N7
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.

2 participants