MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestCmdValidate_Failures

Function TestCmdValidate_Failures

cmd/e2a-prober/prober_test.go:230–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

228}
229
230func TestCmdValidate_Failures(t *testing.T) {
231 ctx := context.Background()
232
233 // Missing agent email → rejected before any DB work.
234 if err := cmdValidate(ctx, config{}); err == nil {
235 t.Error("validate without agent email should fail")
236 }
237
238 // DB reachable + migrations recorded, but the probe identity is absent.
239 // RunMigrations populates schema_migrations (testutil applies DDL only) so
240 // cmdValidate's migrations-applied check passes and reaches the identity check.
241 pool := testutil.TestDB(t)
242 if err := identity.RunMigrations(ctx, pool, migrations.FS, identity.ModeAuto); err != nil {
243 t.Fatalf("record migrations: %v", err)
244 }
245 err := cmdValidate(ctx, config{
246 DatabaseURL: testutil.TestDBURL(),
247 AgentEmail: "missing@nowhere.test",
248 })
249 if err == nil || !strings.Contains(err.Error(), "not found") {
250 t.Errorf("validate with missing identity: err = %v, want a not-found error", err)
251 }
252}

Callers

nothing calls this directly

Calls 5

TestDBFunction · 0.92
RunMigrationsFunction · 0.92
TestDBURLFunction · 0.92
cmdValidateFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected