framework

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package framework provides a testing framework for MarbleRun integration testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEnv

func MakeEnv(key, value string) string

MakeEnv returns a string that can be used as an environment variable.

Types

type CoordinatorConfig

type CoordinatorConfig struct {
	// contains filtered or unexported fields
}

CoordinatorConfig contains the configuration for the Coordinator.

func NewCoordinatorConfig

func NewCoordinatorConfig(extraEnv ...string) CoordinatorConfig

NewCoordinatorConfig creates a new CoordinatorConfig.

func (CoordinatorConfig) Cleanup

func (c CoordinatorConfig) Cleanup()

Cleanup removes the seal directory.

type IntegrationTest

type IntegrationTest struct {
	Ctx              context.Context
	TestManifest     manifest.Manifest
	UpdatedManifest  manifest.Manifest
	BuildDir         string
	SimulationFlag   string
	NoEnclave        bool
	MeshServerAddr   string
	ClientServerAddr string
	MarbleTestAddr   string
	// contains filtered or unexported fields
}

IntegrationTest is a testing framework for MarbleRun tests.

func New

func New(t *testing.T, buildDir, simulation string, noenclave bool,
	marbleTestAddr, meshServerAddr, clientServerAddr,
	testManifest, updatedManifest string,
) *IntegrationTest

New creates a new IntegrationTest.

func (IntegrationTest) GetMarbleCmd

func (i IntegrationTest) GetMarbleCmd(ctx context.Context, cfg MarbleConfig) *exec.Cmd

GetMarbleCmd returns the command to start a Marble.

func (IntegrationTest) GetStatus

func (i IntegrationTest) GetStatus() (string, error)

GetStatus returns the status of the Coordinator.

func (IntegrationTest) SetManifest

func (i IntegrationTest) SetManifest(manifest manifest.Manifest) ([]byte, error)

SetManifest sets the manifest of the Coordinator.

func (IntegrationTest) SetRecover

func (i IntegrationTest) SetRecover(recoveryKey []byte) error

SetRecover sets the recovery key of the Coordinator.

func (IntegrationTest) SetUpdateManifest

func (i IntegrationTest) SetUpdateManifest(manifest manifest.Manifest, certPEM []byte, key *rsa.PrivateKey) ([]byte, error)

SetUpdateManifest sets performs a manifest update for the Coordinator.

func (IntegrationTest) StartCommand

func (i IntegrationTest) StartCommand(friendlyName string, cmd *exec.Cmd) chan error

StartCommand starts the given command and returns a channel that contains the error (or nil) when the process exited.

func (IntegrationTest) StartCoordinator

func (i IntegrationTest) StartCoordinator(ctx context.Context, cfg CoordinatorConfig) func()

StartCoordinator starts the Coordinator defined by the given config. The returned func cancels the Coordinator and waits until it exited.

func (IntegrationTest) StartMarbleClient

func (i IntegrationTest) StartMarbleClient(ctx context.Context, cfg MarbleConfig) bool

StartMarbleClient starts a Client Marble.

func (IntegrationTest) StartMarbleServer

func (i IntegrationTest) StartMarbleServer(ctx context.Context, cfg MarbleConfig)

StartMarbleServer starts a Server Marble.

func (IntegrationTest) TriggerRecovery

func (i IntegrationTest) TriggerRecovery(coordinatorCfg CoordinatorConfig, cancelCoordinator func()) (func(), string)

TriggerRecovery triggers a recovery.

func (IntegrationTest) UpdateManifest

func (i IntegrationTest) UpdateManifest()

UpdateManifest updates the manifest with the uniqueID, signerID, productID and securityVersion of the testing marble.

func (IntegrationTest) VerifyCertAfterRecovery

func (i IntegrationTest) VerifyCertAfterRecovery(cert string, cancelCoordinator func(), cfg CoordinatorConfig) func()

VerifyCertAfterRecovery verifies the certificate after a recovery.

func (IntegrationTest) VerifyResetAfterRecovery

func (i IntegrationTest) VerifyResetAfterRecovery(cancelCoordinator func(), cfg CoordinatorConfig) func()

VerifyResetAfterRecovery verifies the Coordinator after a recovery as been reset by setting a new manifest.

type MarbleConfig

type MarbleConfig struct {
	// contains filtered or unexported fields
}

MarbleConfig contains the configuration for a Marble.

func NewMarbleConfig

func NewMarbleConfig(coordinatorAddr, marbleType, dnsNames string) MarbleConfig

NewMarbleConfig creates a new MarbleConfig.

func (MarbleConfig) Cleanup

func (c MarbleConfig) Cleanup()

Cleanup removes the data directory of the Marble.

Jump to

Keyboard shortcuts

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