Skip to content

[DEV] move test environment into Go #25

@rainest

Description

@rainest

Short Description
Replace the specialized test container executed with supporting infrastructure via docker-compose via bash with tests that go test can run mostly independently.

Definition of Done
To the extent possible, go test invocations can provision the supporting environment necessary to test PCS and run tests without prior environment preparation.

External environment management should be limited to overriding test defaults: for example, if the tests allow choosing a storage environment, the Makefile/Actions can pass STORAGE=etcd or STORAGE=postgres to choose which. Go will still be responsible for creating the Postgres or etcd instance, however.

The testcontainers project provides a library of supporting infrastructure containers that can be configured and started from Go (e.g. https://golang.testcontainers.org/modules/vault/). For SMD and the like we'd need to create our own.

Additional context
The current test scaffolding doesn't allow the use of a debugger or running individual tests, which is painful for development.

Adding new tests requires knowing which of several layers (the code, the test image, the test docker-compose configuration, the script that invokes docker-compose, the Makefile, and the Actions workflow) to add new configuration to. A base layer that can operate independently with overlays over top is easier to work with: you add configuration to the base first and only elsewhere when you need to override.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions