open-consul/agent/consul/logging_test.go
Ronald dd0e8eec14
copyright headers for agent folder (#16704)
* copyright headers for agent folder

* Ignore test data files

* fix proto files and remove headers in agent/uiserver folder

* ignore deep-copy files
2023-03-28 14:39:22 -04:00

45 lines
811 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package consul
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/hashicorp/consul/sdk/testutil"
)
func TestLoggerStore_Named(t *testing.T) {
t.Parallel()
logger := testutil.Logger(t)
store := newLoggerStore(logger)
require.NotNil(t, store)
l1 := store.Named("test1")
l2 := store.Named("test2")
require.Truef(t, l1 != l2,
"expected %p and %p to have a different memory address",
l1,
l2,
)
}
func TestLoggerStore_NamedCache(t *testing.T) {
t.Parallel()
logger := testutil.Logger(t)
store := newLoggerStore(logger)
require.NotNil(t, store)
l1 := store.Named("test")
l2 := store.Named("test")
require.Truef(t, l1 == l2,
"expected %p and %p to have the same memory address",
l1,
l2,
)
}