aboutsummaryrefslogtreecommitdiffstats
path: root/node/config_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-03 01:06:43 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-04 17:23:15 +0800
commit188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd (patch)
treeeaeebfbe371a9ae8e801bd934d7dd850c7354765 /node/config_test.go
parent3274db19c7563e31f79418b63f6c10233cbaa32a (diff)
downloadgo-tangerine-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.gz
go-tangerine-188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd.tar.zst
go-tangerine-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.go32
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) {