Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Jan 30, 2025
1 parent 223d1d9 commit 9675725
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions wireclient/wireclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ func setup(t testing.TB) string {
return uri
}

// databaseName returns the database name for the test.
func databaseName(t testing.TB) string {
t.Helper()

return strings.ReplaceAll(t.Name(), "/", "_")
}

func TestConn(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -153,13 +160,13 @@ func TestTypes(t *testing.T) {
d := wirebson.Decimal128{H: 13, L: 42}
md := bson.NewDecimal128(13, 42)

db := mConn.Database(t.Name())
db := mConn.Database(databaseName(t))
require.NoError(t, db.Drop(ctx))

_, body, err := conn.Request(ctx, wire.MustOpMsg(
"insert", "test",
"documents", wirebson.MustArray(wirebson.MustDocument("_id", "d", "v", d)),
"$db", t.Name(),
"$db", db.Name(),
))
require.NoError(t, err)

Expand All @@ -173,7 +180,7 @@ func TestTypes(t *testing.T) {
_, body, err = conn.Request(ctx, wire.MustOpMsg(
"find", "test",
"sort", wirebson.MustDocument("_id", int32(1)),
"$db", t.Name(),
"$db", db.Name(),
))
require.NoError(t, err)

Expand Down

0 comments on commit 9675725

Please sign in to comment.