Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conformance validation: add new helper to testutil #4532

Merged
merged 3 commits into from
Jun 12, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions testutil/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,45 @@ var LinkerdDeployReplicas = map[string]deploySpec{
"linkerd-proxy-injector": {1, []string{"proxy-injector"}},
}

// GenericTestHelperOptions defines the TestHelper options
// that are used along with `NewGenericTestHelper()` method
// to obtain a *TestHelper
// See - https://github.com/linkerd/linkerd2/issues/4530
type GenericTestHelperOptions struct {
Linkerd string
Namespace string
UpgradeFromVersion string
ClusterDomain string
ExternalIssuer bool
Uninstall bool
HelmPath string
HelmChart string
HelmStableChart string
HelmReleaseName string
}

// NewGenericTestHelper returns a new *TestHelper from the options provided.
// 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(options *GenericTestHelperOptions) *TestHelper {
return &TestHelper{
linkerd: options.Linkerd,
namespace: options.Namespace,
upgradeFromVersion: options.UpgradeFromVersion,
helm: helm{
path: options.HelmPath,
chart: options.HelmChart,
stableChart: options.HelmStableChart,
releaseName: options.HelmReleaseName,
upgradeFromVersion: options.UpgradeFromVersion,
},
clusterDomain: options.ClusterDomain,
externalIssuer: options.ExternalIssuer,
uninstall: options.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 {
Expand Down