Commit 7aa04b1e
7aa04b1ee882Merged
zhilyaev <[email protected]> · 5 years ago · 7 files · +1 added · ~6 modified
Description
new tests
Details
- Commit
- 7aa04b1ee882
- Parent
- ceec47ed3c54
pkg/action/build_test.gomodifiedView file
@@ -1,13 +1,21 @@
11
package action22
33
import (4+
"fmt"45
"github.com/helmwave/helmwave/pkg/plan"56
"github.com/helmwave/helmwave/tests"67
"github.com/urfave/cli/v2"8+
"os"79
"testing"810
)911
10-
func TestBuild(t *testing.T) {12+
func clean() {13+
_ = os.RemoveAll(tests.Root + plan.Plandir)14+
}15+
16+
func TestBuildRepositories(t *testing.T) {17+
defer clean()18+
1119
s := &Build{1220
plandir: tests.Root + plan.Plandir,1321
yml: tests.Root + "02_helmwave.yml",@@ -20,4 +28,58 @@
2028
t.Error(err)2129
}2230
31+
b, _ := plan.NewBody(tests.Root + plan.Plandir + plan.Planfile)32+
33+
if len(b.Repositories) != 1 && b.Repositories[0].Name != "bitnami" {34+
t.Error("'bitnami' not found")35+
fmt.Println(len(b.Repositories))36+
fmt.Println(b.Repositories[0].Name)37+
}38+
39+
}40+
41+
func TestBuildReleasesMatchGroup(t *testing.T) {42+
defer clean()43+
44+
s := &Build{45+
plandir: tests.Root + plan.Plandir,46+
yml: tests.Root + "03_helmwave.yml",47+
tags: *cli.NewStringSlice("b"),48+
matchAll: true,49+
}50+
51+
err := s.Run()52+
if err != nil {53+
t.Error(err)54+
}55+
56+
b, _ := plan.NewBody(tests.Root + plan.Plandir + plan.Planfile)57+
58+
if len(b.Releases) != 2 && b.Releases[0].Name != "redis-b" && b.Releases[1].Name != "memcached-b" {59+
t.Error("'redis-b' and 'memcached-b' not found")60+
}61+
62+
}63+
64+
func TestBuildReleasesMatchGroups(t *testing.T) {65+
defer clean()66+
67+
s := &Build{68+
plandir: tests.Root + plan.Plandir,69+
yml: tests.Root + "03_helmwave.yml",70+
tags: *cli.NewStringSlice("b", "redis"),71+
matchAll: true,72+
}73+
74+
err := s.Run()75+
if err != nil {76+
t.Error(err)77+
}78+
79+
b, _ := plan.NewBody(tests.Root + plan.Plandir + plan.Planfile)80+
81+
if len(b.Releases) != 1 && b.Releases[0].Name != "redis-b" {82+
t.Error("'redis-b' not found")83+
}84+
2385
}pkg/action/yml_test.gomodifiedView file
Loading diff…
pkg/plan/import.gomodifiedView file
Loading diff…
pkg/plan/new.gomodifiedView file
Loading diff…
tests/02_helmwave.ymlmodifiedView file
Loading diff…
tests/03_helmwave.ymladdedView file
Loading diff…
tests/const.gomodifiedView file
Loading diff…