Scott Baker | 4989fe9 | 2019-10-09 17:03:06 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 17 | package 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 | |
| 24 | import ( |
Scott Baker | f579f13 | 2019-10-24 14:31:41 -0700 | [diff] [blame] | 25 | "github.com/opencord/voltha-lib-go/v2/pkg/log" |
Scott Baker | 4989fe9 | 2019-10-09 17:03:06 -0700 | [diff] [blame] | 26 | ) |
| 27 | |
| 28 | const ( |
Scott Baker | b6de7a5 | 2019-11-04 09:13:37 -0800 | [diff] [blame] | 29 | TEST_PROTOFILE = "../../../vendor/github.com/opencord/voltha-protos/v2/voltha.pb" |
Scott Baker | 4989fe9 | 2019-10-09 17:03:06 -0700 | [diff] [blame] | 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 |
| 45 | func 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 | } |