Documentation
¶
Overview ¶
Package clustertestutils provides common test utilities for cluster provisioner testing, including shared test cases and helper functions for standardizing test patterns.
Index ¶
- Variables
- func DefaultDeleteCases() []testutils.NameCase
- func DefaultNameCases(cfgName string) []testutils.NameCase
- func RunActionSuccess[MockT, ProvisionerT any](t *testing.T, label string, inputName, expectedName string, ...)
- func RunCreateSuccessTest[MockT, ProvisionerT any](t *testing.T, setupFn func(*testing.T) (ProvisionerT, MockT), ...)
- func RunCreateTest(t *testing.T, ...)
- func RunStandardSuccessTest(t *testing.T, cases []testutils.NameCase, ...)
Constants ¶
This section is empty.
Variables ¶
var ( ErrCreateClusterFailed = errors.New("create cluster failed") ErrDeleteClusterFailed = errors.New("delete cluster failed") ErrListClustersFailed = errors.New("list clusters failed") ErrStartClusterFailed = errors.New("start cluster failed") ErrStopClusterFailed = errors.New("stop cluster failed") ErrScaleNodeGroupFailed = errors.New("scale node group failed") )
Common error variables used across cluster provisioner tests to avoid duplication.
Functions ¶
func DefaultDeleteCases ¶
DefaultDeleteCases returns standard test cases for testing delete operations with name handling.
func DefaultNameCases ¶
DefaultNameCases returns standard test cases for testing operations with name handling.
func RunActionSuccess ¶
func RunActionSuccess[MockT, ProvisionerT any]( t *testing.T, label string, inputName, expectedName string, setupFn func(*testing.T) (ProvisionerT, MockT), expectFn func(MockT, string), actionFn func(ProvisionerT, string) error, )
RunActionSuccess provides a generic helper for testing successful provisioner actions. It eliminates code duplication between EKS and Kind test files by abstracting the common pattern: setup -> expect -> action -> assert.
func RunCreateSuccessTest ¶
func RunCreateSuccessTest[MockT, ProvisionerT any]( t *testing.T, setupFn func(*testing.T) (ProvisionerT, MockT), expectFn func(MockT, string), actionFn func(ProvisionerT, string) error, )
RunCreateSuccessTest provides a standard test pattern for Create operations. This eliminates duplication between EKS and Kind test files by providing the common TestCreate_Success structure that both can use. Note: The caller should call t.Parallel() for parallel execution.
func RunCreateTest ¶
func RunCreateTest( t *testing.T, runActionSuccessFunc func(t *testing.T, inputName, expectedName string), )
RunCreateTest runs a standard Create success test pattern with the common cfg-name cases. This centralizes the Create test pattern of: - Getting DefaultNameCases("cfg-name") - Running RunStandardSuccessTest with "Create()" action.
func RunStandardSuccessTest ¶
func RunStandardSuccessTest( t *testing.T, cases []testutils.NameCase, testRunner func(t *testing.T, inputName, expectedName string), )
RunStandardSuccessTest runs a standard success test pattern with parallel execution and name cases. This centralizes the common pattern of: - Getting test cases - Running testutils.RunNameCases with t.Helper(). Note: Caller should call t.Parallel() for parallel execution.
Types ¶
This section is empty.