update tests and memory implementation to follow real DB implementations as much as possible. Fix the tests to let the DB generate the server uuids rather than setting them up in the test.

This commit is contained in:
Avinash Sridhar 2025-05-27 10:55:48 -04:00 • committed by Toby Padilla
commit f9ab0bc49b

View file

@ -7,6 +7,7 @@ import (
"strings"
"sync"
"github.com/google/uuid"
"github.com/modelcontextprotocol/registry/internal/model"
)
@ -231,6 +232,8 @@ func (db *MemoryDB) Publish(ctx context.Context, serverDetail *model.ServerDetai
return ErrInvalidInput
}
// Generate a new ID for the server detail
serverDetail.ID = uuid.New().String()
// Store a copy of the entire ServerDetail
serverDetailCopy := *serverDetail
db.entries[serverDetail.ID] = &serverDetailCopy