Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor config/resolvers.go, update resolvers_test.go #814

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
New unit and benchmark tests added to resolvers_test.go
  • Loading branch information
VltraHeaven committed Apr 27, 2022
commit 97ebb3529327b1f8044c6a1007dc329b0b6076a3
25 changes: 25 additions & 0 deletions config/resolvers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"testing"
)

var cfg = NewConfig()

func TestConfigSetResolvers(t *testing.T) {
type fields struct {
config *Config
Expand Down Expand Up @@ -42,3 +44,26 @@ func TestConfigSetResolvers(t *testing.T) {
})
}
}

func TestGetPublicDNSResolvers(t *testing.T) {
err := GetPublicDNSResolvers()
if err != nil {
t.Error(err)
return
}
if len(PublicResolvers) <= 0 {
t.Error("No resolvers obtained")
} else if PublicResolvers == nil {
t.Error("PublicResolvers is a nil slice")
}
}

func BenchmarkTestPublicDNSResolvers(b *testing.B) {
for i := 0; i < b.N; i++ {
err := GetPublicDNSResolvers()
if err != nil {
b.Error(err)
return
}
}
}