diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-02-05 17:33:24 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-02-05 17:33:24 +0800 |
commit | ba7c125153ce1be30985784a18edf38645406d03 (patch) | |
tree | 92c1e2b8ec6ef0d4b39381148b3497e311e80b95 /node/config_test.go | |
parent | 212828963172b3921827df15abdc8602480e947d (diff) | |
parent | 188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd (diff) | |
download | dexon-ba7c125153ce1be30985784a18edf38645406d03.tar dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.gz dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.bz2 dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.lz dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.xz dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.zst dexon-ba7c125153ce1be30985784a18edf38645406d03.zip |
Merge pull request #2168 from karalabe/move-rpc-into-node
cmd, common, node, rpc: move IPC into the node itself
Diffstat (limited to 'node/config_test.go')
-rw-r--r-- | node/config_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/node/config_test.go b/node/config_test.go index f59f3c0fe..efb864ce4 100644 --- a/node/config_test.go +++ b/node/config_test.go @@ -21,6 +21,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "testing" "github.com/ethereum/go-ethereum/crypto" @@ -60,6 +61,37 @@ func TestDatadirCreation(t *testing.T) { } } +// Tests that IPC paths are correctly resolved to valid endpoints of different +// platforms. +func TestIpcPathResolution(t *testing.T) { + var tests = []struct { + DataDir string + IpcPath string + Windows bool + Endpoint string + }{ + {"", "", false, ""}, + {"data", "", false, ""}, + {"", "geth.ipc", false, filepath.Join(os.TempDir(), "geth.ipc")}, + {"data", "geth.ipc", false, "data/geth.ipc"}, + {"data", "./geth.ipc", false, "./geth.ipc"}, + {"data", "/geth.ipc", false, "/geth.ipc"}, + {"", "", true, ``}, + {"data", "", true, ``}, + {"", "geth.ipc", true, `\\.\pipe\geth.ipc`}, + {"data", "geth.ipc", true, `\\.\pipe\geth.ipc`}, + {"data", `\\.\pipe\geth.ipc`, true, `\\.\pipe\geth.ipc`}, + } + for i, test := range tests { + // Only run when platform/test match + if (runtime.GOOS == "windows") == test.Windows { + if endpoint := (&Config{DataDir: test.DataDir, IpcPath: test.IpcPath}).IpcEndpoint(); endpoint != test.Endpoint { + t.Errorf("test %d: IPC endpoint mismatch: have %s, want %s", i, endpoint, test.Endpoint) + } + } + } +} + // Tests that node keys can be correctly created, persisted, loaded and/or made // ephemeral. func TestNodeKeyPersistency(t *testing.T) { |