-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gateway: fix the dns discovery method
strip the scheme from the endpoints to have a clean hostname for TCP proxy Fixes #7452
- Loading branch information
1 parent
320768b
commit e317664
Showing
2 changed files
with
45 additions
and
0 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,27 @@ | ||
package etcdmain | ||
|
||
import "testing" | ||
|
||
func TestStripSchema(t *testing.T) { | ||
endpoints := []string{ | ||
"https://etcd-node:2379", | ||
"http://etcd-node:2379", | ||
"etcd-node:2379", | ||
"etcd-node", | ||
} | ||
|
||
expected := []string { | ||
"etcd-node:2379", | ||
"etcd-node:2379", | ||
"etcd-node:2379", | ||
"etcd-node", | ||
} | ||
|
||
result := stripSchema(endpoints) | ||
|
||
for i, ep := range result { | ||
if ep != expected[i] { | ||
t.Errorf("Expected stripSchema to return '%v' from '%v' but got '%v'", expected[i], endpoints[i], ep) | ||
} | ||
} | ||
} |