diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-02-03 01:06:43 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-02-04 17:23:15 +0800 |
commit | 188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd (patch) | |
tree | eaeebfbe371a9ae8e801bd934d7dd850c7354765 /node/config_test.go | |
parent | 3274db19c7563e31f79418b63f6c10233cbaa32a (diff) | |
download | dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.gz dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.bz2 dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.lz dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.xz dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.zst dexon-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.zip |
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) { |