Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallFilteredHelmChart ¶
func InstallFilteredHelmChart(t require.TestingT, ctx context.Context, c client.Client, namespace, release, chart string, filters ...k8stestutils.Filter)
Example ¶
package main
import (
"context"
"fmt"
"os"
helm "github.com/adevinta/go-helm-toolkit"
helmtestutils "github.com/adevinta/go-helm-toolkit/testutils"
k8stestutils "github.com/adevinta/go-k8s-toolkit/testutils"
testutils "github.com/adevinta/go-testutils-toolkit"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
)
func main() {
// use the real *testing.T from the test
t := &testutils.FakeTest{Name: "TestICanInstallHelmChart"}
h, err := helm.Default()
if err != nil {
return
}
fd, err := os.CreateTemp("", "")
if err != nil {
return
}
defer fd.Close()
stdout := os.Stdout
os.Stdout = fd
h.RepoAdd("examples", "https://helm.github.io/examples")
os.Stdout = stdout
client := fake.NewClientBuilder().Build()
name := "not-found"
helmtestutils.InstallFilteredHelmChart(t, context.Background(), client, "test-namespace", "release-name", "examples/hello-world", k8stestutils.ExtractObjectName(k8stestutils.WithKind("Deployment"), &name))
fmt.Println("name:", name)
// Usually, this is done by the go framework
fmt.Println(t)
}
Output: name: release-name-hello-world --- PASS: TestICanInstallHelmChart
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.