[VOL-5486] Fix deprecated versions
Change-Id: If0b888d6c2f33b2f415c8b03b08dc994bb3df3f4
Signed-off-by: Abhay Kumar <abhay.kumar@radisys.com>
diff --git a/vendor/go.uber.org/zap/zaptest/doc.go b/vendor/go.uber.org/zap/zaptest/doc.go
new file mode 100644
index 0000000..b377859
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/doc.go
@@ -0,0 +1,22 @@
+// Copyright (c) 2016 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 zaptest provides a variety of helpers for testing log output.
+package zaptest // import "go.uber.org/zap/zaptest"
diff --git a/vendor/go.uber.org/zap/zaptest/logger.go b/vendor/go.uber.org/zap/zaptest/logger.go
new file mode 100644
index 0000000..4734c33
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/logger.go
@@ -0,0 +1,157 @@
+// Copyright (c) 2017 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 zaptest
+
+import (
+ "bytes"
+
+ "go.uber.org/zap"
+ "go.uber.org/zap/zapcore"
+)
+
+// LoggerOption configures the test logger built by NewLogger.
+type LoggerOption interface {
+ applyLoggerOption(*loggerOptions)
+}
+
+type loggerOptions struct {
+ Level zapcore.LevelEnabler
+ zapOptions []zap.Option
+}
+
+type loggerOptionFunc func(*loggerOptions)
+
+func (f loggerOptionFunc) applyLoggerOption(opts *loggerOptions) {
+ f(opts)
+}
+
+// Level controls which messages are logged by a test Logger built by
+// NewLogger.
+func Level(enab zapcore.LevelEnabler) LoggerOption {
+ return loggerOptionFunc(func(opts *loggerOptions) {
+ opts.Level = enab
+ })
+}
+
+// WrapOptions adds zap.Option's to a test Logger built by NewLogger.
+func WrapOptions(zapOpts ...zap.Option) LoggerOption {
+ return loggerOptionFunc(func(opts *loggerOptions) {
+ opts.zapOptions = zapOpts
+ })
+}
+
+// NewLogger builds a new Logger that logs all messages to the given
+// testing.TB.
+//
+// logger := zaptest.NewLogger(t)
+//
+// Use this with a *testing.T or *testing.B to get logs which get printed only
+// if a test fails or if you ran go test -v.
+//
+// The returned logger defaults to logging debug level messages and above.
+// This may be changed by passing a zaptest.Level during construction.
+//
+// logger := zaptest.NewLogger(t, zaptest.Level(zap.WarnLevel))
+//
+// You may also pass zap.Option's to customize test logger.
+//
+// logger := zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller()))
+func NewLogger(t TestingT, opts ...LoggerOption) *zap.Logger {
+ cfg := loggerOptions{
+ Level: zapcore.DebugLevel,
+ }
+ for _, o := range opts {
+ o.applyLoggerOption(&cfg)
+ }
+
+ writer := NewTestingWriter(t)
+ zapOptions := []zap.Option{
+ // Send zap errors to the same writer and mark the test as failed if
+ // that happens.
+ zap.ErrorOutput(writer.WithMarkFailed(true)),
+ }
+ zapOptions = append(zapOptions, cfg.zapOptions...)
+
+ return zap.New(
+ zapcore.NewCore(
+ zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()),
+ writer,
+ cfg.Level,
+ ),
+ zapOptions...,
+ )
+}
+
+// TestingWriter is a WriteSyncer that writes to the given testing.TB.
+type TestingWriter struct {
+ t TestingT
+
+ // If true, the test will be marked as failed if this TestingWriter is
+ // ever used.
+ markFailed bool
+}
+
+// NewTestingWriter builds a new TestingWriter that writes to the given
+// testing.TB.
+//
+// Use this if you need more flexibility when creating *zap.Logger
+// than zaptest.NewLogger() provides.
+//
+// E.g., if you want to use custom core with zaptest.TestingWriter:
+//
+// encoder := newCustomEncoder()
+// writer := zaptest.NewTestingWriter(t)
+// level := zap.NewAtomicLevelAt(zapcore.DebugLevel)
+//
+// core := newCustomCore(encoder, writer, level)
+//
+// logger := zap.New(core, zap.AddCaller())
+func NewTestingWriter(t TestingT) TestingWriter {
+ return TestingWriter{t: t}
+}
+
+// WithMarkFailed returns a copy of this TestingWriter with markFailed set to
+// the provided value.
+func (w TestingWriter) WithMarkFailed(v bool) TestingWriter {
+ w.markFailed = v
+ return w
+}
+
+// Write writes bytes from p to the underlying testing.TB.
+func (w TestingWriter) Write(p []byte) (n int, err error) {
+ n = len(p)
+
+ // Strip trailing newline because t.Log always adds one.
+ p = bytes.TrimRight(p, "\n")
+
+ // Note: t.Log is safe for concurrent use.
+ w.t.Logf("%s", p)
+ if w.markFailed {
+ w.t.Fail()
+ }
+
+ return n, nil
+}
+
+// Sync commits the current contents (a no-op for TestingWriter).
+func (w TestingWriter) Sync() error {
+ return nil
+}
diff --git a/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go b/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go
new file mode 100644
index 0000000..a4ea7ec
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go
@@ -0,0 +1,39 @@
+// Copyright (c) 2017 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 observer
+
+import "go.uber.org/zap/zapcore"
+
+// An LoggedEntry is an encoding-agnostic representation of a log message.
+// Field availability is context dependant.
+type LoggedEntry struct {
+ zapcore.Entry
+ Context []zapcore.Field
+}
+
+// ContextMap returns a map for all fields in Context.
+func (e LoggedEntry) ContextMap() map[string]interface{} {
+ encoder := zapcore.NewMapObjectEncoder()
+ for _, f := range e.Context {
+ f.AddTo(encoder)
+ }
+ return encoder.Fields
+}
diff --git a/vendor/go.uber.org/zap/zaptest/observer/observer.go b/vendor/go.uber.org/zap/zaptest/observer/observer.go
new file mode 100644
index 0000000..f77f130
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/observer/observer.go
@@ -0,0 +1,196 @@
+// Copyright (c) 2016-2022 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 observer provides a zapcore.Core that keeps an in-memory,
+// encoding-agnostic representation of log entries. It's useful for
+// applications that want to unit test their log output without tying their
+// tests to a particular output encoding.
+package observer // import "go.uber.org/zap/zaptest/observer"
+
+import (
+ "strings"
+ "sync"
+ "time"
+
+ "go.uber.org/zap/internal"
+ "go.uber.org/zap/zapcore"
+)
+
+// ObservedLogs is a concurrency-safe, ordered collection of observed logs.
+type ObservedLogs struct {
+ mu sync.RWMutex
+ logs []LoggedEntry
+}
+
+// Len returns the number of items in the collection.
+func (o *ObservedLogs) Len() int {
+ o.mu.RLock()
+ n := len(o.logs)
+ o.mu.RUnlock()
+ return n
+}
+
+// All returns a copy of all the observed logs.
+func (o *ObservedLogs) All() []LoggedEntry {
+ o.mu.RLock()
+ ret := make([]LoggedEntry, len(o.logs))
+ copy(ret, o.logs)
+ o.mu.RUnlock()
+ return ret
+}
+
+// TakeAll returns a copy of all the observed logs, and truncates the observed
+// slice.
+func (o *ObservedLogs) TakeAll() []LoggedEntry {
+ o.mu.Lock()
+ ret := o.logs
+ o.logs = nil
+ o.mu.Unlock()
+ return ret
+}
+
+// AllUntimed returns a copy of all the observed logs, but overwrites the
+// observed timestamps with time.Time's zero value. This is useful when making
+// assertions in tests.
+func (o *ObservedLogs) AllUntimed() []LoggedEntry {
+ ret := o.All()
+ for i := range ret {
+ ret[i].Time = time.Time{}
+ }
+ return ret
+}
+
+// FilterLevelExact filters entries to those logged at exactly the given level.
+func (o *ObservedLogs) FilterLevelExact(level zapcore.Level) *ObservedLogs {
+ return o.Filter(func(e LoggedEntry) bool {
+ return e.Level == level
+ })
+}
+
+// FilterMessage filters entries to those that have the specified message.
+func (o *ObservedLogs) FilterMessage(msg string) *ObservedLogs {
+ return o.Filter(func(e LoggedEntry) bool {
+ return e.Message == msg
+ })
+}
+
+// FilterMessageSnippet filters entries to those that have a message containing the specified snippet.
+func (o *ObservedLogs) FilterMessageSnippet(snippet string) *ObservedLogs {
+ return o.Filter(func(e LoggedEntry) bool {
+ return strings.Contains(e.Message, snippet)
+ })
+}
+
+// FilterField filters entries to those that have the specified field.
+func (o *ObservedLogs) FilterField(field zapcore.Field) *ObservedLogs {
+ return o.Filter(func(e LoggedEntry) bool {
+ for _, ctxField := range e.Context {
+ if ctxField.Equals(field) {
+ return true
+ }
+ }
+ return false
+ })
+}
+
+// FilterFieldKey filters entries to those that have the specified key.
+func (o *ObservedLogs) FilterFieldKey(key string) *ObservedLogs {
+ return o.Filter(func(e LoggedEntry) bool {
+ for _, ctxField := range e.Context {
+ if ctxField.Key == key {
+ return true
+ }
+ }
+ return false
+ })
+}
+
+// Filter returns a copy of this ObservedLogs containing only those entries
+// for which the provided function returns true.
+func (o *ObservedLogs) Filter(keep func(LoggedEntry) bool) *ObservedLogs {
+ o.mu.RLock()
+ defer o.mu.RUnlock()
+
+ var filtered []LoggedEntry
+ for _, entry := range o.logs {
+ if keep(entry) {
+ filtered = append(filtered, entry)
+ }
+ }
+ return &ObservedLogs{logs: filtered}
+}
+
+func (o *ObservedLogs) add(log LoggedEntry) {
+ o.mu.Lock()
+ o.logs = append(o.logs, log)
+ o.mu.Unlock()
+}
+
+// New creates a new Core that buffers logs in memory (without any encoding).
+// It's particularly useful in tests.
+func New(enab zapcore.LevelEnabler) (zapcore.Core, *ObservedLogs) {
+ ol := &ObservedLogs{}
+ return &contextObserver{
+ LevelEnabler: enab,
+ logs: ol,
+ }, ol
+}
+
+type contextObserver struct {
+ zapcore.LevelEnabler
+ logs *ObservedLogs
+ context []zapcore.Field
+}
+
+var (
+ _ zapcore.Core = (*contextObserver)(nil)
+ _ internal.LeveledEnabler = (*contextObserver)(nil)
+)
+
+func (co *contextObserver) Level() zapcore.Level {
+ return zapcore.LevelOf(co.LevelEnabler)
+}
+
+func (co *contextObserver) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
+ if co.Enabled(ent.Level) {
+ return ce.AddCore(ent, co)
+ }
+ return ce
+}
+
+func (co *contextObserver) With(fields []zapcore.Field) zapcore.Core {
+ return &contextObserver{
+ LevelEnabler: co.LevelEnabler,
+ logs: co.logs,
+ context: append(co.context[:len(co.context):len(co.context)], fields...),
+ }
+}
+
+func (co *contextObserver) Write(ent zapcore.Entry, fields []zapcore.Field) error {
+ all := make([]zapcore.Field, 0, len(fields)+len(co.context))
+ all = append(all, co.context...)
+ all = append(all, fields...)
+ co.logs.add(LoggedEntry{ent, all})
+ return nil
+}
+
+func (co *contextObserver) Sync() error {
+ return nil
+}
diff --git a/vendor/go.uber.org/zap/zaptest/testingt.go b/vendor/go.uber.org/zap/zaptest/testingt.go
new file mode 100644
index 0000000..792463b
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/testingt.go
@@ -0,0 +1,47 @@
+// Copyright (c) 2017 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 zaptest
+
+// TestingT is a subset of the API provided by all *testing.T and *testing.B
+// objects.
+type TestingT interface {
+ // Logs the given message without failing the test.
+ Logf(string, ...interface{})
+
+ // Logs the given message and marks the test as failed.
+ Errorf(string, ...interface{})
+
+ // Marks the test as failed.
+ Fail()
+
+ // Returns true if the test has been marked as failed.
+ Failed() bool
+
+ // Returns the name of the test.
+ Name() string
+
+ // Marks the test as failed and stops execution of that test.
+ FailNow()
+}
+
+// Note: We currently only rely on Logf. We are including Errorf and FailNow
+// in the interface in anticipation of future need since we can't extend the
+// interface without a breaking change.
diff --git a/vendor/go.uber.org/zap/zaptest/timeout.go b/vendor/go.uber.org/zap/zaptest/timeout.go
new file mode 100644
index 0000000..f0be444
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/timeout.go
@@ -0,0 +1,45 @@
+// Copyright (c) 2016 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 zaptest
+
+import (
+ "time"
+
+ "go.uber.org/zap/internal/ztest"
+)
+
+// Timeout scales the provided duration by $TEST_TIMEOUT_SCALE.
+//
+// Deprecated: This function is intended for internal testing and shouldn't be
+// used outside zap itself. It was introduced before Go supported internal
+// packages.
+func Timeout(base time.Duration) time.Duration {
+ return ztest.Timeout(base)
+}
+
+// Sleep scales the sleep duration by $TEST_TIMEOUT_SCALE.
+//
+// Deprecated: This function is intended for internal testing and shouldn't be
+// used outside zap itself. It was introduced before Go supported internal
+// packages.
+func Sleep(base time.Duration) {
+ ztest.Sleep(base)
+}
diff --git a/vendor/go.uber.org/zap/zaptest/writer.go b/vendor/go.uber.org/zap/zaptest/writer.go
new file mode 100644
index 0000000..4b772f8
--- /dev/null
+++ b/vendor/go.uber.org/zap/zaptest/writer.go
@@ -0,0 +1,44 @@
+// Copyright (c) 2016 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 zaptest
+
+import "go.uber.org/zap/internal/ztest"
+
+type (
+ // A Syncer is a spy for the Sync portion of zapcore.WriteSyncer.
+ Syncer = ztest.Syncer
+
+ // A Discarder sends all writes to io.Discard.
+ Discarder = ztest.Discarder
+
+ // FailWriter is a WriteSyncer that always returns an error on writes.
+ FailWriter = ztest.FailWriter
+
+ // ShortWriter is a WriteSyncer whose write method never returns an error,
+ // but always reports that it wrote one byte less than the input slice's
+ // length (thus, a "short write").
+ ShortWriter = ztest.ShortWriter
+
+ // Buffer is an implementation of zapcore.WriteSyncer that sends all writes to
+ // a bytes.Buffer. It has convenience methods to split the accumulated buffer
+ // on newlines.
+ Buffer = ztest.Buffer
+)