test: regression tests for all audit gaps — 6 enhanced + 4 new packages
Telegram: splitLongMessage (8 cases), isChatAllowed, updateMetadata (4 cases), panicRecoveryMiddleware, updateLoggingMiddleware, authorizedMessage, stop-while-stopped Container: error paths, payload round-trip, overwrite, minimal payload Events: buffer defaults, subscribe-after-close, double-close safety, slow-subscriber isolation, multi-subscriber ordering, publish timestamping NATS RPC: envelope edge cases, JSON round-trip, request timeout, rollback NellDB: empty store (6 ops), concurrent enqueue/claim (20 goroutines), context cancellation, oversized payload clipping, unmarshalable data, status transitions, events ordering, recover stale, clear terminal Gateway tasks: empty/long title, idempotent enqueue, chat label New packages with tests (formerly zero-test): internal/gate (220 lines), internal/gate/gateextract, internal/plugin/pluginextract, internal/workflow/wfextract All 37 packages pass. Fixes regression gaps from audit.
This commit is contained in:
1 parent
8356863712
commit
e8f78dd0d5
12 files changed
+1327
-2
No files matched your search
@@ -0,0 +1,66 @@
|
||||
package pluginextract
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSymbolsContainsExpectedPluginEntries(t *testing.T) {
|
||||
pkgKey := "github.com/samcharles93/archie-core/internal/plugin/plugin"
|
||||
pkg, ok := Symbols[pkgKey]
|
||||
if !ok {
|
||||
t.Fatalf("Symbols missing key %q", pkgKey)
|
||||
}
|
||||
|
||||
// LoadDir must be a function.
|
||||
if v, ok := pkg["LoadDir"]; !ok {
|
||||
t.Error("LoadDir missing from Symbols")
|
||||
} else if v.Kind() != reflect.Func {
|
||||
t.Errorf("LoadDir kind = %v, want Func", v.Kind())
|
||||
}
|
||||
|
||||
// Registry must be a pointer type.
|
||||
if v, ok := pkg["Registry"]; !ok {
|
||||
t.Error("Registry missing from Symbols")
|
||||
} else if v.Kind() != reflect.Ptr {
|
||||
t.Errorf("Registry kind = %v, want Ptr", v.Kind())
|
||||
}
|
||||
|
||||
// Plugin must be a pointer type.
|
||||
if v, ok := pkg["Plugin"]; !ok {
|
||||
t.Error("Plugin missing from Symbols")
|
||||
} else if v.Kind() != reflect.Ptr {
|
||||
t.Errorf("Plugin kind = %v, want Ptr", v.Kind())
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeneratedWrapperHasNilGuards(t *testing.T) {
|
||||
// Regression: go generate strips nil-guards from _Plugin wrapper.
|
||||
// Verify that Plugin is present in the Symbols table and is an
|
||||
// interface type (as expected for yaegi interface extraction).
|
||||
|
||||
pkgKey := "github.com/samcharles93/archie-core/internal/plugin/plugin"
|
||||
pkg := Symbols[pkgKey]
|
||||
|
||||
pluginType, ok := pkg["Plugin"]
|
||||
if !ok {
|
||||
t.Fatal("Plugin missing from Symbols")
|
||||
}
|
||||
|
||||
// Plugin is an interface type — yaegi represents interfaces
|
||||
// differently from struct pointers.
|
||||
kind := pluginType.Kind()
|
||||
if kind != reflect.Interface && kind != reflect.Ptr {
|
||||
t.Errorf("Plugin type kind = %v, want Interface or Ptr", kind)
|
||||
}
|
||||
|
||||
// Verify WName and WVersion exist on the Plugin interface type.
|
||||
// For interface types, we check the method set.
|
||||
if kind == reflect.Interface {
|
||||
methodCount := pluginType.Type().NumMethod()
|
||||
if methodCount < 2 {
|
||||
t.Errorf("Plugin interface has %d methods, expected at least 2 (Name, Version)", methodCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user