From ebc6f414ace2a62b7dec8ce714b88a3ccdd05f71 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Tue, 27 Mar 2018 16:31:27 -0400 Subject: [PATCH] Formatting update --- agent/agent.go | 8 ++++---- agent/dns.go | 2 +- agent/dns_test.go | 14 +++++++------- agent/http_oss_test.go | 3 ++- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index e65d45f514..6d2af141c2 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -274,12 +274,12 @@ func (a *Agent) Start() error { a.logger.Printf("[WARN] agent: Node name %q will not be discoverable "+ "via DNS due to invalid characters. Valid characters include "+ "all alpha-numerics and dashes.", a.config.NodeName) - } else if ( len(a.config.NodeName) > MaxDNSLabelLength ) { + } else if len(a.config.NodeName) > MaxDNSLabelLength { a.logger.Printf("[WARN] agent: Node name %q will not be discoverable "+ "via DNS due to it being too long. Valid lengths are between "+ "1 and 63 bytes.", a.config.NodeName) } - + // create the local state a.State = local.NewState(LocalConfig(c), a.logger, a.tokens) @@ -1560,7 +1560,7 @@ func (a *Agent) AddService(service *structs.NodeService, chkTypes []*structs.Che a.logger.Printf("[WARN] agent: Service name %q will not be discoverable "+ "via DNS due to invalid characters. Valid characters include "+ "all alpha-numerics and dashes.", service.Service) - } else if ( len(service.Service) > MaxDNSLabelLength ) { + } else if len(service.Service) > MaxDNSLabelLength { a.logger.Printf("[WARN] agent: Service name %q will not be discoverable "+ "via DNS due to it being too long. Valid lengths are between "+ "1 and 63 bytes.", service.Service) @@ -1572,7 +1572,7 @@ func (a *Agent) AddService(service *structs.NodeService, chkTypes []*structs.Che a.logger.Printf("[DEBUG] agent: Service tag %q will not be discoverable "+ "via DNS due to invalid characters. Valid characters include "+ "all alpha-numerics and dashes.", tag) - } else if ( len(tag) > MaxDNSLabelLength ) { + } else if len(tag) > MaxDNSLabelLength { a.logger.Printf("[DEBUG] agent: Service tag %q will not be discoverable "+ "via DNS due to it being too long. Valid lengths are between "+ "1 and 63 bytes.", tag) diff --git a/agent/dns.go b/agent/dns.go index c9ba4e8107..5cd175ab55 100644 --- a/agent/dns.go +++ b/agent/dns.go @@ -31,7 +31,7 @@ const ( staleCounterThreshold = 5 * time.Second defaultMaxUDPSize = 512 - + MaxDNSLabelLength = 63 ) diff --git a/agent/dns_test.go b/agent/dns_test.go index eeb058002c..5d100126d5 100644 --- a/agent/dns_test.go +++ b/agent/dns_test.go @@ -3079,14 +3079,14 @@ func checkDNSService(t *testing.T, generateNumNodes int, aRecordLimit int, qType func TestDNS_ServiceLookup_ARecordLimits(t *testing.T) { t.Parallel() tests := []struct { - name string - aRecordLimit int - expectedAResults int + name string + aRecordLimit int + expectedAResults int expectedAAAAResults int - expectedSRVResults int - numNodesTotal int - udpSize uint16 - udpAnswerLimit int + expectedSRVResults int + numNodesTotal int + udpSize uint16 + udpAnswerLimit int }{ // UDP + EDNS {"udp-edns-1", 1, 1, 1, 30, 30, 8192, 3}, diff --git a/agent/http_oss_test.go b/agent/http_oss_test.go index a42e5d0996..1d772f3376 100644 --- a/agent/http_oss_test.go +++ b/agent/http_oss_test.go @@ -19,7 +19,8 @@ var extraTestEndpoints = map[string][]string{ } // These endpoints are ignored in unit testing for response codes -var ignoredEndpoints = []string{"/v1/status/peers","/v1/agent/monitor", "/v1/agent/reload" } +var ignoredEndpoints = []string{"/v1/status/peers", "/v1/agent/monitor", "/v1/agent/reload"} + // These have custom logic var customEndpoints = []string{"/v1/query", "/v1/query/"}