Documentation
¶
Overview ¶
Package mock provides an in-memory mock Datastore server for testing.
This package can be used by both ds9 internal tests and by end-users who want to test their code that depends on ds9 without hitting real Datastore APIs.
Example usage:
import "github.com/codeGROOVE-dev/ds9/pkg/datastore"
func TestMyCode(t *testing.T) {
client, cleanup := datastore.NewMockClient(t)
defer cleanup()
// Use client in your tests
key := datastore.NameKey("Task", "task-1", nil)
_, err := client.Put(ctx, key, &myTask)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockServers ¶
NewMockServers creates mock metadata and API servers for testing. Returns the metadata URL, API URL, and a cleanup function. This function doesn't import datastore to avoid import cycles.
For convenience, use datastore.NewMockClient() instead which handles all setup.
Types ¶
Click to show internal directories.
Click to hide internal directories.