Skip to content

Centralize the hand-rolled ateapipb.ControlClient test fake #1044

Description

PROBLEM

Five test files hand-roll a fake ateapipb.ControlClient, across four packages. #907 adds a sixth,
which is what surfaced this. That PR should land as it stands; consolidating these is follow-up
cleanup, not a prerequisite for it.
Surveyed at 3f132c6d (main, 2026-08-17). Links are permalinks pinned to that commit so the line numbers can't drift; the type names are the durable anchor.

type package location RPCs stubbed
mockControlClient controllers actortemplate_controller_test.go:97 CreateAtespace, CreateActor
healthControlClient router health_test.go:41 ListActors
mockClient ingress ingress_test.go:39 ResumeActor
resumerMockClient ingress resumer_test.go:32 ResumeActor
egressMockClient egress egress_test.go:197 GetActor

The sixth, not yet merged: fakeControlClient in internal/benchmarking/boomer/glutton/fixture_test.go, package glutton, stubbing CreateAtespace, CreateActor, ResumeActor, SuspendActor, DeleteActor.

The two ingress ones live in the same package: the same one-RPC ResumeActor fake under two names. Their struct definitions are identical; only the method bodies differ, and resumerMockClient nil-guards resumeFn where mockClient calls it unconditionally.

All six are unexported and live in _test.go files, so none is importable. All six use the same idiom: embed ateapipb.ControlClient as an anonymous field and override the handful of RPCs the test needs, so calls to any RPC no fake overrides compile and nil-panic at call time.

The union across all six is seven RPCs: CreateAtespace, CreateActor, ResumeActor, SuspendActor, DeleteActor, GetActor, ListActors. ControlClient declares 28, so one embedding fake needs pluggable func fields for just those seven and inherits the rest.

PROPOSAL

An exported fake in a non-_test.go file under repo-root internal/, following the precedent
already set by internal/volume/mock.go:52 (MockVolumePlugin, with NewMockVolumePlugin() at
:55), which cmd/ateapi/internal/controlapi/functional_test.go and controlapi/volumes_test.go already call cross-package.

Placement has to be repo-root internal/: cmd/<app>/internal/... is importable only from under
that cmd/<app>, and pkg/proto/ateapipb is generated. pkg/ would work mechanically but makes a
test fake part of the public API surface. Put it in a dedicated package rather than an existing production one, so only tests link it and it never reaches a shipped binary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testsEnhancing / fixing test coverage.kind/cleanupSmall fixes that are not bugs, for example a typo in a code comment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions