@@ -3,108 +3,16 @@ package config
33import (
44 "context"
55 "testing"
6- "time"
76
8- "github.com/rs/zerolog"
97 "github.com/stretchr/testify/assert"
108)
119
12- // TestGetVerificationPolicy tests the GetVerificationPolicy function.
13- func TestGetVerificationPolicy (t * testing.T ) {
14- pluginConfig := PluginConfig {}
15- assert .Equal (t , PassDown , pluginConfig .GetVerificationPolicy ())
16- }
17-
18- // TestGetPluginCompatibilityPolicy tests the GetPluginCompatibilityPolicy function.
19- func TestGetPluginCompatibilityPolicy (t * testing.T ) {
20- pluginConfig := PluginConfig {}
21- assert .Equal (t , Strict , pluginConfig .GetPluginCompatibilityPolicy ())
22- }
23-
24- // TestGetAcceptancePolicy tests the GetAcceptancePolicy function.
25- func TestGetAcceptancePolicy (t * testing.T ) {
26- pluginConfig := PluginConfig {}
27- assert .Equal (t , Accept , pluginConfig .GetAcceptancePolicy ())
28- }
29-
30- // TestGetTerminationPolicy tests the GetTerminationPolicy function.
31- func TestGetTerminationPolicy (t * testing.T ) {
32- pluginConfig := PluginConfig {}
33- assert .Equal (t , Stop , pluginConfig .GetTerminationPolicy ())
34- }
35-
36- // TestGetTCPKeepAlivePeriod tests the GetTCPKeepAlivePeriod function.
37- func TestGetTCPKeepAlivePeriod (t * testing.T ) {
38- client := Client {}
39- assert .Equal (t , client .GetTCPKeepAlivePeriod (), time .Duration (0 ))
40- }
41-
42- // TestGetReceiveDeadline tests the GetReceiveDeadline function.
43- func TestGetReceiveDeadline (t * testing.T ) {
44- client := Client {}
45- assert .Equal (t , time .Duration (0 ), client .GetReceiveDeadline ())
46- }
47-
48- // TestGetReceiveTimeout tests the GetReceiveTimeout function.
49- func TestGetReceiveTimeout (t * testing.T ) {
50- client := Client {}
51- assert .Equal (t , time .Duration (0 ), client .GetReceiveTimeout ())
52- }
53-
54- // TestGetSendDeadline tests the GetSendDeadline function.
55- func TestGetSendDeadline (t * testing.T ) {
56- client := Client {}
57- assert .Equal (t , time .Duration (0 ), client .GetSendDeadline ())
58- }
59-
60- // TestGetReceiveChunkSize tests the GetReceiveChunkSize function.
61- func TestGetReceiveChunkSize (t * testing.T ) {
62- client := Client {}
63- assert .Equal (t , DefaultChunkSize , client .GetReceiveChunkSize ())
64- }
65-
66- // TestGetHealthCheckPeriod tests the GetHealthCheckPeriod function.
67- func TestGetHealthCheckPeriod (t * testing.T ) {
68- proxy := Proxy {}
69- assert .Equal (t , DefaultHealthCheckPeriod , proxy .GetHealthCheckPeriod ())
70- }
71-
72- // TestGetTickInterval tests the GetTickInterval function.
73- func TestGetTickInterval (t * testing.T ) {
74- server := Server {}
75- assert .Equal (t , server .GetTickInterval (), time .Duration (0 ))
76- }
77-
78- // TestGetSize tests the GetSize function.
79- func TestGetSize (t * testing.T ) {
80- pool := Pool {}
81- assert .Equal (t , DefaultPoolSize , pool .GetSize ())
82- }
83-
8410// TestGetOutput tests the GetOutput function.
8511func TestGetOutput (t * testing.T ) {
8612 logger := Logger {}
8713 assert .Equal (t , []LogOutput {Console }, logger .GetOutput ())
8814}
8915
90- // TestGetTimeFormat tests the GetTimeFormat function.
91- func TestGetTimeFormat (t * testing.T ) {
92- logger := Logger {}
93- assert .Equal (t , zerolog .TimeFormatUnix , logger .GetTimeFormat ())
94- }
95-
96- // TestGetConsoleTimeFormat tests the GetConsoleTimeFormat function.
97- func TestGetConsoleTimeFormat (t * testing.T ) {
98- logger := Logger {}
99- assert .Equal (t , time .RFC3339 , logger .GetConsoleTimeFormat ())
100- }
101-
102- // TestGetLevel tests the GetLevel function.
103- func TestGetLevel (t * testing.T ) {
104- logger := Logger {}
105- assert .Equal (t , zerolog .InfoLevel , logger .GetLevel ())
106- }
107-
10816// TestGetPlugins tests the GetPlugins function.
10917func TestGetPlugins (t * testing.T ) {
11018 plugin := Plugin {Name : "plugin1" }
@@ -117,18 +25,6 @@ func TestGetDefaultConfigFilePath(t *testing.T) {
11725 assert .Equal (t , GlobalConfigFilename , GetDefaultConfigFilePath (GlobalConfigFilename ))
11826}
11927
120- // TestGetReadTimeout tests the GetReadTimeout function.
121- func TestGetReadHeaderTimeout (t * testing.T ) {
122- metrics := Metrics {}
123- assert .Equal (t , metrics .GetReadHeaderTimeout (), time .Duration (0 ))
124- }
125-
126- // TestGetTimeout tests the GetTimeout function of the metrics server.
127- func TestGetTimeout (t * testing.T ) {
128- metrics := Metrics {}
129- assert .Equal (t , metrics .GetTimeout (), time .Duration (0 ))
130- }
131-
13228// TestFilter tests the Filter function.
13329func TestFilter (t * testing.T ) {
13430 // Load config from the default config file.
0 commit comments