Commit 788e0814
788e081406b6Merged
Sviatoslav Dumchenko <[email protected]> · 3 years ago · 8 files · +5 added · ~3 modified
Description
Merge pull request #639 from helmwave/hooks-interface
Add tests for lifecycle hooks
Details
- Commit
- 788e081406b6
- Parent
- d9885ad809b9
- Merge parent
- 0c5ea4b540b8
pkg/helper/context_test.goaddedView file
1+
package helper_test2+
3+
import (4+
"context"5+
"testing"6+
7+
"github.com/helmwave/helmwave/pkg/helper"8+
"github.com/helmwave/helmwave/pkg/release/uniqname"9+
"github.com/stretchr/testify/suite"10+
)11+
12+
type ContextTestSuite struct {13+
suite.Suite14+
}15+
16+
func TestContextTestSuite(t *testing.T) {17+
t.Parallel()18+
suite.Run(t, new(ContextTestSuite))19+
}20+
21+
func (s *ContextTestSuite) TestReleaseUniq() {22+
ctxBase := context.Background()23+
uniqBase := uniqname.UniqName("test")24+
25+
ctx := helper.ContextWithReleaseUniq(ctxBase, uniqBase)26+
27+
uniq, exists := helper.ContextGetReleaseUniq(ctx)28+
s.Require().True(exists)29+
s.Require().Equal(uniqBase, uniq)30+
}31+
32+
func (s *ContextTestSuite) TestNoReleaseUniq() {33+
ctx := context.Background()34+
35+
_, exists := helper.ContextGetReleaseUniq(ctx)36+
s.Require().False(exists)37+
}38+
39+
func (s *ContextTestSuite) TestLifecycleType() {40+
ctxBase := context.Background()41+
typBase := "test"42+
43+
ctx := helper.ContextWithLifecycleType(ctxBase, typBase)44+
45+
typ, exists := helper.ContextGetLifecycleType(ctx)46+
s.Require().True(exists)47+
s.Require().Equal(typBase, typ)48+
}49+
50+
func (s *ContextTestSuite) TestNoLifecycleType() {51+
ctx := context.Background()52+
53+
_, exists := helper.ContextGetLifecycleType(ctx)54+
s.Require().False(exists)55+
}pkg/hooks/config.gomodifiedView file
Loading diff…
pkg/hooks/config_export_test.goaddedView file
Loading diff…
pkg/hooks/interface.goaddedView file
Loading diff…
pkg/hooks/run.gomodifiedView file
Loading diff…
pkg/hooks/run_test.goaddedView file
Loading diff…
pkg/hooks/yaml.gomodifiedView file
Loading diff…
pkg/hooks/yaml_test.goaddedView file
Loading diff…