acl

package
v1.6.112 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package acl provides end-to-end tests for Nomads ACL system.

In order to run this test suite only, from the e2e directory you can trigger go test -v -run '^TestACL$' ./acl

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleanup

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

Cleanup stores Nomad resources that have been created by a test which will need to be deleted once the test exits. This ensures other tests can run in a clean environment and reduces the potential for conflicts.

func NewCleanup

func NewCleanup() *Cleanup

NewCleanup generates an initialized Cleanup object for immediate use.

func (*Cleanup) Add

func (c *Cleanup) Add(id string, resourceType TestResourceType)

Add the resource identifier to the resource tracker. It will be removed by the Cleanup function once it is triggered.

func (*Cleanup) Remove

func (c *Cleanup) Remove(id string, resourceType TestResourceType)

Remove the resource identifier from the resource tracker, indicating it is no longer existing on the cluster and does not need to be cleaned.

func (*Cleanup) Run

func (c *Cleanup) Run(t *testing.T, nomadClient *api.Client)

Run triggers a Cleanup of all the stored resources. This should typically be called via defer, so it will always Run no matter if the test fails or not. Any failure will ultimately fail the test, but will not stop the attempts to delete all the resources.

type TestResourceType

type TestResourceType int

TestResourceType indicates what the resource is so the Cleanup process can use the correct API.

const (
	NamespaceTestResourceType TestResourceType = iota
	ACLPolicyTestResourceType
	ACLRoleTestResourceType
	ACLTokenTestResourceType
)

Jump to

Keyboard shortcuts

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