fix nameserver tests

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2024-10-09 17:04:20 +03:00
parent 271bed5f73
commit 9ee08fc441
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -939,7 +939,7 @@ func TestValidateDomain(t *testing.T) {
} }
func TestNameServerAccountPeersUpdate(t *testing.T) { func TestNameServerAccountPeersUpdate(t *testing.T) {
manager, account, peer1, peer2, _ := setupNetworkMapTest(t) manager, account, peer1, peer2, peer3 := setupNetworkMapTest(t)
var newNameServerGroupA *nbdns.NameServerGroup var newNameServerGroupA *nbdns.NameServerGroup
var newNameServerGroupB *nbdns.NameServerGroup var newNameServerGroupB *nbdns.NameServerGroup
@ -953,7 +953,7 @@ func TestNameServerAccountPeersUpdate(t *testing.T) {
{ {
ID: "groupB", ID: "groupB",
Name: "GroupB", Name: "GroupB",
Peers: []string{peer1.ID, peer2.ID}, Peers: []string{peer1.ID, peer2.ID, peer3.ID},
}, },
}) })
assert.NoError(t, err) assert.NoError(t, err)
@ -1043,11 +1043,18 @@ func TestNameServerAccountPeersUpdate(t *testing.T) {
close(done) close(done)
}() }()
newNameServerGroupB.NameServers = []nbdns.NameServer{{ newNameServerGroupB.NameServers = []nbdns.NameServer{
IP: netip.MustParseAddr("1.1.1.2"), {
NSType: nbdns.UDPNameServerType, IP: netip.MustParseAddr("1.1.1.2"),
Port: nbdns.DefaultDNSPort, NSType: nbdns.UDPNameServerType,
}} Port: nbdns.DefaultDNSPort,
},
{
IP: netip.MustParseAddr("8.8.8.8"),
NSType: nbdns.UDPNameServerType,
Port: nbdns.DefaultDNSPort,
},
}
err = manager.SaveNameServerGroup(context.Background(), account.Id, userID, newNameServerGroupB) err = manager.SaveNameServerGroup(context.Background(), account.Id, userID, newNameServerGroupB)
assert.NoError(t, err) assert.NoError(t, err)
@ -1066,11 +1073,18 @@ func TestNameServerAccountPeersUpdate(t *testing.T) {
close(done) close(done)
}() }()
newNameServerGroupB.NameServers = []nbdns.NameServer{{ newNameServerGroupB.NameServers = []nbdns.NameServer{
IP: netip.MustParseAddr("1.1.1.2"), {
NSType: nbdns.UDPNameServerType, IP: netip.MustParseAddr("1.1.1.2"),
Port: nbdns.DefaultDNSPort, NSType: nbdns.UDPNameServerType,
}} Port: nbdns.DefaultDNSPort,
},
{
IP: netip.MustParseAddr("8.8.8.8"),
NSType: nbdns.UDPNameServerType,
Port: nbdns.DefaultDNSPort,
},
}
err = manager.SaveNameServerGroup(context.Background(), account.Id, userID, newNameServerGroupB) err = manager.SaveNameServerGroup(context.Background(), account.Id, userID, newNameServerGroupB)
assert.NoError(t, err) assert.NoError(t, err)