utils

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRetryInterval applied to all tests
	DefaultRetryInterval time.Duration = time.Second * 10
	// DefaultTimeout applied to all tests
	DefaultTimeout time.Duration = time.Second * 420
	// DefaultCleanupRetryInterval applied to all tests
	DefaultCleanupRetryInterval time.Duration = time.Second * 1
	// DefaultCleanupTimeout applied to all tests
	DefaultCleanupTimeout time.Duration = time.Second * 5
)

Variables

View Source
var AstarteTestResource *operator.Astarte = &operator.Astarte{
	ObjectMeta: metav1.ObjectMeta{
		Name: "example-astarte",
	},
	Spec: commontypes.AstarteSpec{
		Version: "0.11.4",

		DeploymentStrategy: &appsv1.DeploymentStrategy{
			Type: appsv1.RecreateDeploymentStrategyType,
		},
		API: commontypes.AstarteAPISpec{
			Host: "api.autotest.astarte-platform.org",
		},
		VerneMQ: commontypes.AstarteVerneMQSpec{
			Host: "broker.autotest.astarte-platform.org",
			AstarteGenericClusteredResource: commontypes.AstarteGenericClusteredResource{
				Resources: &v1.ResourceRequirements{
					Limits: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(512, resource.Mega),
					},
					Requests: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(256, resource.Mega),
					},
				},
			},
		},
		RabbitMQ: commontypes.AstarteRabbitMQSpec{
			AstarteGenericClusteredResource: commontypes.AstarteGenericClusteredResource{
				Resources: &v1.ResourceRequirements{
					Limits: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(1000, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(512, resource.Mega),
					},
					Requests: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(200, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(256, resource.Mega),
					},
				},
			},
		},
		Cassandra: commontypes.AstarteCassandraSpec{
			MaxHeapSize: "512M",
			HeapNewSize: "256M",
			Storage: &commontypes.AstartePersistentStorageSpec{
				Size: resource.NewScaledQuantity(10, resource.Giga),
			},
			AstarteGenericClusteredResource: commontypes.AstarteGenericClusteredResource{
				Resources: &v1.ResourceRequirements{
					Limits: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(1000, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(2048, resource.Mega),
					},
					Requests: v1.ResourceList{
						v1.ResourceCPU:    *resource.NewScaledQuantity(500, resource.Milli),
						v1.ResourceMemory: *resource.NewScaledQuantity(1024, resource.Mega),
					},
				},
			},
		},
		CFSSL: commontypes.AstarteCFSSLSpec{
			Resources: &v1.ResourceRequirements{
				Limits: v1.ResourceList{
					v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
					v1.ResourceMemory: *resource.NewScaledQuantity(128, resource.Mega),
				},
				Requests: v1.ResourceList{
					v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
					v1.ResourceMemory: *resource.NewScaledQuantity(128, resource.Mega),
				},
			},
			Storage: &commontypes.AstartePersistentStorageSpec{
				Size: resource.NewScaledQuantity(2, resource.Giga),
			},
		},
		Components: commontypes.AstarteComponentsSpec{
			Resources: &v1.ResourceRequirements{
				Limits: v1.ResourceList{
					v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
					v1.ResourceMemory: *resource.NewScaledQuantity(3, resource.Giga),
				},
				Requests: v1.ResourceList{
					v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
					v1.ResourceMemory: *resource.NewScaledQuantity(2, resource.Giga),
				},
			},

			Flow: commontypes.AstarteGenericAPISpec{
				AstarteGenericClusteredResource: commontypes.AstarteGenericClusteredResource{
					Deploy: pointy.Bool(true),
					Image:  "astarte/astarte_flow:snapshot",
					Resources: &v1.ResourceRequirements{
						Limits: v1.ResourceList{
							v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
							v1.ResourceMemory: *resource.NewScaledQuantity(256, resource.Mega),
						},
						Requests: v1.ResourceList{
							v1.ResourceCPU:    *resource.NewScaledQuantity(0, resource.Milli),
							v1.ResourceMemory: *resource.NewScaledQuantity(256, resource.Mega),
						},
					},
				},
			},
		},
	},
}

AstarteTestResource is a base common ground for all tests to have a known Astarte resource

Functions

func AstarteDeleteTest added in v1.0.0

func AstarteDeleteTest(c client.Client, namespace string) error

AstarteDeleteTest deletes an Astarte instance and tests whether it was deleted and cleaned up nolint

func EnsureAstarteBecomesGreen added in v1.0.0

func EnsureAstarteBecomesGreen(name, namespace string, c client.Client) (commontypes.AstarteClusterHealth, error)

func EnsureAstarteServicesReadinessUpTo011 added in v1.0.0

func EnsureAstarteServicesReadinessUpTo011(namespace string, c client.Client, checkCFSSL bool) error

EnsureAstarteServicesReadinessUpTo011 ensures all existing Astarte components up to 0.11

func EnsureAstarteServicesReadinessUpTo10 added in v1.0.0

func EnsureAstarteServicesReadinessUpTo10(namespace string, c client.Client) error

EnsureAstarteServicesReadinessUpTo10 ensures all existing Astarte components up to 1.0

func EnsureDeploymentReadiness

func EnsureDeploymentReadiness(namespace, name string, c client.Client) error

EnsureDeploymentReadiness ensures a Deployment is ready by the time the function is called

func EnsureStatefulSetReadiness

func EnsureStatefulSetReadiness(namespace, name string, c client.Client) error

EnsureStatefulSetReadiness ensures a StatefulSet is ready by the time the function is called

func GetAstarteReconciliationPhase added in v1.0.0

func GetAstarteReconciliationPhase(name, namespace string, c client.Client) (commontypes.ReconciliationPhase, error)

func GetAstarteStatusVersion added in v1.0.0

func GetAstarteStatusVersion(name, namespace string, c client.Client) (string, error)

func PrintNamespaceEvents

func PrintNamespaceEvents(namespace string, c client.Client) error

PrintNamespaceEvents prints to fmt all namespace events

func WaitForDeploymentReadiness

func WaitForDeploymentReadiness(namespace, name string, c client.Client) error

WaitForDeploymentReadiness waits until a Deployment is ready with a reasonable timeout

func WaitForStatefulSetReadiness

func WaitForStatefulSetReadiness(namespace, name string, c client.Client) error

WaitForStatefulSetReadiness waits until a StatefulSet is ready with a reasonable timeout

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL