Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
daichitakahashi committed Feb 23, 2023
1 parent 1b56a8d commit 899dd58
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compose_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ func (c *composer) Up(ctx context.Context, service string, opts compose.UpOption
requiredContainerN = opts.Scale
}
}
_, err = c.dockerCompose(ctx, args...).Output() // TODO: log output to stdout?
var stderr strings.Builder
cmd := c.dockerCompose(ctx, args...)
cmd.Stderr = &stderr
err = cmd.Run() // TODO: log output to stdout?
if err != nil {
if errors.As(err, new(*exec.ExitError)) {
return nil, errors.New(stderr.String())
}
return nil, err
}

Expand Down
38 changes: 38 additions & 0 deletions compose_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,41 @@ func TestComposeBackend_Load(t *testing.T) {
})
}
}

func TestComposer_Up(t *testing.T) {
t.Parallel()

ctx := context.Background()
be := newBackend(t)
_, _ = ctx, be

// docker composeのテストはしない
// 意図通りに指示できているかどうかをテストする

// ラベルを使用して、サービスを検索し、必要なコンテナが出来上がっているかどうかを確認する
// =>これでラベルのテストはOK

// 観点
// スケール
// 再利用
// 再利用(別プロセス)

// compose up
// compose up
// ...
// compose down

// service not found

// replicas with smaller scale

// replicas with larger scale

// requiring consistent but inconsistent scale

// up and reuse

// up and another up

// up and another up(scaling)
}

0 comments on commit 899dd58

Please sign in to comment.