Skip to content

Commit fa0b43b

Browse files
committed
Add Deployment unit test
1 parent 63b6dc1 commit fa0b43b

18 files changed

+1121
-280
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ test-internal: fmt vet copywrite ## Run internal/* tests.
150150

151151
.PHONY: test-helm
152152
test-helm: ## Run Helm chart tests.
153-
go test -timeout 5m -count=1 -v ./charts/unit/...
153+
cd charts/test; go test -timeout 5m -count=1 -v ./...
154154

155155
.PHONY: lint
156156
lint: golangci-lint ## Run golangci-lint linter & yamllint

charts/hcp-terraform-operator/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
{{- include "hcp-terraform-operator.selectorLabels" . | nindent 8 }}
2222
control-plane: {{ .Release.Name }}-controller-manager
2323
{{- with .Values.podLabels }}
24-
{{- tpl (toYaml .) $ | nindent 8 }}
24+
{{- toYaml . | nindent 8 }}
2525
{{- end }}
2626
spec:
2727
{{- with .Values.priorityClassName }}

charts/hcp-terraform-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ operator:
5656
# - key: kubernetes.io/arch
5757
# operator: In
5858
# values:
59-
# - amd64
59+
# - amd64
6060
#
6161
# -- Kubernetes Affinity. More information: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
6262
affinity: {}

charts/test/go.mod

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
module github.com/hashicorp/hcp-terraform-operator/charts/test
2+
3+
go 1.23.3
4+
5+
require (
6+
github.com/gruntwork-io/terratest v0.47.2
7+
github.com/stretchr/testify v1.8.4
8+
k8s.io/api v0.30.3
9+
k8s.io/apimachinery v0.30.3
10+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
11+
)
12+
13+
require (
14+
github.com/BurntSushi/toml v1.3.2 // indirect
15+
github.com/aws/aws-sdk-go v1.44.122 // indirect
16+
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
17+
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
18+
github.com/davecgh/go-spew v1.1.1 // indirect
19+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
20+
github.com/ghodss/yaml v1.0.0 // indirect
21+
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
22+
github.com/go-logr/logr v1.4.2 // indirect
23+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
24+
github.com/go-openapi/jsonreference v0.20.2 // indirect
25+
github.com/go-openapi/swag v0.22.3 // indirect
26+
github.com/go-sql-driver/mysql v1.4.1 // indirect
27+
github.com/gogo/protobuf v1.3.2 // indirect
28+
github.com/golang/protobuf v1.5.4 // indirect
29+
github.com/gonvenience/bunt v1.3.5 // indirect
30+
github.com/gonvenience/neat v1.3.12 // indirect
31+
github.com/gonvenience/term v1.0.2 // indirect
32+
github.com/gonvenience/text v1.0.7 // indirect
33+
github.com/gonvenience/wrap v1.1.2 // indirect
34+
github.com/gonvenience/ytbx v1.4.4 // indirect
35+
github.com/google/gnostic-models v0.6.8 // indirect
36+
github.com/google/gofuzz v1.2.0 // indirect
37+
github.com/google/uuid v1.3.0 // indirect
38+
github.com/gorilla/websocket v1.5.0 // indirect
39+
github.com/gruntwork-io/go-commons v0.8.0 // indirect
40+
github.com/hashicorp/errwrap v1.0.0 // indirect
41+
github.com/hashicorp/go-multierror v1.1.0 // indirect
42+
github.com/homeport/dyff v1.6.0 // indirect
43+
github.com/imdario/mergo v0.3.12 // indirect
44+
github.com/jmespath/go-jmespath v0.4.0 // indirect
45+
github.com/josharian/intern v1.0.0 // indirect
46+
github.com/json-iterator/go v1.1.12 // indirect
47+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
48+
github.com/mailru/easyjson v0.7.7 // indirect
49+
github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect
50+
github.com/mattn/go-isatty v0.0.19 // indirect
51+
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
52+
github.com/mitchellh/go-homedir v1.1.0 // indirect
53+
github.com/mitchellh/go-ps v1.0.0 // indirect
54+
github.com/mitchellh/hashstructure v1.1.0 // indirect
55+
github.com/moby/spdystream v0.2.0 // indirect
56+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
57+
github.com/modern-go/reflect2 v1.0.2 // indirect
58+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
59+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
60+
github.com/pmezard/go-difflib v1.0.0 // indirect
61+
github.com/pquerna/otp v1.2.0 // indirect
62+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
63+
github.com/sergi/go-diff v1.3.1 // indirect
64+
github.com/spf13/pflag v1.0.5 // indirect
65+
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
66+
github.com/urfave/cli v1.22.2 // indirect
67+
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
68+
golang.org/x/crypto v0.28.0 // indirect
69+
golang.org/x/net v0.30.0 // indirect
70+
golang.org/x/oauth2 v0.12.0 // indirect
71+
golang.org/x/sync v0.8.0 // indirect
72+
golang.org/x/sys v0.26.0 // indirect
73+
golang.org/x/term v0.25.0 // indirect
74+
golang.org/x/text v0.19.0 // indirect
75+
golang.org/x/time v0.6.0 // indirect
76+
google.golang.org/appengine v1.6.7 // indirect
77+
google.golang.org/protobuf v1.35.1 // indirect
78+
gopkg.in/inf.v0 v0.9.1 // indirect
79+
gopkg.in/yaml.v2 v2.4.0 // indirect
80+
gopkg.in/yaml.v3 v3.0.1 // indirect
81+
k8s.io/client-go v0.30.3 // indirect
82+
k8s.io/klog/v2 v2.120.1 // indirect
83+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
84+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
85+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
86+
sigs.k8s.io/yaml v1.4.0 // indirect
87+
)

0 commit comments

Comments
 (0)