-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DCA] advanced dispatching + rebalancing (#4068)
- Loading branch information
Showing
18 changed files
with
2,064 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-2019 Datadog, Inc. | ||
|
||
// +build clusterchecks | ||
|
||
package v1 | ||
|
||
import "testing" | ||
|
||
func TestParseClientIP(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
args string | ||
expected string | ||
}{ | ||
{ | ||
name: "valid ipv4", | ||
args: "127.0.0.1:1337", | ||
expected: "127.0.0.1", | ||
}, | ||
{ | ||
name: "ipv4 no port", | ||
args: "127.0.0.1:", | ||
expected: "127.0.0.1", | ||
}, | ||
{ | ||
name: "ipv6", | ||
args: "[2001:db8:1f70::999:de8:7648:6e8]:1337", | ||
expected: "2001:db8:1f70::999:de8:7648:6e8", | ||
}, | ||
{ | ||
name: "valid ipv6 localhost", | ||
args: "[::1]:1337", | ||
expected: "::1", | ||
}, | ||
{ | ||
name: "ipv6 no port", | ||
args: "[::1]:", | ||
expected: "::1", | ||
}, | ||
{ | ||
name: "localhost", | ||
args: "localhost:1337", | ||
expected: "localhost", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got, _ := parseClientIP(tt.args); got != tt.expected { | ||
t.Errorf("parseClientIP() == %v, expected %v", got, tt.expected) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.