From 6174b194fe04466a6b164a3a5ac4462865a5de89 Mon Sep 17 00:00:00 2001 From: Mayank Shah Date: Fri, 12 Jun 2020 10:45:42 +0530 Subject: [PATCH] conformance validation: add new helper to `testutil` (#4532) Adds a new helper function to make TestHelper initialization more relaxed for linkerd2-conformance and other test use-cases. --- testutil/test_helper.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/testutil/test_helper.go b/testutil/test_helper.go index a6613415c..a6aacec44 100644 --- a/testutil/test_helper.go +++ b/testutil/test_helper.go @@ -61,6 +61,39 @@ var LinkerdDeployReplicas = map[string]deploySpec{ "linkerd-proxy-injector": {1, []string{"proxy-injector"}}, } +// NewGenericTestHelper returns a new *TestHelper from the options provided as function parameters. +// This helper was created to be able to reuse this package without hard restrictions +// as seen in `NewTestHelper()` which is primarily used with integration tests +// See - https://github.com/linkerd/linkerd2/issues/4530 +func NewGenericTestHelper( + linkerd, + namespace, + upgradeFromVersion, + clusterDomain, + helmPath, + helmChart, + helmStableChart, + helmReleaseName string, + externalIssuer, + uninstall bool, +) *TestHelper { + return &TestHelper{ + linkerd: linkerd, + namespace: namespace, + upgradeFromVersion: upgradeFromVersion, + helm: helm{ + path: helmPath, + chart: helmChart, + stableChart: helmStableChart, + releaseName: helmReleaseName, + upgradeFromVersion: upgradeFromVersion, + }, + clusterDomain: clusterDomain, + externalIssuer: externalIssuer, + uninstall: uninstall, + } +} + // NewTestHelper creates a new instance of TestHelper for the current test run. // The new TestHelper can be configured via command line flags. func NewTestHelper() *TestHelper {