Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBinaries ¶
func BuildBinaries() (func(), error)
BuildBinaries compiles gapid and gapictl into a directory the suite owns, and returns a function that removes it.
GAPI-DIV-097: this suite shells out to both binaries, and before this existed it did not produce either of them. The absence check in gapictlPath fails loudly when bin/gapictl is missing, which made the harness look guarded while nothing at all detected a STALE binary - the common case for a developer who edits pkg/cli and runs the suite. A bin/gapictl a day older than the change under test produced `ok github.com/goppydae/gapi/test/adk 191.263s`, an entirely green run against the previous binary, over four subtests that failed immediately after `mage build`. CI was immune only because its workflow builds first; the local run typed the same command in the wrong sequence.
Building rather than asserting freshness removes the failure mode instead of reporting it, and makes `go test ./test/adk/` correct on its own - which is what a developer will type.
The binaries are NOT written to the checkout's bin/. A suite that overwrote the operator's build would make its own correctness a side effect on someone else's artifact, and `mage build` and this suite would race whenever both ran.
No version ldflags are passed. mage's Build stamps them; nothing here reads a version, and a test that needed one would be asserting on the build system rather than on the code.
Types ¶
type TestHarness ¶
type TestHarness struct {
// contains filtered or unexported fields
}
TestHarness provides utilities for ADK integration testing
func NewHarness ¶
func NewHarness() (*TestHarness, error)
NewHarness creates a harness over the whole fixtures tree.
func NewHarnessAt ¶
func NewHarnessAt(agentsDir string) (*TestHarness, error)
NewHarnessAt creates a harness whose discovery is fenced to agentsDir.
A caller that stages exactly the agents its test needs gets two things the shared fixtures tree cannot give it. The obvious one is isolation. The load-bearing one is that unrelated agents' start timeouts cannot starve the agents under test - that is the ~90s TestTimerAgent_Execution failure recorded as GAPI-DIV-021, and it came from discovery finding more than the test meant it to.
func (*TestHarness) GetAgentState ¶
func (h *TestHarness) GetAgentState(id string) (string, error)
GetAgentState returns the current state of an agent
func (*TestHarness) SendLifecycleAction ¶
func (h *TestHarness) SendLifecycleAction(id, action string) error
SendLifecycleAction sends a lifecycle action to an agent
func (*TestHarness) WaitForState ¶
func (h *TestHarness) WaitForState(id, expectedState string, timeout time.Duration) error
WaitForState waits for an agent to reach a specific state
Directories
¶
| Path | Synopsis |
|---|---|
|
fixtures
|
|
|
go
command
|
|
|
go/capabilities_agent
command
Capabilities agent with capability detection
|
Capabilities agent with capability detection |
|
go/hash_agent
command
Hash agent for testing schema hashing
|
Hash agent for testing schema hashing |
|
go/lifecycle_agent
command
Lifecycle agent demonstrating full lifecycle support
|
Lifecycle agent demonstrating full lifecycle support |
|
go/simple_service
command
Simple service agent for cross-ADK testing
|
Simple service agent for cross-ADK testing |