cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2020.5.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

edgediscovery/allregions/discovery_test.go

32lines · modecode

1package allregions
2
3import (
4 "testing"
5
6 "github.com/sirupsen/logrus"
7 "github.com/stretchr/testify/assert"
8)
9
10func TestEdgeDiscovery(t *testing.T) {
11 mockAddrs := newMockAddrs(19, 2, 5)
12 netLookupSRV = mockNetLookupSRV(mockAddrs)
13 netLookupIP = mockNetLookupIP(mockAddrs)
14
15 expectedAddrSet := map[string]bool{}
16 for _, addrs := range mockAddrs.addrMap {
17 for _, addr := range addrs {
18 expectedAddrSet[addr.String()] = true
19 }
20 }
21
22 addrLists, err := edgeDiscovery(logrus.New().WithFields(logrus.Fields{}))
23 assert.NoError(t, err)
24 actualAddrSet := map[string]bool{}
25 for _, addrs := range addrLists {
26 for _, addr := range addrs {
27 actualAddrSet[addr.String()] = true
28 }
29 }
30
31 assert.Equal(t, expectedAddrSet, actualAddrSet)
32}
33