GithubHelp home page GithubHelp logo

bkosm / gompose Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 106 KB

Use docker-compose programatically in Go tests. No third-party dependencies.

License: GNU General Public License v3.0

Go 100.00%
docker docker-compose go golang testing

gompose's Introduction

gompose's People

Contributors

actions-user avatar bkosm avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gompose's Issues

Up should accept options struct

Parameters to the Up function should accept a struct rather than a required param and varargs.


Turn this:

err = gompose.Up(
	gompose.ReadyOnLog("database system is ready to accept connections", 2),
	func() { _ = gompose.Down() }, // any action to be taken on system interrupt
)

Into this:

err = gompose.Up(
        gompose.UpOpts {
              WaitOnChannel: gompose.ReadyOnLog("database system is ready to accept connections", 2),
              OnInterrupt: func() { _ = gompose.Down() },
        }
)

Expose `start/stop` functionality

Another useful command of compose is stop which does not remove the containers entirely, allowing for a faster consecutive startup.

A possible flow is:

  1. Up
  2. Stop
  3. Start
  4. Down

Implement wrappers for those two in gompose.

Wait on multiple conditions

Make WithWait accept arbitrary number of channels.

E.g.:

_ := Up(
  WithWait(ReadyOnLog(...), ReadyOnLog(...), ReadyOnHttp(...))
)

Remove `testify`

Due to the fact that there are no ways of specifying test-only packages, the assertion library is pulled with gompose every time.

To deliver on the promise the library usage should be removed.

Ready on http response wait condition

Allow for a wait condition that expects a successful HTTP response from the container.

E.g.:

err := Up(
	WithWait(
		ReadyOnHttp("5432", http.StatusOk),
	),
)

An option of a callback on request sounds good too.

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.