Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Dec 5, 2024
1 parent b922c1c commit 99d82ef
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package connstring

import (
"fmt"
"net"
"testing"

Expand Down Expand Up @@ -78,17 +79,18 @@ func TestInitialDNSSeedlistDiscoveryProse(t *testing.T) {
cases := []struct {
record string
uri string
labels int
}{
{"localhost", "mongodb+srv://localhost"},
{"mongo.local", "mongodb+srv://mongo.local"},
{"localhost", "mongodb+srv://localhost", 2},
{"mongo.local", "mongodb+srv://mongo.local", 3},
}
for _, c := range cases {
c := c
t.Run(c.uri, func(t *testing.T) {
t.Parallel()

_, err := newTestParser(c.record).parse(c.uri)
assert.ErrorContains(t, err, "DNS name must contain at least")
assert.ErrorContains(t, err, fmt.Sprintf("DNS name must contain at least %d labels", c.labels))
})
}
})
Expand Down

0 comments on commit 99d82ef

Please sign in to comment.