integration

package
v2.868.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SERVICE_MANAGER_SYSTEMD = "systemd"

Variables

View Source
var DefaultAgentConfig = app.Config{
	Platform: boshplatform.Options{
		Linux: boshplatform.LinuxOptions{
			UseDefaultTmpDir:              true,
			UsePreformattedPersistentDisk: true,
			BindMountPersistentDisk:       false,
			DevicePathResolutionType:      "virtio",
		},
	},
	Infrastructure: boshinf.Options{
		Settings: boshinf.SettingsOptions{
			Sources: boshinf.SourceOptionsSlice{
				boshinf.FileSourceOptions{
					SettingsPath: "/var/vcap/settings.json",
				},
			},
		},
	},
}

ServiceManager is intentionally left zero here; CreateAgentConfigFile stamps it per target (sv vs systemd) so this value stays service-manager-agnostic.

Functions

This section is empty.

Types

type TestEnvironment

type TestEnvironment struct {
	AgentClient   *integrationagentclient.IntegrationAgentClient
	AgentSettings boshsettings.Settings
	// contains filtered or unexported fields
}

func NewTestEnvironment

func NewTestEnvironment(cmdRunner boshsys.CmdRunner, wp writerPrinter) (*TestEnvironment, error)

func (*TestEnvironment) AssetsDir

func (t *TestEnvironment) AssetsDir() string

func (*TestEnvironment) AttachDevice

func (t *TestEnvironment) AttachDevice(devicePath string, partitionSize, numPartitions int) error

func (*TestEnvironment) AttachPartitionedRootDevice

func (t *TestEnvironment) AttachPartitionedRootDevice(devicePath string, sizeInMB, rootPartitionSizeInMB int) (string, error)

func (*TestEnvironment) BlobstoreDir

func (t *TestEnvironment) BlobstoreDir() string

func (*TestEnvironment) CleanupDataDir

func (t *TestEnvironment) CleanupDataDir() error

CleanupDataDir returns the VM's ephemeral state to baseline in a single SSH round-trip: stop monit (waiting until every process is unmonitored), unmount /tmp, tear down each ephemeral mount with the shared detach_mount helper, then recreate the emptied directories with their expected ownership and modes, and sweep transient top-level uploads out of the blobstore assets dir. See scripts/cleanup_data_dir.sh (and scripts/detach_mount.sh) for the full logic and rationale.

func (*TestEnvironment) CleanupLogFile

func (t *TestEnvironment) CleanupLogFile() error

CleanupLogFile truncates the agent log and, on systemd, rotates/vacuums the journal. See scripts/cleanup_log_file.sh.

func (*TestEnvironment) CleanupSSH

func (t *TestEnvironment) CleanupSSH() error

func (*TestEnvironment) CopyFileToPath

func (t *TestEnvironment) CopyFileToPath(localPath string, remotePath string) error

CopyFileToPath streams the local file to its destination over the persistent SSH tunnel by piping the bytes into `sudo tee` via the session's stdin, reusing the connection instead of a fresh scp. Streaming via stdin (not argv) keeps it binary-safe and free of ARG_MAX and shell-quoting limits, so it works for arbitrarily large blobs too.

func (*TestEnvironment) CreateAgentConfigFile added in v2.868.0

func (t *TestEnvironment) CreateAgentConfigFile(config app.Config) error

CreateAgentConfigFile marshals an in-code app.Config to /var/vcap/bosh/agent.json on the VM. It stamps ServiceManager from the target detected by DetectServiceManager (which must have run first), so the same DefaultAgentConfig value works on sv, resolute, and noble without per-target fixtures. CopyFileToPath streams via `sudo tee`, which truncates the destination, so no prior `rm -f` is needed.

func (*TestEnvironment) CreateBlobFromAsset

func (t *TestEnvironment) CreateBlobFromAsset(assetPath, blobID string) error

func (*TestEnvironment) CreateBlobFromAssetInActualBlobstore

func (t *TestEnvironment) CreateBlobFromAssetInActualBlobstore(assetPath, blobstorePath, blobID string) error

func (*TestEnvironment) CreateSensitiveBlobFromAsset

func (t *TestEnvironment) CreateSensitiveBlobFromAsset(assetPath, blobID string) error

func (*TestEnvironment) CreateSettingsFile

func (t *TestEnvironment) CreateSettingsFile(settings boshsettings.Settings) error

