agent build
This commit is contained in:
36
go-api/internal/tools/dump_test.go
Normal file
36
go-api/internal/tools/dump_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package tools_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/krow/krow-backend/go-api/internal/authctx"
|
||||
"github.com/krow/krow-backend/go-api/internal/testutil"
|
||||
"github.com/krow/krow-backend/go-api/internal/tools"
|
||||
)
|
||||
|
||||
// TestDumpToolOutput prints what each tool actually returns against the seeded
|
||||
// demo tenant. Run with -v when checking that a port produces real figures
|
||||
// rather than a silent zero.
|
||||
func TestDumpToolOutput(t *testing.T) {
|
||||
h := testutil.New(t)
|
||||
admin := authctx.Identity{
|
||||
UserID: "00000000-0000-0000-0000-000000000001",
|
||||
OrgID: h.OrgID, Role: "admin", Email: "admin@example.test",
|
||||
}
|
||||
reg := tools.NewRegistry()
|
||||
for _, tool := range everyTool(h.Pool) {
|
||||
reg.MustRegister(tool)
|
||||
}
|
||||
for _, name := range reg.Names() {
|
||||
res := reg.Dispatch(context.Background(),
|
||||
tools.Context{Principal: admin}, name, json.RawMessage(`{"limit":3}`))
|
||||
encoded, _ := json.Marshal(res.Data)
|
||||
out := string(encoded)
|
||||
if len(out) > 400 {
|
||||
out = out[:400] + "…"
|
||||
}
|
||||
t.Logf("%-24s %s", name, out)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user