diff --git a/cmd/XDC/consolecmd_test.go b/cmd/XDC/consolecmd_test.go index 258b9e6dd9..fc48d696c5 100644 --- a/cmd/XDC/consolecmd_test.go +++ b/cmd/XDC/consolecmd_test.go @@ -40,25 +40,25 @@ const ( func TestConsoleWelcome(t *testing.T) { coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" - // Start a geth console, make sure it's cleaned up and terminate the console - geth := runGeth(t, + // Start a XDC console, make sure it's cleaned up and terminate the console + XDC := runGeth(t, "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--etherbase", coinbase, "--shh", "console") // Gather all the infos the welcome message needs to contain - geth.SetTemplateFunc("goos", func() string { return runtime.GOOS }) - geth.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) - geth.SetTemplateFunc("gover", runtime.Version) - geth.SetTemplateFunc("gethver", func() string { return params.Version }) - geth.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) - geth.SetTemplateFunc("apis", func() string { return ipcAPIs }) + XDC.SetTemplateFunc("goos", func() string { return runtime.GOOS }) + XDC.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) + XDC.SetTemplateFunc("gover", runtime.Version) + XDC.SetTemplateFunc("gethver", func() string { return params.Version }) + XDC.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) + XDC.SetTemplateFunc("apis", func() string { return ipcAPIs }) // Verify the actual welcome message to the required template - geth.Expect(` -Welcome to the Geth JavaScript console! + XDC.Expect(` +Welcome to the XDC JavaScript console! -instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} +instance: XDC/v{{XDCver}}/{{goos}}-{{goarch}}/{{gover}} coinbase: {{.Etherbase}} at block: 0 ({{niltime}}) datadir: {{.Datadir}} @@ -66,7 +66,7 @@ at block: 0 ({{niltime}}) > {{.InputLine "exit"}} `) - geth.ExpectExit() + XDC.ExpectExit() } // Tests that a console can be attached to a running node via various means. @@ -75,56 +75,56 @@ func TestIPCAttachWelcome(t *testing.T) { coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" var ipc string if runtime.GOOS == "windows" { - ipc = `\\.\pipe\geth` + strconv.Itoa(trulyRandInt(100000, 999999)) + ipc = `\\.\pipe\XDC` + strconv.Itoa(trulyRandInt(100000, 999999)) } else { ws := tmpdir(t) defer os.RemoveAll(ws) - ipc = filepath.Join(ws, "geth.ipc") + ipc = filepath.Join(ws, "XDC.ipc") } // Note: we need --shh because testAttachWelcome checks for default // list of ipc modules and shh is included there. - geth := runGeth(t, + XDC := runGeth(t, "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--etherbase", coinbase, "--shh", "--ipcpath", ipc) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open - testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs) + testAttachWelcome(t, XDC, "ipc:"+ipc, ipcAPIs) - geth.Interrupt() - geth.ExpectExit() + XDC.Interrupt() + XDC.ExpectExit() } func TestHTTPAttachWelcome(t *testing.T) { coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P - geth := runGeth(t, + XDC := runGeth(t, "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--etherbase", coinbase, "--rpc", "--rpcport", port) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open - testAttachWelcome(t, geth, "http://localhost:"+port, httpAPIs) + testAttachWelcome(t, XDC, "http://localhost:"+port, httpAPIs) - geth.Interrupt() - geth.ExpectExit() + XDC.Interrupt() + XDC.ExpectExit() } func TestWSAttachWelcome(t *testing.T) { coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P - geth := runGeth(t, + XDC := runGeth(t, "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--etherbase", coinbase, "--ws", "--wsport", port) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open - testAttachWelcome(t, geth, "ws://localhost:"+port, httpAPIs) + testAttachWelcome(t, XDC, "ws://localhost:"+port, httpAPIs) - geth.Interrupt() - geth.ExpectExit() + XDC.Interrupt() + XDC.ExpectExit() } -func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) { - // Attach to a running geth note and terminate immediately +func testAttachWelcome(t *testing.T, XDC *testXDC, endpoint, apis string) { + // Attach to a running XDC note and terminate 1immediately attach := runGeth(t, "attach", endpoint) defer attach.ExpectExit() attach.CloseStdin() @@ -133,20 +133,20 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) { attach.SetTemplateFunc("goos", func() string { return runtime.GOOS }) attach.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) attach.SetTemplateFunc("gover", runtime.Version) - attach.SetTemplateFunc("gethver", func() string { return params.Version }) - attach.SetTemplateFunc("etherbase", func() string { return geth.Etherbase }) + attach.SetTemplateFunc("XDCver", func() string { return params.Version }) + attach.SetTemplateFunc("etherbase", func() string { return XDC.Etherbase }) attach.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") }) - attach.SetTemplateFunc("datadir", func() string { return geth.Datadir }) + attach.SetTemplateFunc("datadir", func() string { return XDC.Datadir }) attach.SetTemplateFunc("apis", func() string { return apis }) // Verify the actual welcome message to the required template attach.Expect(` -Welcome to the Geth JavaScript console! +Welcome to the XDC JavaScript console! -instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} +instance: XDC/v{{XDCver}}/{{goos}}-{{goarch}}/{{gover}} coinbase: {{etherbase}} -at block: 0 ({{niltime}}){{if ipc}} +at block: 0 ({{nil1time}}){{if ipc}} datadir: {{datadir}}{{end}} modules: {{apis}}