-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize CLI flags to use host:port addresses (#1827)
* Normalize CLI flags to use host:port addresses Signed-off-by: Annanay <annanay.a@media.net> * Addressed review comments Signed-off-by: Annanay <annanay.a@media.net> * Continue support for deprecated flags in all-in-one Signed-off-by: Annanay <annanay.a@media.net> * Nitpick, fix agent options in all-in-one Signed-off-by: Annanay <annanay.a@media.net> * Addressed comments, use HostPort in variable names Signed-off-by: Annanay <annanay.a@media.net> * Address comments Signed-off-by: Annanay <annanay.a@media.net> * Add Changelog entries Signed-off-by: Annanay <annanay.a@media.net> * Fix merge changes Signed-off-by: Annanay <annanay.a@media.net> * Checkpoint Signed-off-by: Annanay Agarwal <annanay@Annanays-Mac.local> * Rebased and addressed comments Signed-off-by: Annanay <annanayagarwal@gmail.com> * Remove TChan ports, remove leftover files from merge Signed-off-by: Annanay <annanayagarwal@gmail.com> * Address comments Signed-off-by: Annanay <annanayagarwal@gmail.com> * Fix go.mod, edit util function name Signed-off-by: Annanay <annanayagarwal@gmail.com> * Fix test, print address in log Signed-off-by: Annanay <annanayagarwal@gmail.com> * Make fmt Signed-off-by: Annanay <annanayagarwal@gmail.com> * Add small test Signed-off-by: Yuri Shkuro <ys@uber.com> * Another silly test Signed-off-by: Yuri Shkuro <ys@uber.com> Co-authored-by: Annanay <annanay.a@media.net> Co-authored-by: Annanay Agarwal <annanay@Annanays-Mac.local> Co-authored-by: Yuri Shkuro <ys@uber.com>
- Loading branch information
1 parent
b1868a6
commit 87b1910
Showing
14 changed files
with
181 additions
and
68 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
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,57 @@ | ||
// Copyright (c) 2020 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package app | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/jaegertracing/jaeger/pkg/config" | ||
) | ||
|
||
func TestCollectorOptionsWithFlags_CheckHostPort(t *testing.T) { | ||
c := &CollectorOptions{} | ||
v, command := config.Viperize(AddFlags) | ||
command.ParseFlags([]string{ | ||
"--collector.http-server.host-port=5678", | ||
"--collector.grpc-server.host-port=1234", | ||
"--collector.zipkin.host-port=3456", | ||
}) | ||
c.InitFromViper(v) | ||
|
||
assert.Equal(t, ":5678", c.CollectorHTTPHostPort) | ||
assert.Equal(t, ":1234", c.CollectorGRPCHostPort) | ||
assert.Equal(t, ":3456", c.CollectorZipkinHTTPHostPort) | ||
} | ||
|
||
func TestCollectorOptionsWithFlags_CheckFullHostPort(t *testing.T) { | ||
c := &CollectorOptions{} | ||
v, command := config.Viperize(AddFlags) | ||
command.ParseFlags([]string{ | ||
"--collector.http-server.host-port=:5678", | ||
"--collector.grpc-server.host-port=127.0.0.1:1234", | ||
"--collector.zipkin.host-port=0.0.0.0:3456", | ||
}) | ||
c.InitFromViper(v) | ||
|
||
assert.Equal(t, ":5678", c.CollectorHTTPHostPort) | ||
assert.Equal(t, "127.0.0.1:1234", c.CollectorGRPCHostPort) | ||
assert.Equal(t, "0.0.0.0:3456", c.CollectorZipkinHTTPHostPort) | ||
} | ||
|
||
func Test_getAddressFromCLIOptions(t *testing.T) { | ||
assert.Equal(t, ":123", getAddressFromCLIOptions(123, "")) | ||
} |
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
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.