storetest

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package storetest contains SHARED testing logic that is common to our data-store implementations.

Index

Constants

View Source
const (
	ResourceType1       = "System.Resources/resourceType1"
	ResourceType2       = "System.Resources/resourceType2"
	NestedResourceType1 = "System.Resources/resourceType1/nestedType"

	ResourcePath1       = "System.Resources/resourceType1/resource1"
	ResourcePath2       = "System.Resources/resourceType2/resource2"
	ResourcePath3       = "System.Resources/resourceType2/Resource3"
	NestedResourcePath1 = "System.Resources/resourceType1/resource1/nestedType/nested1"

	RadiusScope         = "/planes/radius/local/"
	PlaneScope          = "/planes"
	ResourceGroup1Scope = "/planes/radius/local/resourceGroups/group1"
	ResourceGroup2Scope = "/planes/radius/local/resourceGroups/group2"
	ARMResourceScope    = "/subscriptions/abc/resourceGroups/group3"
	APIVersion          = "test-api-version"
)

Variables

View Source
var ARMResourceID = parseOrPanic(ARMResourceScope + "/providers/" + ResourcePath1)
View Source
var Data1 = map[string]any{
	"value": "1",
	"properties": map[string]any{
		"resource": "1",
	},
}
View Source
var Data2 = map[string]any{
	"value": "2",
	"properties": map[string]any{
		"resource": "2",
	},
}
View Source
var NestedData1 = map[string]any{
	"value": "3",
	"properties": map[string]any{
		"resource": "3",
	},
}
View Source
var NestedResource1ID = parseOrPanic(ResourceGroup1Scope + "/providers/" + NestedResourcePath1)
View Source
var RadiusPlaneData = map[string]any{
	"value:": "1",
	"properties": map[string]any{
		"plane": "1",
	},
}
View Source
var RadiusPlaneID = parseOrPanic(RadiusScope)
View Source
var Resource1ID = parseOrPanic(ResourceGroup1Scope + "/providers/" + ResourcePath1)
View Source
var Resource2ID = parseOrPanic(ResourceGroup2Scope + "/providers/" + ResourcePath2)
View Source
var Resource3ID = parseOrPanic(ResourceGroup2Scope + "/providers/" + ResourcePath3)
View Source
var ResourceGroup1Data = map[string]any{
	"value": "1",
	"properties": map[string]any{
		"group": "1",
	},
}
View Source
var ResourceGroup1ID = parseOrPanic(ResourceGroup1Scope)
View Source
var ResourceGroup2Data = map[string]any{
	"value": "2",
	"properties": map[string]any{
		"group": "2",
	},
}
View Source
var ResourceGroup2ID = parseOrPanic(ResourceGroup2Scope)

Functions

func CompareObjectLists

func CompareObjectLists(t *testing.T, expected []store.Object, actual []store.Object)

CompareObjectLists compares two slices of store.Objects, ignoring their ETags.

func MarshalOrPanic

func MarshalOrPanic(in any) []byte

MarshalOrPanic takes in any type and returns a byte slice, panicking if an error occurs while marshalling.

func RunTest

func RunTest(t *testing.T, client store.StorageClient, clear func(t *testing.T))

This function tests the StorageClient's Get, Save and Delete methods by creating, updating and deleting objects with different IDs and scopes, and checks the results of various query scenarios with different filters and scopes. It also checks that the expected objects are returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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