-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_test.go
26 lines (22 loc) · 970 Bytes
/
config_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLoadConfig(t *testing.T) {
config, err := LoadConfig("sample.config.json")
require.NoError(t, err)
assert.Equal(t, 6, len(config.Nodes))
assert.Equal(t, 2, len(config.ApiUrls))
assert.Equal(t, true, config.Discover)
assert.Equal(t, uint64(1), config.HeightCheckInterval)
assert.Equal(t, true, config.Notify)
assert.Equal(t, 5, config.AlertConfig.OutOfSyncBlocksThreshold)
assert.Equal(t, 5, config.AlertConfig.OutOfSyncCriticalNodesThreshold)
assert.Equal(t, time.Duration(2*time.Hour), config.AlertConfig.getOfflineAlertRepeatInterval())
assert.Equal(t, time.Duration(5*time.Minute), config.AlertConfig.getOfflineDurationThreshold())
assert.Equal(t, time.Duration(2*time.Hour), config.AlertConfig.getSyncAlertRepeatInterval())
assert.Equal(t, time.Duration(10*time.Minute), config.AlertConfig.getStuckDurationThreshold())
}