blob: 322eeee48873e7fca1e9c5ac3d84460f69f75867 [file] [log] [blame]
Scott Baker4989fe92019-10-09 17:03:06 -07001/*
2 * Portions copyright 2019-present Open Networking Foundation
3 * Original copyright 2019-present Ciena Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the"github.com/stretchr/testify/assert" "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package afrouter
18
19/*
20 * This file has common code that is imported for all test cases, but
21 * is not built into production binaries.
22 */
23
24import (
25 "github.com/opencord/voltha-go/common/log"
26)
27
28const (
29 TEST_PROTOFILE = "../../../vendor/github.com/opencord/voltha-protos/voltha.pb"
30
31 /*
32 * This sets the LogLevel of the Voltha logger. It's pinned to FatalLevel here, as we
33 * generally don't want to see logger output, even when running go test in verbose
34 * mode. Even "Error" level messages are expected to be output by some unit tests.
35 *
36 * If you are developing a unit test, and experiencing problems or wish additional
37 * debugging from Voltha, then changing this constant to log.DebugLevel may be
38 * useful.
39 */
40
41 VOLTHA_LOGLEVEL = log.FatalLevel
42)
43
44// Unit test initialization. This init() function will be run once for all unit tests in afrouter
45func init() {
46 // Logger must be configured or bad things happen
47 _, err := log.SetDefaultLogger(log.JSON, VOLTHA_LOGLEVEL, log.Fields{"instanceId": 1})
48 if err != nil {
49 panic(err)
50 }
51
52 _, err = log.AddPackage(log.JSON, VOLTHA_LOGLEVEL, nil)
53 if err != nil {
54 panic(err)
55 }
56}