func (*TestEnvironment) DetachDevice

func (t *TestEnvironment) DetachDevice(dir string) error

func (*TestEnvironment) DetachLoopDevice

func (t *TestEnvironment) DetachLoopDevice(devicePath string) error

func (*TestEnvironment) DetachLoopDevices

func (t *TestEnvironment) DetachLoopDevices() error

func (*TestEnvironment) DetachPartitionedRootDevice

func (t *TestEnvironment) DetachPartitionedRootDevice(rootLink string, devicePath string) (err error)

func (*TestEnvironment) DetectServiceManager added in v2.867.0

func (t *TestEnvironment) DetectServiceManager() error

func (*TestEnvironment) DumpDiagnostics added in v2.867.0

func (t *TestEnvironment) DumpDiagnostics()

func (*TestEnvironment) EnsureRootDeviceIsLargeEnough

func (t *TestEnvironment) EnsureRootDeviceIsLargeEnough() error

func (*TestEnvironment) GetFileContents

func (t *TestEnvironment) GetFileContents(filePath string) (string, error)

func (*TestEnvironment) GetServiceManager added in v2.867.0

func (t *TestEnvironment) GetServiceManager() string

func (*TestEnvironment) GetVMNetworks

func (t *TestEnvironment) GetVMNetworks() (boshsettings.Networks, error)

func (*TestEnvironment) JournalContains added in v2.867.0

func (t *TestEnvironment) JournalContains(content string) bool

func (*TestEnvironment) LogFileContains

func (t *TestEnvironment) LogFileContains(content string) bool

func (*TestEnvironment) RemoveDevice

func (t *TestEnvironment) RemoveDevice(devicePath string) error

func (*TestEnvironment) ResetDeviceMap

func (t *TestEnvironment) ResetDeviceMap() error

ResetDeviceMap detaches every leftover loop device and removes its backing file in a single SSH round-trip, preserving noble's loop-device semantics (settle + retry before detach; delete a backing file only once its loop is gone). See scripts/reset_device_map.sh for the full rationale.

func (*TestEnvironment) RestartAgent

func (t *TestEnvironment) RestartAgent() error

func (*TestEnvironment) RestoreCleanBaseline added in v2.868.0

func (t *TestEnvironment) RestoreCleanBaseline() error

RestoreCleanBaseline returns the VM to the baseline every spec expects: agent stopped, default agent.json, empty data dir, truncated logs, and no ephemeral loop devices. It is the single definition of "clean" shared by SynchronizedBeforeSuite (the first spec) and the suite AfterEach (every subsequent spec), so the two paths can't drift apart.

The default agent.json is only rewritten when a spec changed it (tracked by configDirty). Only 3 of 49 specs override it, so the other 46 skip the rm+scp+mv restore; the env starts dirty so the first call (from SynchronizedBeforeSuite) writes the default once.

StopAgent runs first on purpose: otherwise CleanupDataDir's `fuser -km /var/vcap/data` kills the running agent, systemd restarts it, and the restart races the umount/rm of /var/vcap/data (and crash-loops on the /var/log CleanupDataDir has already removed). DetectServiceManager must have run before this, since CleanupLogFile branches on the service manager and CreateAgentConfigFile stamps ServiceManager into the default agent.json from t.serviceManager.

func (*TestEnvironment) RunCommand

func (t *TestEnvironment) RunCommand(command string) (string, error)

func (*TestEnvironment) RunCommandChain

func (t *TestEnvironment) RunCommandChain(commands ...string) error

func (*TestEnvironment) SetUpDummyNetworkInterface

func (t *TestEnvironment) SetUpDummyNetworkInterface(ip, mac string) error

func (*TestEnvironment) StartAgent

func (t *TestEnvironment) StartAgent() error

func (*TestEnvironment) StartBlobstore

func (t *TestEnvironment) StartBlobstore() error

func (*TestEnvironment) StopAgent

func (t *TestEnvironment) StopAgent() error

func (*TestEnvironment) TearDownDummyNetworkInterface

func (t *TestEnvironment) TearDownDummyNetworkInterface() error

func (*TestEnvironment) WaitForAgent added in v2.868.0

func (t *TestEnvironment) WaitForAgent() error

Directories

Path Synopsis
windows
fixtures command

Jump to

Keyboard shortcuts

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