diff --git a/src/aggregator/aggregator/options_test.go b/src/aggregator/aggregator/options_test.go index 3bb5d446d4..16675a8950 100644 --- a/src/aggregator/aggregator/options_test.go +++ b/src/aggregator/aggregator/options_test.go @@ -124,12 +124,9 @@ func TestSetStreamOptions(t *testing.T) { } func TestSetAdminClient(t *testing.T) { - c, err := client.NewClient(client.NewOptions()) - require.NoError(t, err) - value, ok := c.(client.AdminClient) - require.True(t, ok) - o := NewOptions().SetAdminClient(value) - require.True(t, value == o.AdminClient()) + var c client.AdminClient = &client.M3MsgClient{} + o := NewOptions().SetAdminClient(c) + require.True(t, c == o.AdminClient()) } func TestSetRuntimeOptionsManager(t *testing.T) { diff --git a/src/aggregator/client/m3msg_client.go b/src/aggregator/client/m3msg_client.go index 543e005371..01053d83d6 100644 --- a/src/aggregator/client/m3msg_client.go +++ b/src/aggregator/client/m3msg_client.go @@ -1,3 +1,23 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + package client import ( diff --git a/src/aggregator/client/m3msg_client_test.go b/src/aggregator/client/m3msg_client_test.go index 27f9d7b1dd..9c76c8e84f 100644 --- a/src/aggregator/client/m3msg_client_test.go +++ b/src/aggregator/client/m3msg_client_test.go @@ -1,3 +1,23 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + package client import ( diff --git a/src/aggregator/client/tcp_client.go b/src/aggregator/client/tcp_client.go index 0207296ed6..bd75142714 100644 --- a/src/aggregator/client/tcp_client.go +++ b/src/aggregator/client/tcp_client.go @@ -1,3 +1,23 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + package client import ( @@ -67,7 +87,7 @@ func NewTCPClient(opts Options) (*TCPClient, error) { placementWatcher = placement.NewStagedPlacementWatcher(opts.StagedPlacementWatcherOptions(). SetActiveStagedPlacementOptions(activeStagedPlacementOpts)) - c := &TCPClient{ + return &TCPClient{ nowFn: opts.ClockOptions().NowFn(), shardCutoverWarmupDuration: opts.ShardCutoverWarmupDuration(), shardCutoffLingerDuration: opts.ShardCutoffLingerDuration(), @@ -75,18 +95,12 @@ func NewTCPClient(opts Options) (*TCPClient, error) { shardFn: opts.ShardFn(), placementWatcher: placementWatcher, metrics: newTCPClientMetrics(instrumentOpts.MetricsScope()), - } - - if err := c.placementWatcher.Watch(); err != nil { - return nil, err - } - - return c, nil + }, nil } -// Init does nothing for TCPClient, just satisfies Client interface. +// Init initializes TCPClient. func (c *TCPClient) Init() error { - return nil + return c.placementWatcher.Watch() } // WriteUntimedCounter writes untimed counter metrics.