condortest

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package condortest provides a reusable in-process HTCondor test harness.

It stands up a real, ephemeral HTCondor pool (master, collector, shared port, and schedd) via condor_master so that integration tests in any package can exercise CEDAR against a live pool. Tests that use this package are skipped automatically when condor_master is not available in PATH.

Although this is a regular (non _test.go) source file, it intentionally imports the testing package: this is the idiomatic way to share a test harness across multiple Go packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Harness

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

Harness manages a mini HTCondor instance for integration testing.

func New

func New(t *testing.T) *Harness

New creates and starts a mini HTCondor instance via condor_master.

func NewWithConfig

func NewWithConfig(t *testing.T, extraConfig string) *Harness

NewWithConfig allows injecting extra HTCondor config lines (e.g., extra daemons).

func (*Harness) CACertFile

func (h *Harness) CACertFile() string

CACertFile returns the path to the generated CA certificate.

func (*Harness) ConfigDir

func (h *Harness) ConfigDir() string

ConfigDir returns the directory containing the generated condor_config.

func (*Harness) GetCollectorAddr

func (h *Harness) GetCollectorAddr() string

GetCollectorAddr returns the collector address.

func (*Harness) GetCollectorAlias

func (h *Harness) GetCollectorAlias() string

GetCollectorAlias extracts the alias from the collector sinful string. Sinful string format: <127.0.0.1:52504?addrs=127.0.0.1-52504&alias=f4hp7ql65f-2.local>

func (*Harness) GetCollectorHost

func (h *Harness) GetCollectorHost() string

GetCollectorHost returns the collector host.

func (*Harness) GetCollectorPort

func (h *Harness) GetCollectorPort() int

GetCollectorPort returns the collector port.

func (*Harness) HostCertFile

func (h *Harness) HostCertFile() string

HostCertFile returns the path to the generated host certificate.

func (*Harness) HostKeyFile

func (h *Harness) HostKeyFile() string

HostKeyFile returns the path to the generated host private key.

func (*Harness) PasswordDir

func (h *Harness) PasswordDir() string

PasswordDir returns the directory containing the pool signing key(s).

func (*Harness) PrintAllLogs

func (h *Harness) PrintAllLogs()

PrintAllLogs prints all HTCondor logs for debugging.

func (*Harness) QuerySchedAds

func (h *Harness) QuerySchedAds(t *testing.T) (int, string, error)

QuerySchedAds queries the collector for schedd ads and returns the count and any found address.

func (*Harness) Shutdown

func (h *Harness) Shutdown(t *testing.T)

Shutdown stops the HTCondor master instance.

func (*Harness) SocketDir

func (h *Harness) SocketDir() string

SocketDir returns the pool's DAEMON_SOCKET_DIR, the directory the condor_shared_port daemon watches for endpoint sockets.

func (*Harness) SupportsAuthMethod

func (h *Harness) SupportsAuthMethod(method string) bool

SupportsAuthMethod checks if HTCondor supports a specific authentication method by querying the collector's capabilities.

func (*Harness) TmpDir

func (h *Harness) TmpDir() string

TmpDir returns the harness temporary directory. Tests can place generated tokens and other scratch files here.

type KerberosFixture added in v0.6.0

type KerberosFixture struct {
	Realm       string // e.g. CEDAR.TEST
	Host        string // service host component, e.g. localhost
	Service     string // service component, e.g. host
	ClientPrinc string // e.g. client@CEDAR.TEST
	KeytabFile  string // service keytab (KERBEROS_SERVER_KEYTAB)
	CCacheFile  string // client credential cache (KRB5CCNAME)
	Krb5Conf    string // krb5.conf (KRB5_CONFIG)
	// contains filtered or unexported fields
}

KerberosFixture is an ephemeral MIT Kerberos KDC provisioned for interop tests: a realm, a service keytab for <service>/<host> (what a C++ condor daemon authenticates with), and a client credential cache. Everything lives under a temp dir; the KDC is stopped on cleanup.

func SetupKerberos added in v0.6.0

func SetupKerberos(t *testing.T, host string) *KerberosFixture

SetupKerberos stands up a KDC and returns a fixture. It skips the test if the MIT krb5 tools are not installed (so it is a no-op on dev machines / plain CI and runs for real in the Docker interop image).

func (*KerberosFixture) CondorConfig added in v0.6.0

func (f *KerberosFixture) CondorConfig() string

CondorConfig returns the HTCondor config lines that make a C++ daemon accept KERBEROS with this fixture's keytab.

Jump to

Keyboard shortcuts

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