compose

package module
v0.0.0-...-c04e39c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2017 License: Apache-2.0 Imports: 14 Imported by: 1

README

Libkermit

GoDoc Build Status Go Report Card License codecov

When libermit meet with libcompose.

Note: This is experimental and not even implemented yet. You are on your own right now

Package compose

This package holds functions and structs to ease docker uses.

package yours

import (
    "testing"

    "github.com/libkermit/docker/compose"
)

func TestItMyFriend(t *testing.T) {
    project, err := compose.CreateProject("simple", "./assets/simple.yml")
    if err != nil {
        t.Fatal(err)
    }
    err = project.Start()
	if err != nil {
		t.Fatal(err)
	}

    // Do your stuff

    err = project.Stop()
	if err != nil {
		t.Fatal(err)
	}
}
Package compose/testing

This package map the compose package but takes a *testing.T struct on all methods. The idea is to write even less. Let's write the same example as above.

package yours

import (
    "testing"

    docker "github.com/libkermit/docker/compose/testing"
)

func TestItMyFriend(t *testing.T) {
    project := compose.CreateProject(t, "simple", "./assets/simple.yml")
    project.Start(t)

    // Do your stuff

    project.Stop(t)
}

Other packages to come

  • suite : functions and structs to setup tests suites.

Documentation

Overview

Package compose aims to provide simple "helper" methods to ease the use of compose (through libcompose) in (integration) tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Project

type Project struct {
	// contains filtered or unexported fields
}

Project holds compose related project attributes

func CreateProject

func CreateProject(name string, composeFiles ...string) (*Project, error)

CreateProject creates a compose project with the given name based on the specified compose files

func (*Project) Container

func (p *Project) Container(service string) (types.ContainerJSON, error)

Container returns the one and only container for a given services. It returns an error if the service has more than one container (in case of scale)

func (*Project) Containers

func (p *Project) Containers(service string) ([]types.ContainerJSON, error)

Containers lists containers for a given services.

func (*Project) Scale

func (p *Project) Scale(service string, count int) error

Scale scale a service up

func (*Project) Start

func (p *Project) Start(services ...string) error

Start creates and starts the compose project.

func (*Project) StartOnly

func (p *Project) StartOnly(services ...string) error

StartOnly only starts created services which are stopped.

func (*Project) Stop

func (p *Project) Stop(services ...string) error

Stop shuts down and clean the project

func (*Project) StopOnly

func (p *Project) StopOnly(services ...string) error

StopOnly only stop services without delete them.

Directories

Path Synopsis
Package check aims to provide simple "helper" methods to ease the use of compose (through libcompose) in (integration) tests using the go-check package.
Package check aims to provide simple "helper" methods to ease the use of compose (through libcompose) in (integration) tests using the go-check package.
Package testing aims to provide simple "helper" methods to ease the use of compose (through libcompose) in (integration) tests using built-in testing.
Package testing aims to provide simple "helper" methods to ease the use of compose (through libcompose) in (integration) tests using built-in testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL