From 82b2e721f220f0d818b4b1381d75721b189f695c Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sat, 16 Sep 2017 15:46:47 -0300 Subject: [PATCH] coverage --- context/context_test.go | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/context/context_test.go b/context/context_test.go index de669c1cb..faa86ea58 100644 --- a/context/context_test.go +++ b/context/context_test.go @@ -8,19 +8,24 @@ import ( "golang.org/x/sync/errgroup" ) -func TestMultipleArtifactAdds(t *testing.T) { +func TestMultipleAdds(t *testing.T) { var assert = assert.New(t) - var list = []string{ + var artifacts = []string{ "dist/a", "dist/b", "dist/c", "dist/d", } + var dockerfiles = []string{ + "a/b:1.0.0", + "c/d:2.0.0", + "e/f:3.0.0", + } var ctx = New(config.Project{ Dist: "dist", }) var g errgroup.Group - for _, f := range list { + for _, f := range artifacts { f := f g.Go(func() error { ctx.AddArtifact(f) @@ -28,8 +33,18 @@ func TestMultipleArtifactAdds(t *testing.T) { }) } assert.NoError(g.Wait()) - assert.Len(ctx.Artifacts, len(list)) + for _, d := range dockerfiles { + d := d + g.Go(func() error { + ctx.AddDocker(d) + return nil + }) + } + assert.NoError(g.Wait()) + assert.Len(ctx.Artifacts, len(artifacts)) assert.Contains(ctx.Artifacts, "a", "b", "c", "d") + assert.Len(ctx.Dockers, len(dockerfiles)) + assert.Contains(ctx.Dockers, "a/b:1.0.0", "c/d:2.0.0", "e/f:3.0.0") } func TestMultipleBinaryAdds(t *testing.T) {