dd39318939cd64099d655fb5f9a448cd79123089
[icn/sdwan.git] /
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright (c) 2020 Intel Corporation
3
4 package config
5
6 import (
7         "testing"
8 )
9
10 func TestReadConfigurationFile(t *testing.T) {
11         t.Run("Non Existent Configuration File", func(t *testing.T) {
12                 _, err := readConfigFile("filedoesnotexist.json")
13                 if err == nil {
14                         t.Fatal("ReadConfiguationFile: Expected Error, got nil")
15                 }
16         })
17
18         t.Run("Read Configuration File", func(t *testing.T) {
19                 conf, err := readConfigFile("../../../tests/configs/mock_config.json")
20                 if err != nil {
21                         t.Fatal("ReadConfigurationFile: Error reading file: ", err)
22                 }
23                 if conf.DatabaseType != "mock_db_test" {
24                         t.Fatal("ReadConfigurationFile: Incorrect entry read from file")
25                 }
26         })
27 }