Documentation
¶
Index ¶
- Constants
- Variables
- func ClusterTestCase(t *testing.T, tweaks *coreapi.HCPOpenShiftCluster) *coreapi.HCPOpenShiftCluster
- func CommonDeepCopyFuzzFuncs() []interface{}
- func CommonRoundTripFuzzFuncs() []interface{}
- func CreateTestSubscription(registeredFeatures ...string) *coreapi.Subscription
- func DeepCopyFuzzerFor(src rand.Source) *randfill.Filler
- func DoDeepCopyTest(t *testing.T, original runtime.Object, fuzzer *randfill.Filler)
- func ExternalAuthTestCase(t *testing.T, tweaks *coreapi.HCPOpenShiftClusterExternalAuth) *coreapi.HCPOpenShiftClusterExternalAuth
- func FuzzArmResourceID(resourceType string, genName func() string) *azcorearm.ResourceID
- func FuzzInternalID(genName func() string) metadataapi.InternalID
- func FuzzerFor(funcs []interface{}, src rand.Source) *randfill.Filler
- func GenName(c randfill.Continue) func() string
- func MinimumValidClusterTestCase() *coreapi.HCPOpenShiftCluster
- func MinimumValidExternalAuthTestCase() *coreapi.HCPOpenShiftClusterExternalAuth
- func NewTestLogger() *slog.Logger
- func NewTestUserAssignedIdentity(name string) *azcorearm.ResourceID
- type ExternalTestResource
- type InternalTestResource
Constants ¶
const ( TestLocation = "westus3" TestAPIVersion = "2024-06-10-preview" TestTenantID = "00000000-0000-0000-0000-000000000000" TestSubscriptionID = "11111111-1111-1111-1111-111111111111" TestAltSubscriptionID = "22222222-2222-2222-2222-222222222222" TestResourceGroupName = "testResourceGroup" TestClusterName = "testCluster" TestNodePoolName = "testNodePool" TestExternalAuthName = "testExtAuth" TestDeploymentName = "testDeployment" TestManagedResourceGroupName = "testManagedResourceGroup" TestNetworkSecurityGroupName = "testNetworkSecurityGroup" TestVirtualNetworkName = "testVirtualNetwork" TestSubnetName = "testSubnet" TestVnetIntegrationSubnetName = "testVnetIntegrationSubnet" TestKMSKeyName = "testKMSKeyName" TestKMSKeyVaultName = "testKMSKeyVaultName" TestKMSKeyVersion = "testKMSKeyVersion" TestPendingClusterServiceIDPath = "/api/aro_hcp/v1alpha1/clusters/test-cluster-service-id" TestPendingClusterServiceIDClusterIDSegment = "test-cluster-service-id" )
Variables ¶
var ( TestSubscriptionResourceID = path.Join("/subscriptions", TestSubscriptionID) TestResourceGroupResourceID = path.Join(TestSubscriptionResourceID, "resourceGroups", TestResourceGroupName) TestClusterResourceID = path.Join(TestResourceGroupResourceID, "providers", coreapi.ProviderNamespace, coreapi.ClusterResourceTypeName, TestClusterName) TestNodePoolResourceID = path.Join(TestClusterResourceID, coreapi.NodePoolResourceTypeName, TestNodePoolName) TestExternalAuthResourceID = path.Join(TestClusterResourceID, coreapi.ExternalAuthResourceTypeName, TestExternalAuthName) TestDeploymentResourceID = path.Join(TestResourceGroupResourceID, "providers", coreapi.ProviderNamespace, "deployments", TestDeploymentName) TestNetworkSecurityGroupResourceID = path.Join(TestResourceGroupResourceID, "providers", "Microsoft.Network", "networkSecurityGroups", TestNetworkSecurityGroupName) TestVirtualNetworkResourceID = path.Join(TestResourceGroupResourceID, "providers", "Microsoft.Network", "virtualNetworks", TestVirtualNetworkName) TestSubnetResourceID = path.Join(TestVirtualNetworkResourceID, "subnets", TestSubnetName) TestVnetIntegrationSubnetResourceID = path.Join(TestVirtualNetworkResourceID, "subnets", TestVnetIntegrationSubnetName) TestManagedIdentitiesDataPlaneIdentityURL = "https://dummyhost.identity.azure.net/otherinformation?aqueryarg=somevalue" )
Functions ¶
func ClusterTestCase ¶
func ClusterTestCase(t *testing.T, tweaks *coreapi.HCPOpenShiftCluster) *coreapi.HCPOpenShiftCluster
func CommonDeepCopyFuzzFuncs ¶
func CommonDeepCopyFuzzFuncs() []interface{}
CommonDeepCopyFuzzFuncs returns fuzz funcs for deep-copy tests.
func CommonRoundTripFuzzFuncs ¶
func CommonRoundTripFuzzFuncs() []interface{}
CommonRoundTripFuzzFuncs returns fuzz funcs shared by all API version round-trip conversion tests. It builds on CommonDeepCopyFuzzFuncs (which generates valid data for every field) and appends overrides that zero internal-only fields that do not survive the external API round-trip. Version-specific overrides can be appended after this slice; randfill uses the last-registered func for a type.
func CreateTestSubscription ¶
func CreateTestSubscription(registeredFeatures ...string) *coreapi.Subscription
CreateTestSubscription creates a test subscription with optional registered feature flags. Call with no arguments for a standard subscription, or pass feature names to register them.
func DeepCopyFuzzerFor ¶
DeepCopyFuzzerFor creates a randfill.Filler with NilChance=.5, NumElements=1,3 pre-loaded with CommonDeepCopyFuzzFuncs.
func DoDeepCopyTest ¶
DoDeepCopyTest verifies that DeepCopyObject produces an independent copy. It encodes the original to JSON, then re-fuzzes the copy. If the copy and original share any references, re-fuzzing the copy would mutate the original, and the JSON encoding would differ.
func ExternalAuthTestCase ¶
func ExternalAuthTestCase(t *testing.T, tweaks *coreapi.HCPOpenShiftClusterExternalAuth) *coreapi.HCPOpenShiftClusterExternalAuth
func FuzzArmResourceID ¶
func FuzzArmResourceID(resourceType string, genName func() string) *azcorearm.ResourceID
FuzzArmResourceID constructs a lexically valid *azcorearm.ResourceID for the given ARM resource type (e.g. "Microsoft.Network/virtualNetworks/subnets"). genName is called once per path segment that needs a random name (resource group plus one per resource-type level). All path components are lowercased so the result survives case-normalizing round-trips.
func FuzzInternalID ¶
func FuzzInternalID(genName func() string) metadataapi.InternalID
FuzzInternalID constructs a lexically valid InternalID for a Cluster Service cluster resource with a random name component.
func FuzzerFor ¶
FuzzerFor creates a randfill.Filler with NilChance=.5, NumElements=0,1 suitable for round-trip conversion tests.
func MinimumValidClusterTestCase ¶
func MinimumValidClusterTestCase() *coreapi.HCPOpenShiftCluster
func MinimumValidExternalAuthTestCase ¶
func MinimumValidExternalAuthTestCase() *coreapi.HCPOpenShiftClusterExternalAuth
func NewTestLogger ¶
func NewTestUserAssignedIdentity ¶
func NewTestUserAssignedIdentity(name string) *azcorearm.ResourceID
Types ¶
type ExternalTestResource ¶
type ExternalTestResource struct {
ID *string
Name *string
Type *string
SystemData *generated.SystemData
Location *string
Tags map[string]*string
Identity *generated.ManagedServiceIdentity
}
+k8s:deepcopy-gen=false
func (*ExternalTestResource) ConvertToInternal ¶
func (m *ExternalTestResource) ConvertToInternal(_ *InternalTestResource) (*InternalTestResource, error)
func (*ExternalTestResource) GetVersion ¶
func (m *ExternalTestResource) GetVersion() coreapi.Version
func (*ExternalTestResource) NewExternal ¶
func (m *ExternalTestResource) NewExternal() any
type InternalTestResource ¶
type InternalTestResource struct {
coreapi.TrackedResource
Identity *coreapi.ManagedServiceIdentity `json:"identity"`
}