Commit d64cde6c authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason
Browse files

ci: fix template tests not running after split

We recently split up the template tests, but they were not actually
running in CI due to to the script using `go test .` instead of the
recursive `go test ./...`. This also fixes some other path-related
problems, namely the relative paths for the fixtures, and that
`test_helpers.go` must be in the same directory as the tests to count as
the same package.
parent 1d26a11c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ chart:test:
    - go version
    - helm repo add stable https://charts.helm.sh/stable
    - helm dependency build .
    - cd test && GO111MODULE=auto go test .
    - cd test && GO111MODULE=auto go test ./...

# auto-deploy-image doesn't need to release the chart to https://charts.gitlab.io/,
# as it bundles a chart by default.
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ SecRule REQUEST_HEADERS:Content-Type \"text/plain\" \"log,deny,id:\'20010\',stat
		},
		{
			name:       "with custom secRules",
			valueFiles: []string{"./testdata/modsecurity-ingress.yaml"},
			valueFiles: []string{"../testdata/modsecurity-ingress.yaml"},
			meta:       metav1.ObjectMeta{Annotations: secRulesAnnotations},
		},
	}
+2 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ func TestNetworkPolicy(t *testing.T) {
		},
		{
			name:        "with custom policy",
			valueFiles:  []string{"./testdata/custom-policy.yaml"},
			valueFiles:  []string{"../testdata/custom-policy.yaml"},
			meta:        metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels},
			podSelector: metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
			ingress: []netV1.NetworkPolicyIngressRule{
@@ -75,7 +75,7 @@ func TestNetworkPolicy(t *testing.T) {
		},
		{
			name:        "with full spec policy",
			valueFiles:  []string{"./testdata/full-spec-policy.yaml"},
			valueFiles:  []string{"../testdata/full-spec-policy.yaml"},
			meta:        metav1.ObjectMeta{Name: releaseName + "-auto-deploy", Labels: expectedLabels},
			podSelector: metav1.LabelSelector{MatchLabels: map[string]string{}},
			policyTypes: []netV1.PolicyType{"Ingress", "Egress"},
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ import (
)

const (
	chartName     = "auto-deploy-app-2.3.0"
	helmChartPath = ".."
	chartName     = "auto-deploy-app-2.4.0"
	helmChartPath = "../.."
)

func renderTemplate(t *testing.T, values map[string]string, releaseName string, templates []string, expectedErrorRegexp *regexp.Regexp) (string, bool) {