Skip to content

Commit

Permalink
Add helmtest for dp-terraform testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kovayur committed May 15, 2024
1 parent 9afd56f commit 74eb71b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 19 deletions.
30 changes: 30 additions & 0 deletions dp-terraform/test/helmtest_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package test

import (
"testing"

. "github.com/onsi/gomega"
"github.com/stackrox/acs-fleet-manager/pkg/shared"
helmTest "github.com/stackrox/helmtest/pkg/framework"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
)

func TestWithHelmtest(t *testing.T) {
chartDir := shared.BuildFullFilePath("./dp-terraform/helm/rhacs-terraform")
suite, err := helmTest.NewLoader(chartDir).LoadSuite()
Expect(err).ToNot(HaveOccurred(), "failed to load helmtest suite")

ch, err := loader.LoadDir(chartDir)
Expect(err).ToNot(HaveOccurred(), "failed to load chart")
target := &helmTest.Target{
Chart: ch,
ReleaseOptions: chartutil.ReleaseOptions{
Name: "rhacs-terraform",
Namespace: "rhacs",
IsInstall: true,
},
}

suite.Run(t, target)
}
14 changes: 13 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ require (
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.com/spyzhov/ajson v0.9.0
github.com/stackrox/helmtest v0.0.1
github.com/stackrox/rox v0.0.0-20230323083409-e83503a98fb4
github.com/stretchr/testify v1.8.4
github.com/xeipuuv/gojsonschema v1.2.0
Expand Down Expand Up @@ -87,8 +88,10 @@ require (
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand All @@ -101,6 +104,7 @@ require (
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/schema v1.2.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
Expand All @@ -110,6 +114,8 @@ require (
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.14 // indirect
github.com/itchyny/timefmt-go v0.1.5 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.5.4 // indirect
Expand All @@ -128,6 +134,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/openshift/client-go v0.0.0-20230926161409-848405da69e1 // indirect
Expand All @@ -141,15 +148,16 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/stackrox/helmtest v0.0.1 // indirect
github.com/stackrox/scanner v0.0.0-20240110222630-351caa1e0024 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/tkuchiki/go-timezone v0.2.2 // indirect
github.com/weppos/publicsuffix-go v0.30.1-0.20230620154423-38c92ad2d5c6 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/zmap/zcrypto v0.0.0-20230310154051-c8b263fd8300 // indirect
github.com/zmap/zlint/v3 v3.5.0 // indirect
go.starlark.net v0.0.0-20230612165344-9532f5667272 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
Expand All @@ -168,10 +176,14 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.29.1 // indirect
k8s.io/cli-runtime v0.29.1 // indirect
k8s.io/component-base v0.29.1 // indirect
k8s.io/klog/v2 v2.120.0 // indirect
k8s.io/kube-openapi v0.0.0-20240105020646-a37d4de58910 // indirect
k8s.io/kubectl v0.29.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)

Expand Down
Loading

0 comments on commit 74eb71b

Please sign in to comment.