2022-11-24 13:03:08 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2022-11-25 10:20:53 +00:00
|
|
|
func TestBasicService_GetAddresses(t *testing.T) {
|
|
|
|
addr := "1.2.3.4"
|
2022-12-07 18:16:12 +00:00
|
|
|
port := "1234"
|
2022-11-25 10:20:53 +00:00
|
|
|
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 */},
|
2022-11-24 13:03:08 +00:00
|
|
|
}
|
2022-11-25 10:20:53 +00:00
|
|
|
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())
|
2022-11-24 13:03:08 +00:00
|
|
|
}
|