You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
469 B
22 lines
469 B
package log |
|
|
|
import ( |
|
"flag" |
|
"testing" |
|
"time" |
|
|
|
xtime "go-common/library/time" |
|
|
|
"github.com/stretchr/testify/assert" |
|
) |
|
|
|
func TestUnixParseDSN(t *testing.T) { |
|
dsn := "unix:///data/log/lancer.sock?chan=1024&timeout=5s" |
|
flag.Parse() |
|
flag.Set("log.stdout", "true") |
|
as := parseDSN(dsn) |
|
assert.Equal(t, "unix", as.Proto) |
|
assert.Equal(t, "/data/log/lancer.sock", as.Addr) |
|
assert.Equal(t, 1024, as.Chan) |
|
assert.Equal(t, xtime.Duration(5*time.Second), as.Timeout) |
|
}
|
|
|