Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Jun 23, 2022
1 parent bf2459a commit f9b6577
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 15 deletions.
2 changes: 0 additions & 2 deletions pkg/networkservice/chains/nsmgr/single_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ func Test_DNSUsecase(t *testing.T) {

nsc := domain.Nodes[0].NewClient(ctx, sandbox.GenerateTestToken, client.WithAdditionalFunctionality(dnscontext.NewClient(
dnscontext.WithChainContext(ctx),
dnscontext.WithCorefilePath(corefilePath),
dnscontext.WithResolveConfigPath(resolveConfigPath),
)))

conn, err := nsc.Request(ctx, defaultRequest(nsReg.Name))
Expand Down
2 changes: 2 additions & 0 deletions pkg/networkservice/connectioncontext/dnscontext/options.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2022 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/clienturlctx/context.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2021 Cisco Systems, Inc.
// Copyright (c) 2020-2022 Cisco Systems, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down
5 changes: 3 additions & 2 deletions pkg/tools/dnsutils/cache/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import (

"github.com/miekg/dns"
"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"

"github.com/networkservicemesh/sdk/pkg/tools/dnsutils"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/cache"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/dnsconfigs"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/fanout"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)

func TestCache(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/tools/dnsutils/dnsconfigs/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/miekg/dns"

"github.com/networkservicemesh/api/pkg/api/networkservice"

"github.com/networkservicemesh/sdk/pkg/tools/clienturlctx"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
Expand Down
3 changes: 2 additions & 1 deletion pkg/tools/dnsutils/resolvconf/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
"time"

"github.com/miekg/dns"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
"golang.org/x/net/context"

"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
)

func TestResolvConf(t *testing.T) {
Expand Down
7 changes: 1 addition & 6 deletions pkg/tools/dnsutils/resolvconf/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,5 @@ const (
// OptionsProperty allows certain internal resolver variables to be modified
OptionsProperty = "options"
// AnyDomain means that allowed any host-name
AnyDomain = "."
DefaultPlugin = "fanout"
ServerBlockTemplate = `%v {
%v . %v
%v
}`
AnyDomain = "."
)
2 changes: 2 additions & 0 deletions pkg/tools/dnsutils/searches/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (

type contextKeyType string

// WithSearchDomains wraps 'parent' in a new Context that has search domains
func WithSearchDomains(parent context.Context, domains []string) context.Context {
if parent == nil {
panic("cannot create context from nil parent")
Expand All @@ -36,6 +37,7 @@ func WithSearchDomains(parent context.Context, domains []string) context.Context
return context.WithValue(parent, searchDomainsKey, domains)
}

// SearchDomains returns search domains
func SearchDomains(ctx context.Context) []string {
if rv, ok := ctx.Value(searchDomainsKey).([]string); ok {
return rv
Expand Down
7 changes: 6 additions & 1 deletion pkg/tools/dnsutils/searches/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/networkservicemesh/sdk/pkg/tools/dnsutils"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
"github.com/networkservicemesh/sdk/pkg/tools/log"
)

const (
Expand Down Expand Up @@ -61,7 +62,11 @@ func (h *searchDomainsHandler) ServeDNS(ctx context.Context, rw dns.ResponseWrit

for _, resp := range r.Responses {
if resp != nil && resp.Rcode == 0 {
rw.WriteMsg(resp)
if err := rw.WriteMsg(resp); err != nil {
log.FromContext(ctx).Warnf("got an error during write the message: %v", err.Error())
dns.HandleFailed(rw, resp)
return
}
return
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/tools/dnsutils/searches/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import (

"github.com/miekg/dns"
"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"

"github.com/networkservicemesh/sdk/pkg/tools/dnsutils"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/dnsconfigs"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/fanout"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/next"
"github.com/networkservicemesh/sdk/pkg/tools/dnsutils/searches"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)

func TestDomainSearches(t *testing.T) {
Expand Down

0 comments on commit f9b6577

Please sign in to comment.