testutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package testutil contains helper functions for component unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFromMap

func ConfigFromMap(t *testing.T, m map[string]string, key k8sutil.ObjectMetadata) string

ConfigFromMap takes a map and a key. The function returns the YAML object associated with the key. If the key does not exist in that map, the function fails.

func JSONPathExists added in v0.7.0

func JSONPathExists(t *testing.T, yamlConfig string, jsonPath string, errExp string)

JSONPathExists checks if the given YAML config has an object at the given JSON path, also provide what error to expect.

func MatchJSONPathInt64Value added in v0.6.1

func MatchJSONPathInt64Value(t *testing.T, yamlConfig string, jsonPath string, expected int64)

MatchJSONPathInt64Value is a helper function for component unit tests. It compares the integer at a JSON path in a YAML config to the expected integer.

func MatchJSONPathJSONValue added in v0.9.0

func MatchJSONPathJSONValue(t *testing.T, yamlConfig string, jsonPath string, expected string)

MatchJSONPathJSONValue is a helper function for component unit tests. It compares the JSON values at a JSON path in a YAML config to the expected JSON string given by the user. e.g.

spec:

resources:
  osd: {"requests":{"cpu":"5","memory":"5Gi"},"limits":{"cpu":"5","memory":"5Gi"}}

func MatchJSONPathStringValue

func MatchJSONPathStringValue(t *testing.T, yamlConfig string, jsonPath string, expected string)

MatchJSONPathStringValue is a helper function for component unit tests. It compares the string at a JSON path in a YAML config to the expected string.

func RenderManifests

func RenderManifests(
	t *testing.T, component components.Component, componentName string, hclConfig string,
) map[string]string

RenderManifests converts a component into YAML manifests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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