mirror of
https://github.com/luscis/openlan.git
synced 2025-10-09 02:20:11 +08:00
fea: config: add tests
This commit is contained in:
18
pkg/config/switch_test.go
Normal file
18
pkg/config/switch_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/luscis/openlan/pkg/libol"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSwitch(t *testing.T) {
|
||||
sw := Switch{}
|
||||
sw.Correct()
|
||||
assert.Equal(t, libol.INFO, sw.Log.Verbose, "be the same.")
|
||||
assert.Equal(t, "0.0.0.0:10002", sw.Listen, "be the same.")
|
||||
assert.Equal(t, "0.0.0.0:10000", sw.Http.Listen, "be the same.")
|
||||
sw.Listen = "192.168.1.0"
|
||||
sw.Correct()
|
||||
assert.Equal(t, "192.168.1.0:10002", sw.Listen, "be the same.")
|
||||
}
|
Reference in New Issue
Block a user