mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-29 17:51:56 -06:00
6b1c9eafa9
### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: `Boris Rybalkin <ribalkin@gmail.com>` I need this for Syncloud project (https://github.com/syncloud/platform) where I run multiple apps behind an nginx on the same RPi like device so unix socket is very convenient to not have port conflicts between apps. Also someone opened this Issue: https://github.com/matrix-org/dendrite/issues/2924 --------- Co-authored-by: kegsay <kegan@matrix.org> Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
26 lines
561 B
Go
26 lines
561 B
Go
package config
|
|
|
|
import (
|
|
"io/fs"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestHttpAddress_ParseGood(t *testing.T) {
|
|
address, err := HTTPAddress("http://localhost:123")
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, "localhost:123", address.Address)
|
|
assert.Equal(t, "tcp", address.Network())
|
|
}
|
|
|
|
func TestHttpAddress_ParseBad(t *testing.T) {
|
|
_, err := HTTPAddress(":")
|
|
assert.Error(t, err)
|
|
}
|
|
|
|
func TestUnixSocketAddress_Network(t *testing.T) {
|
|
address := UnixSocketAddress("/tmp", fs.FileMode(0755))
|
|
assert.Equal(t, "unix", address.Network())
|
|
}
|