- Introduce `-config-overlay` flag and `config.LoadOverlay()` to merge a base config with an overlay file, only overriding fields the overlay sets. This enables docker-compose to mount the base config from the host and apply only deployment-specific overrides. - Create `internal/natsrpc` package with reusable NATS request/reply primitives (Envelope, Client, Call, RegisterAll, Respond). Migrate storerpc, worktreerpc, and forgerpc to use it, eliminating duplicated marshal/unmarshal and error handling. - Create `internal/yaegiutil` package with shared interpreter construction (stdlib + extra symbols), generic export resolution (Resolve), and panic recovery (Safe). Migrate all Yaegi-based surfaces (gate scripts, daemon plugins, skill plugins, workflow stages, skill scripts) to use it, reducing boilerplate and centralizing panic safety. - Simplify `config.docker.toml` to contain only overlay fields (paths, container config) and remove the duplicated repos list – the base config is now the single source of truth. - Update docker-compose.yml to pass both -config and -config-overlay flags and mount the base config from the host. - Add tests for LoadOverlay, DockerConfigOverlaysExampleConfig, Envelope, and yaegiutil utilities.
27 lines
592 B
Go
27 lines
592 B
Go
package natsrpc_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/samcharles93/archie-core/internal/natsrpc"
|
|
)
|
|
|
|
func TestEnvelopeRoundTrip(t *testing.T) {
|
|
if err := natsrpc.NewEnvelope(nil).Err(); err != nil {
|
|
t.Errorf("NewEnvelope(nil).Err() = %v, want nil", err)
|
|
}
|
|
|
|
want := "boom"
|
|
env := natsrpc.NewEnvelope(errBoom{want})
|
|
if env.Error != want {
|
|
t.Errorf("Error = %q, want %q", env.Error, want)
|
|
}
|
|
if got := env.Err(); got == nil || got.Error() != want {
|
|
t.Errorf("Err() = %v, want %q", got, want)
|
|
}
|
|
}
|
|
|
|
type errBoom struct{ msg string }
|
|
|
|
func (e errBoom) Error() string { return e.msg }
|