mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
0d65071abc
6b4dd5703e
made it to be a uint16 which was
somewhat important for RPC, but now it's irrelevant and the fact that it was a
string in some cases may lead to errors like these:
failed to unmarshal config YAML: yaml: unmarshal errors:
line 48: cannot unmarshal !!str `20011` into uint16
line 52: cannot unmarshal !!str `40001` into uint16
So for maximum backwards compatibility we better have string here and
eventually it'll be deleted anyway.
29 lines
570 B
Go
29 lines
570 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestBasicService_GetAddresses(t *testing.T) {
|
|
addr := "1.2.3.4"
|
|
port := "1234"
|
|
s := BasicService{
|
|
Enabled: false,
|
|
Address: &addr,
|
|
Port: &port,
|
|
Addresses: []string{"1.2.3.4:1234", /* same as Address:Port */
|
|
"3.4.5.6:1234", "2.3.4.5", ":1235", "2.3.4.5:1234",
|
|
"3.4.5.6:1234" /* already in list */},
|
|
}
|
|
require.Equal(t, []string{
|
|
"1.2.3.4:1234",
|
|
"3.4.5.6:1234",
|
|
"2.3.4.5",
|
|
":1235",
|
|
"2.3.4.5:1234",
|
|
"3.4.5.6:1234",
|
|
"1.2.3.4:1234",
|
|
}, s.GetAddresses())
|
|
}
|