Documentation
¶
Overview ¶
Package agentcommon provides a production-router fixture for Agent Packages and Agent Plugins server-route suites.
Role ¶
Test support, outside the modules, for test/server/artifacts/agentpackages and test/server/artifacts/agentplugins.
Inputs ¶
- The production router from test/server/support/harness (app.NewRouter), an in-memory store and a file-system blob store, and the seeding of test/server/support.
Outputs ¶
- World, from NewWorld: the router with the users deployer and user and the local repository libs-local.
- Assertions the two suites share: WantStatus, HitsOf and SetTrashcan.
References ¶
- Research 33: docs/research/33-package-formats.md.
- docs/testing/server-test-ownership.md: how CI selection gives the package an owner.
- https://github.com/weaveplatform/artifactweave/issues/673
Status ¶
Implemented P9b (issue 673).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HitsOf ¶
HitsOf returns the results array of a search response. It fails t unless rec is 200 OK with a JSON body that has a results array.
func SetTrashcan ¶
SetTrashcan turns the trash can on or off in db, with a 14-day retention, and fails t when the setting cannot be stored.
func WantStatus ¶
func WantStatus(t *testing.T, rec *httptest.ResponseRecorder, want int)
WantStatus fails t, printing the response body, unless rec has the status want.
Types ¶
type World ¶
World is the production router over an in-memory store and a file-system blob store, built by NewWorld for one test. Do sends requests to Handler; DB and Blobs let a test seed state or check what a request left behind.
func NewWorld ¶
NewWorld builds a World for t: a seeded store with the users deployer and user, both with the password "pw", and the generic local repository libs-local; blobs under t's temporary directory; and the router with Basic authentication. It fails t when any of them cannot be built.
func (*World) Do ¶
func (w *World) Do(method, path, as, body string, headers ...string) *httptest.ResponseRecorder
Do sends a request to the world's router as the user as, with the password "pw" over Basic, or without credentials when as is empty. headers are name and value pairs; a trailing name without a value is ignored.