New ๐ŸŒŠ wave for @helm

Commit 79f0a54d

79f0a54d3c1fMerged

Sviatoslav Dumchenko <[email protected]> ยท 3 years ago ยท 2 files ยท +1 added ยท ~1 modified

Description

chore(tests): add some charts cache tests

Details

Commit
79f0a54d3c1f
Parent
a5f116cd28ae

pkg/cache/charts_test.goaddedView file

1+package cache_test
2+
3+import (
4+ "testing"
5+
6+ "github.com/helmwave/helmwave/pkg/cache"
7+ "github.com/stretchr/testify/suite"
8+)
9+
10+type ChartsTestSuite struct {
11+ suite.Suite
12+}
13+
14+func TestChartsTestSuite(t *testing.T) {
15+ t.Parallel()
16+ suite.Run(t, new(ChartsTestSuite))
17+}
18+
19+func (ts *ChartsTestSuite) TestEnabled() {
20+ cfg := cache.Config{}
21+
22+ ts.Require().False(cfg.IsEnabled())
23+
24+ _, err := cfg.FindInCache("", "")
25+ ts.Require().ErrorIs(err, cache.ErrCacheDisabled)
26+
27+ err = cfg.Init(ts.T().TempDir())
28+
29+ ts.Require().NoError(err)
30+ ts.Require().True(cfg.IsEnabled())
31+}
32+
33+func (ts *ChartsTestSuite) TestFindNonexisting() {
34+ cfg := cache.Config{}
35+ err := cfg.Init(ts.T().TempDir())
36+
37+ ts.Require().NoError(err)
38+
39+ _, err = cfg.FindInCache("bla", "bla")
40+
41+ ts.Require().ErrorIs(err, cache.ErrChartNotFound)
42+}