Skip to content

Commit 99d82ef

Browse files
committed
improve tests
1 parent b922c1c commit 99d82ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

x/mongo/driver/connstring/initial_dns_seedlist_discovery_prose_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package connstring
88

99
import (
10+
"fmt"
1011
"net"
1112
"testing"
1213

@@ -78,17 +79,18 @@ func TestInitialDNSSeedlistDiscoveryProse(t *testing.T) {
7879
cases := []struct {
7980
record string
8081
uri string
82+
labels int
8183
}{
82-
{"localhost", "mongodb+srv://localhost"},
83-
{"mongo.local", "mongodb+srv://mongo.local"},
84+
{"localhost", "mongodb+srv://localhost", 2},
85+
{"mongo.local", "mongodb+srv://mongo.local", 3},
8486
}
8587
for _, c := range cases {
8688
c := c
8789
t.Run(c.uri, func(t *testing.T) {
8890
t.Parallel()
8991

9092
_, err := newTestParser(c.record).parse(c.uri)
91-
assert.ErrorContains(t, err, "DNS name must contain at least")
93+
assert.ErrorContains(t, err, fmt.Sprintf("DNS name must contain at least %d labels", c.labels))
9294
})
9395
}
9496
})

0 commit comments

Comments
 (0)