Giter Club home page Giter Club logo

Comments (5)

aeneasr avatar aeneasr commented on May 18, 2024

Yes, MongoDB is supported. In fact, all docker images are now supported! You simply specify the image and the port and then you're good to go. Check out how this works with, for example, MySQL: https://github.com/ory-am/dockertest/blob/v3/dockertest_test.go#L28-L40

Here are more examples: https://github.com/ory-am/common/blob/master/integration/integration.go

from dockertest.

drasko avatar drasko commented on May 18, 2024

Thanks, this worked for me: https://github.com/mainflux/mainflux-core/blob/master/api/init_test.go

It would be great if you can add MongoDB example similar to this implementation to your https://github.com/ory-am/common/blob/master/integration/integration.go, so that everybody can have a reference.

from dockertest.

aeneasr avatar aeneasr commented on May 18, 2024

Hi, the API changed completely. You no longer need those hard dependencies. Did you check the examples I provided? Running MongoDB should be as easy as:

	pool, err = dockertest.NewPool("")
	if err != nil {
		log.Fatalf("Could not connect to docker: %s", err)
	}

	resource, err := pool.Run("mongo", "3.0", []string{""})
	if err != nil {
		log.Fatalf("Could not start resource: %s", err)
	}

	mongoUrl := fmt.Sprintf("mongodb://localhost:%s", resource.GetPort("27017/tcp"))

	// connect to mongo here

from dockertest.

drasko avatar drasko commented on May 18, 2024

Which hard dependencies? My implementation (in the link I posted) is almost identical to the one you posted here... Now I'm confused :(

from dockertest.

aeneasr avatar aeneasr commented on May 18, 2024

Ah sorry, it was late and I think I misread :) The link you provided looks perfect! We could probably add some examples in the README or have a dedicated docs/ directory for the different databases?

What I meant with the hard dependencies is that now go get github.com/ory-am/dockertest won't pull all those drivers (mysql, postgres, etcd, ...) any more, which is I think a really cool thing :)

from dockertest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.