github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/integration/api_test.go (about)

     1  package integration
     2  
     3  import (
     4  	. "gopkg.in/check.v1"
     5  
     6  	"golang.org/x/net/context"
     7  
     8  	"github.com/docker/libcompose/docker"
     9  	"github.com/docker/libcompose/docker/ctx"
    10  	"github.com/docker/libcompose/project"
    11  	"github.com/docker/libcompose/project/options"
    12  )
    13  
    14  func init() {
    15  	Suite(&APISuite{})
    16  }
    17  
    18  type APISuite struct{}
    19  
    20  func (s *APISuite) TestVolumeWithoutComposeFile(c *C) {
    21  	service := `
    22  service:
    23    image: busybox
    24    command: echo Hello world!
    25    volumes:
    26      - /etc/selinux:/etc/selinux`
    27  
    28  	project, err := docker.NewProject(&ctx.Context{
    29  		Context: project.Context{
    30  			ComposeBytes: [][]byte{[]byte(service)},
    31  			ProjectName:  "test-volume-without-compose-file",
    32  		},
    33  	}, nil)
    34  
    35  	c.Assert(err, IsNil)
    36  
    37  	err = project.Up(context.Background(), options.Up{})
    38  	c.Assert(err, IsNil)
    39  }