Help us shape the future of Go! Take the 2026 Go Developer Survey

cloudtest

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cloudtest exposes test-only helpers for the “cloud“ package. Lives in a sibling subpackage so the production-compiled “internal/cloud“ package has no “testing“ import and doesn't leak test flags (“-test.v“, “-test.run“, etc.) into the sx binary.

Only call site is test files in neighbouring packages (e.g. “internal/commands“). Tests inside “internal/cloud“ itself use the package-scoped helpers in “credential_test.go“ directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keyring

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

Keyring is an in-memory “cloud.TokenStore“ for use in tests that exercise the credential layer end-to-end. Methods mirror the “cloud.TokenStore“ interface; “Entries“ returns a snapshot of the current contents for assertions.

func InstallKeyring

func InstallKeyring(t *testing.T) *Keyring

InstallKeyring replaces the cloud package's active token store with a fresh in-memory Keyring for the duration of one test, restoring the previous store on cleanup.

func (*Keyring) Delete

func (k *Keyring) Delete(account string) error

Delete implements “cloud.TokenStore“.

func (*Keyring) Entries

func (k *Keyring) Entries() map[string]string

Entries returns a snapshot of the keyring contents. Safe to call concurrently with the production code under test.

func (*Keyring) Get

func (k *Keyring) Get(account string) (string, error)

Get implements “cloud.TokenStore“.

func (*Keyring) Set

func (k *Keyring) Set(account, token string) error

Set implements “cloud.TokenStore“.

Jump to

Keyboard shortcuts

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