ssm

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ssm supplies a focused set of helper assertions for Terratest integration suites. Each helper runs a shell command on a target EC2 instance through AWS Systems Manager (SSM) and immediately translates the result into a testify assertion, providing declarative checks of common OS-level expectations:

  • file or directory presence and permissions
  • package installation status
  • user, group, or service existence and state
  • mount points, network reachability, DNS resolution
  • arbitrary command output

The helpers hide repetitive SSM polling and error handling, so test code stays short, readable, and intent-focused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandOutputContains

func CommandOutputContains(t *testing.T, ssmClient *ssm.Client, instanceID string, command string, expected string)

CommandOutputContains asserts that a command output contains a specific string.

func DNSResolves

func DNSResolves(t *testing.T, ssmClient *ssm.Client, instanceID string, host string, expectedIP string)

DNSResolves asserts that a hostname resolves to an IP.

func DirectoryExists

func DirectoryExists(t *testing.T, ssmClient *ssm.Client, instanceID string, path string)

DirectoryExists checks if a directory exists at the given path.

func FileContains

func FileContains(t *testing.T, ssmClient *ssm.Client, instanceID string, path string, substr string)

FileContains asserts that a file contains a specific string.

func FileContainsAs

func FileContainsAs(t *testing.T, ssmClient *ssm.Client, instanceID string, user string, path string, substr string)

FileContainsAs asserts that a file contains a specific string, as another user.

func FileExecutable

func FileExecutable(t *testing.T, ssmClient *ssm.Client, instanceID string, path string)

FileExecutable checks if a file at the given path is executable.

func FileExists

func FileExists(t *testing.T, ssmClient *ssm.Client, instanceID string, path string)

FileExists checks if a file exists at the given path.

func GroupExists

func GroupExists(t *testing.T, ssmClient *ssm.Client, instanceID string, groupname string)

GroupExists checks if a group exists.

func PackageInstalled

func PackageInstalled(t *testing.T, ssmClient *ssm.Client, instanceID string, pkg string)

PackageInstalled checks if a package is installed.

func PathIsMount

func PathIsMount(t *testing.T, ssmClient *ssm.Client, instanceID string, path string)

PathIsMount checks if a path is a mount point.

func PortReachable

func PortReachable(t *testing.T, ssmClient *ssm.Client, instanceID string, host string, port int)

PortReachable checks if a host and port are reachable from the EC2 instance.

func RunCommand

func RunCommand(t *testing.T, ssmClient *ssm.Client, instanceID string, command string) string

RunCommand runs a command and returns the output.

func RunCommandAs

func RunCommandAs(t *testing.T, ssmClient *ssm.Client, instanceID string, user string, command string) string

RunCommandAs runs a command as another user and returns the output.

func ServiceDisabled

func ServiceDisabled(t *testing.T, ssmClient *ssm.Client, instanceID string, service string)

ServiceDisabled checks if a systemd service is disabled. The `|| true` guard is required because `systemctl is-enabled` exits non-zero for a disabled unit, which would otherwise be treated as a failed SSM command.

func ServiceEnabled

func ServiceEnabled(t *testing.T, ssmClient *ssm.Client, instanceID string, service string)

ServiceEnabled checks if a systemd service is enabled.

func ServiceRunning

func ServiceRunning(t *testing.T, ssmClient *ssm.Client, instanceID string, service string)

ServiceRunning checks if a systemd service is running.

func UserExists

func UserExists(t *testing.T, ssmClient *ssm.Client, instanceID string, username string)

UserExists checks if a user exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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