cmd: run tests in parallel (#28546)

pull/28559/head
Håvard Anda Estensen 1 year ago committed by GitHub
parent 14a1e96b68
commit 460cc1673e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      cmd/abigen/namefilter_test.go
  2. 13
      cmd/clef/consolecmd_test.go
  3. 2
      cmd/devp2p/dns_route53_test.go
  4. 2
      cmd/devp2p/internal/ethtest/chain_test.go
  5. 2
      cmd/devp2p/internal/ethtest/suite_test.go
  6. 1
      cmd/ethkey/message_test.go
  7. 3
      cmd/evm/t8n_test.go
  8. 1
      cmd/faucet/faucet_test.go
  9. 16
      cmd/geth/accountcmd_test.go
  10. 1
      cmd/geth/consolecmd_test.go
  11. 1
      cmd/geth/exportcmd_test.go
  12. 1
      cmd/geth/les_test.go
  13. 4
      cmd/geth/logging_test.go
  14. 9
      cmd/geth/version_check_test.go
  15. 2
      cmd/rlpdump/rlpdump_test.go
  16. 1
      cmd/utils/export_test.go
  17. 3
      cmd/utils/flags_test.go
  18. 3
      cmd/utils/prompt_test.go

@ -8,6 +8,7 @@ import (
) )
func TestNameFilter(t *testing.T) { func TestNameFilter(t *testing.T) {
t.Parallel()
_, err := newNameFilter("Foo") _, err := newNameFilter("Foo")
require.Error(t, err) require.Error(t, err)
_, err = newNameFilter("too/many:colons:Foo") _, err = newNameFilter("too/many:colons:Foo")

@ -26,12 +26,13 @@ import (
// TestImportRaw tests clef --importraw // TestImportRaw tests clef --importraw
func TestImportRaw(t *testing.T) { func TestImportRaw(t *testing.T) {
t.Parallel()
keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name())) keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name()))
os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777) os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777)
t.Cleanup(func() { os.Remove(keyPath) }) t.Cleanup(func() { os.Remove(keyPath) })
t.Parallel()
t.Run("happy-path", func(t *testing.T) { t.Run("happy-path", func(t *testing.T) {
t.Parallel()
// Run clef importraw // Run clef importraw
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("myverylongpassword").input("myverylongpassword") clef.input("myverylongpassword").input("myverylongpassword")
@ -43,6 +44,7 @@ func TestImportRaw(t *testing.T) {
}) })
// tests clef --importraw with mismatched passwords. // tests clef --importraw with mismatched passwords.
t.Run("pw-mismatch", func(t *testing.T) { t.Run("pw-mismatch", func(t *testing.T) {
t.Parallel()
// Run clef importraw // Run clef importraw
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("myverylongpassword1").input("myverylongpassword2").WaitExit() clef.input("myverylongpassword1").input("myverylongpassword2").WaitExit()
@ -52,6 +54,7 @@ func TestImportRaw(t *testing.T) {
}) })
// tests clef --importraw with a too short password. // tests clef --importraw with a too short password.
t.Run("short-pw", func(t *testing.T) { t.Run("short-pw", func(t *testing.T) {
t.Parallel()
// Run clef importraw // Run clef importraw
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("shorty").input("shorty").WaitExit() clef.input("shorty").input("shorty").WaitExit()
@ -64,12 +67,13 @@ func TestImportRaw(t *testing.T) {
// TestListAccounts tests clef --list-accounts // TestListAccounts tests clef --list-accounts
func TestListAccounts(t *testing.T) { func TestListAccounts(t *testing.T) {
t.Parallel()
keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name())) keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name()))
os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777) os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777)
t.Cleanup(func() { os.Remove(keyPath) }) t.Cleanup(func() { os.Remove(keyPath) })
t.Parallel()
t.Run("no-accounts", func(t *testing.T) { t.Run("no-accounts", func(t *testing.T) {
t.Parallel()
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "list-accounts") clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "list-accounts")
if out := string(clef.Output()); !strings.Contains(out, "The keystore is empty.") { if out := string(clef.Output()); !strings.Contains(out, "The keystore is empty.") {
t.Logf("Output\n%v", out) t.Logf("Output\n%v", out)
@ -77,6 +81,7 @@ func TestListAccounts(t *testing.T) {
} }
}) })
t.Run("one-account", func(t *testing.T) { t.Run("one-account", func(t *testing.T) {
t.Parallel()
// First, we need to import // First, we need to import
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("myverylongpassword").input("myverylongpassword").WaitExit() clef.input("myverylongpassword").input("myverylongpassword").WaitExit()
@ -91,12 +96,13 @@ func TestListAccounts(t *testing.T) {
// TestListWallets tests clef --list-wallets // TestListWallets tests clef --list-wallets
func TestListWallets(t *testing.T) { func TestListWallets(t *testing.T) {
t.Parallel()
keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name())) keyPath := filepath.Join(os.TempDir(), fmt.Sprintf("%v-tempkey.test", t.Name()))
os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777) os.WriteFile(keyPath, []byte("0102030405060708090a0102030405060708090a0102030405060708090a0102"), 0777)
t.Cleanup(func() { os.Remove(keyPath) }) t.Cleanup(func() { os.Remove(keyPath) })
t.Parallel()
t.Run("no-accounts", func(t *testing.T) { t.Run("no-accounts", func(t *testing.T) {
t.Parallel()
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "list-wallets") clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "list-wallets")
if out := string(clef.Output()); !strings.Contains(out, "There are no wallets.") { if out := string(clef.Output()); !strings.Contains(out, "There are no wallets.") {
t.Logf("Output\n%v", out) t.Logf("Output\n%v", out)
@ -104,6 +110,7 @@ func TestListWallets(t *testing.T) {
} }
}) })
t.Run("one-account", func(t *testing.T) { t.Run("one-account", func(t *testing.T) {
t.Parallel()
// First, we need to import // First, we need to import
clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath) clef := runClef(t, "--suppress-bootwarn", "--lightkdf", "importraw", keyPath)
clef.input("myverylongpassword").input("myverylongpassword").WaitExit() clef.input("myverylongpassword").input("myverylongpassword").WaitExit()

@ -26,6 +26,7 @@ import (
// This test checks that computeChanges/splitChanges create DNS changes in // This test checks that computeChanges/splitChanges create DNS changes in
// leaf-added -> root-changed -> leaf-deleted order. // leaf-added -> root-changed -> leaf-deleted order.
func TestRoute53ChangeSort(t *testing.T) { func TestRoute53ChangeSort(t *testing.T) {
t.Parallel()
testTree0 := map[string]recordSet{ testTree0 := map[string]recordSet{
"2kfjogvxdqtxxugbh7gs7naaai.n": {ttl: 3333, values: []string{ "2kfjogvxdqtxxugbh7gs7naaai.n": {ttl: 3333, values: []string{
`"enr:-HW4QO1ml1DdXLeZLsUxewnthhUy8eROqkDyoMTyavfks9JlYQIlMFEUoM78PovJDPQrAkrb3LRJ-""vtrymDguKCOIAWAgmlkgnY0iXNlY3AyNTZrMaEDffaGfJzgGhUif1JqFruZlYmA31HzathLSWxfbq_QoQ4"`, `"enr:-HW4QO1ml1DdXLeZLsUxewnthhUy8eROqkDyoMTyavfks9JlYQIlMFEUoM78PovJDPQrAkrb3LRJ-""vtrymDguKCOIAWAgmlkgnY0iXNlY3AyNTZrMaEDffaGfJzgGhUif1JqFruZlYmA31HzathLSWxfbq_QoQ4"`,
@ -164,6 +165,7 @@ func TestRoute53ChangeSort(t *testing.T) {
// This test checks that computeChanges compares the quoted value of the records correctly. // This test checks that computeChanges compares the quoted value of the records correctly.
func TestRoute53NoChange(t *testing.T) { func TestRoute53NoChange(t *testing.T) {
t.Parallel()
// Existing record set. // Existing record set.
testTree0 := map[string]recordSet{ testTree0 := map[string]recordSet{
"n": {ttl: rootTTL, values: []string{ "n": {ttl: rootTTL, values: []string{

@ -30,6 +30,7 @@ import (
// TestEthProtocolNegotiation tests whether the test suite // TestEthProtocolNegotiation tests whether the test suite
// can negotiate the highest eth protocol in a status message exchange // can negotiate the highest eth protocol in a status message exchange
func TestEthProtocolNegotiation(t *testing.T) { func TestEthProtocolNegotiation(t *testing.T) {
t.Parallel()
var tests = []struct { var tests = []struct {
conn *Conn conn *Conn
caps []p2p.Cap caps []p2p.Cap
@ -125,6 +126,7 @@ func TestEthProtocolNegotiation(t *testing.T) {
// TestChain_GetHeaders tests whether the test suite can correctly // TestChain_GetHeaders tests whether the test suite can correctly
// respond to a GetBlockHeaders request from a node. // respond to a GetBlockHeaders request from a node.
func TestChain_GetHeaders(t *testing.T) { func TestChain_GetHeaders(t *testing.T) {
t.Parallel()
chainFile, err := filepath.Abs("./testdata/chain.rlp") chainFile, err := filepath.Abs("./testdata/chain.rlp")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

@ -35,6 +35,7 @@ var (
) )
func TestEthSuite(t *testing.T) { func TestEthSuite(t *testing.T) {
t.Parallel()
geth, err := runGeth() geth, err := runGeth()
if err != nil { if err != nil {
t.Fatalf("could not run geth: %v", err) t.Fatalf("could not run geth: %v", err)
@ -56,6 +57,7 @@ func TestEthSuite(t *testing.T) {
} }
func TestSnapSuite(t *testing.T) { func TestSnapSuite(t *testing.T) {
t.Parallel()
geth, err := runGeth() geth, err := runGeth()
if err != nil { if err != nil {
t.Fatalf("could not run geth: %v", err) t.Fatalf("could not run geth: %v", err)

@ -22,6 +22,7 @@ import (
) )
func TestMessageSignVerify(t *testing.T) { func TestMessageSignVerify(t *testing.T) {
t.Parallel()
tmpdir := t.TempDir() tmpdir := t.TempDir()
keyfile := filepath.Join(tmpdir, "the-keyfile") keyfile := filepath.Join(tmpdir, "the-keyfile")

@ -106,6 +106,7 @@ func (args *t8nOutput) get() (out []string) {
} }
func TestT8n(t *testing.T) { func TestT8n(t *testing.T) {
t.Parallel()
tt := new(testT8n) tt := new(testT8n)
tt.TestCmd = cmdtest.NewTestCmd(t, tt) tt.TestCmd = cmdtest.NewTestCmd(t, tt)
for i, tc := range []struct { for i, tc := range []struct {
@ -338,6 +339,7 @@ func (args *t9nInput) get(base string) []string {
} }
func TestT9n(t *testing.T) { func TestT9n(t *testing.T) {
t.Parallel()
tt := new(testT8n) tt := new(testT8n)
tt.TestCmd = cmdtest.NewTestCmd(t, tt) tt.TestCmd = cmdtest.NewTestCmd(t, tt)
for i, tc := range []struct { for i, tc := range []struct {
@ -473,6 +475,7 @@ func (args *b11rInput) get(base string) []string {
} }
func TestB11r(t *testing.T) { func TestB11r(t *testing.T) {
t.Parallel()
tt := new(testT8n) tt := new(testT8n)
tt.TestCmd = cmdtest.NewTestCmd(t, tt) tt.TestCmd = cmdtest.NewTestCmd(t, tt)
for i, tc := range []struct { for i, tc := range []struct {

@ -23,6 +23,7 @@ import (
) )
func TestFacebook(t *testing.T) { func TestFacebook(t *testing.T) {
t.Parallel()
// TODO: Remove facebook auth or implement facebook api, which seems to require an API key // TODO: Remove facebook auth or implement facebook api, which seems to require an API key
t.Skipf("The facebook access is flaky, needs to be reimplemented or removed") t.Skipf("The facebook access is flaky, needs to be reimplemented or removed")
for _, tt := range []struct { for _, tt := range []struct {

@ -43,11 +43,13 @@ func tmpDatadirWithKeystore(t *testing.T) string {
} }
func TestAccountListEmpty(t *testing.T) { func TestAccountListEmpty(t *testing.T) {
t.Parallel()
geth := runGeth(t, "account", "list") geth := runGeth(t, "account", "list")
geth.ExpectExit() geth.ExpectExit()
} }
func TestAccountList(t *testing.T) { func TestAccountList(t *testing.T) {
t.Parallel()
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
var want = ` var want = `
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8 Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
@ -74,6 +76,7 @@ Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}\k
} }
func TestAccountNew(t *testing.T) { func TestAccountNew(t *testing.T) {
t.Parallel()
geth := runGeth(t, "account", "new", "--lightkdf") geth := runGeth(t, "account", "new", "--lightkdf")
defer geth.ExpectExit() defer geth.ExpectExit()
geth.Expect(` geth.Expect(`
@ -96,6 +99,7 @@ Path of the secret key file: .*UTC--.+--[0-9a-f]{40}
} }
func TestAccountImport(t *testing.T) { func TestAccountImport(t *testing.T) {
t.Parallel()
tests := []struct{ name, key, output string }{ tests := []struct{ name, key, output string }{
{ {
name: "correct account", name: "correct account",
@ -118,6 +122,7 @@ func TestAccountImport(t *testing.T) {
} }
func TestAccountHelp(t *testing.T) { func TestAccountHelp(t *testing.T) {
t.Parallel()
geth := runGeth(t, "account", "-h") geth := runGeth(t, "account", "-h")
geth.WaitExit() geth.WaitExit()
if have, want := geth.ExitStatus(), 0; have != want { if have, want := geth.ExitStatus(), 0; have != want {
@ -147,6 +152,7 @@ func importAccountWithExpect(t *testing.T, key string, expected string) {
} }
func TestAccountNewBadRepeat(t *testing.T) { func TestAccountNewBadRepeat(t *testing.T) {
t.Parallel()
geth := runGeth(t, "account", "new", "--lightkdf") geth := runGeth(t, "account", "new", "--lightkdf")
defer geth.ExpectExit() defer geth.ExpectExit()
geth.Expect(` geth.Expect(`
@ -159,6 +165,7 @@ Fatal: Passwords do not match
} }
func TestAccountUpdate(t *testing.T) { func TestAccountUpdate(t *testing.T) {
t.Parallel()
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, "account", "update", geth := runGeth(t, "account", "update",
"--datadir", datadir, "--lightkdf", "--datadir", datadir, "--lightkdf",
@ -175,6 +182,7 @@ Repeat password: {{.InputLine "foobar2"}}
} }
func TestWalletImport(t *testing.T) { func TestWalletImport(t *testing.T) {
t.Parallel()
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json")
defer geth.ExpectExit() defer geth.ExpectExit()
geth.Expect(` geth.Expect(`
@ -190,6 +198,7 @@ Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
} }
func TestWalletImportBadPassword(t *testing.T) { func TestWalletImportBadPassword(t *testing.T) {
t.Parallel()
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json")
defer geth.ExpectExit() defer geth.ExpectExit()
geth.Expect(` geth.Expect(`
@ -200,6 +209,7 @@ Fatal: could not decrypt key with given password
} }
func TestUnlockFlag(t *testing.T) { func TestUnlockFlag(t *testing.T) {
t.Parallel()
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')")
geth.Expect(` geth.Expect(`
@ -222,6 +232,7 @@ undefined
} }
func TestUnlockFlagWrongPassword(t *testing.T) { func TestUnlockFlagWrongPassword(t *testing.T) {
t.Parallel()
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')")
@ -240,6 +251,7 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could
// https://github.com/ethereum/go-ethereum/issues/1785 // https://github.com/ethereum/go-ethereum/issues/1785
func TestUnlockFlagMultiIndex(t *testing.T) { func TestUnlockFlagMultiIndex(t *testing.T) {
t.Parallel()
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')")
@ -266,6 +278,7 @@ undefined
} }
func TestUnlockFlagPasswordFile(t *testing.T) { func TestUnlockFlagPasswordFile(t *testing.T) {
t.Parallel()
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "testdata/passwords.txt", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "testdata/passwords.txt", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')")
@ -287,6 +300,7 @@ undefined
} }
func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) { func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) {
t.Parallel()
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password",
"testdata/wrong-passwords.txt", "--unlock", "0,2") "testdata/wrong-passwords.txt", "--unlock", "0,2")
@ -297,6 +311,7 @@ Fatal: Failed to unlock account 0 (could not decrypt key with given password)
} }
func TestUnlockFlagAmbiguous(t *testing.T) { func TestUnlockFlagAmbiguous(t *testing.T) {
t.Parallel()
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes")
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore",
@ -336,6 +351,7 @@ undefined
} }
func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) { func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) {
t.Parallel()
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes")
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t),
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore",

@ -50,6 +50,7 @@ func runMinimalGeth(t *testing.T, args ...string) *testgeth {
// Tests that a node embedded within a console can be started up properly and // Tests that a node embedded within a console can be started up properly and
// then terminated by closing the input stream. // then terminated by closing the input stream.
func TestConsoleWelcome(t *testing.T) { func TestConsoleWelcome(t *testing.T) {
t.Parallel()
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
// Start a geth console, make sure it's cleaned up and terminate the console // Start a geth console, make sure it's cleaned up and terminate the console

@ -27,6 +27,7 @@ import (
// TestExport does a basic test of "geth export", exporting the test-genesis. // TestExport does a basic test of "geth export", exporting the test-genesis.
func TestExport(t *testing.T) { func TestExport(t *testing.T) {
t.Parallel()
outfile := fmt.Sprintf("%v/testExport.out", os.TempDir()) outfile := fmt.Sprintf("%v/testExport.out", os.TempDir())
defer os.Remove(outfile) defer os.Remove(outfile)
geth := runGeth(t, "--datadir", initGeth(t), "export", outfile) geth := runGeth(t, "--datadir", initGeth(t), "export", outfile)

@ -156,6 +156,7 @@ func startClient(t *testing.T, name string) *gethrpc {
} }
func TestPriorityClient(t *testing.T) { func TestPriorityClient(t *testing.T) {
t.Parallel()
lightServer := startLightServer(t) lightServer := startLightServer(t)
defer lightServer.killAndWait() defer lightServer.killAndWait()

@ -58,6 +58,7 @@ func censor(input string, start, end int) string {
} }
func TestLogging(t *testing.T) { func TestLogging(t *testing.T) {
t.Parallel()
testConsoleLogging(t, "terminal", 6, 24) testConsoleLogging(t, "terminal", 6, 24)
testConsoleLogging(t, "logfmt", 2, 26) testConsoleLogging(t, "logfmt", 2, 26)
} }
@ -98,6 +99,7 @@ func testConsoleLogging(t *testing.T, format string, tStart, tEnd int) {
} }
func TestVmodule(t *testing.T) { func TestVmodule(t *testing.T) {
t.Parallel()
checkOutput := func(level int, want, wantNot string) { checkOutput := func(level int, want, wantNot string) {
t.Helper() t.Helper()
output, err := runSelf("--log.format", "terminal", "--verbosity=0", "--log.vmodule", fmt.Sprintf("logtestcmd_active.go=%d", level), "logtest") output, err := runSelf("--log.format", "terminal", "--verbosity=0", "--log.vmodule", fmt.Sprintf("logtestcmd_active.go=%d", level), "logtest")
@ -145,6 +147,7 @@ func nicediff(have, want []byte) string {
} }
func TestFileOut(t *testing.T) { func TestFileOut(t *testing.T) {
t.Parallel()
var ( var (
have, want []byte have, want []byte
err error err error
@ -165,6 +168,7 @@ func TestFileOut(t *testing.T) {
} }
func TestRotatingFileOut(t *testing.T) { func TestRotatingFileOut(t *testing.T) {
t.Parallel()
var ( var (
have, want []byte have, want []byte
err error err error

@ -30,14 +30,17 @@ import (
) )
func TestVerification(t *testing.T) { func TestVerification(t *testing.T) {
t.Parallel()
// Signatures generated with `minisign`. Legacy format, not pre-hashed file. // Signatures generated with `minisign`. Legacy format, not pre-hashed file.
t.Run("minisig-legacy", func(t *testing.T) { t.Run("minisig-legacy", func(t *testing.T) {
t.Parallel()
// For this test, the pubkey is in testdata/vcheck/minisign.pub // For this test, the pubkey is in testdata/vcheck/minisign.pub
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp" pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp"
testVerification(t, pub, "./testdata/vcheck/minisig-sigs/") testVerification(t, pub, "./testdata/vcheck/minisig-sigs/")
}) })
t.Run("minisig-new", func(t *testing.T) { t.Run("minisig-new", func(t *testing.T) {
t.Parallel()
// For this test, the pubkey is in testdata/vcheck/minisign.pub // For this test, the pubkey is in testdata/vcheck/minisign.pub
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
// `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig` // `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig`
@ -46,6 +49,7 @@ func TestVerification(t *testing.T) {
}) })
// Signatures generated with `signify-openbsd` // Signatures generated with `signify-openbsd`
t.Run("signify-openbsd", func(t *testing.T) { t.Run("signify-openbsd", func(t *testing.T) {
t.Parallel()
t.Skip("This currently fails, minisign expects 4 lines of data, signify provides only 2") t.Skip("This currently fails, minisign expects 4 lines of data, signify provides only 2")
// For this test, the pubkey is in testdata/vcheck/signifykey.pub // For this test, the pubkey is in testdata/vcheck/signifykey.pub
// (the privkey is `signifykey.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `signifykey.sec`, if we want to expand this test. Password 'test' )
@ -97,6 +101,7 @@ func versionUint(v string) int {
// TestMatching can be used to check that the regexps are correct // TestMatching can be used to check that the regexps are correct
func TestMatching(t *testing.T) { func TestMatching(t *testing.T) {
t.Parallel()
data, _ := os.ReadFile("./testdata/vcheck/vulnerabilities.json") data, _ := os.ReadFile("./testdata/vcheck/vulnerabilities.json")
var vulns []vulnJson var vulns []vulnJson
if err := json.Unmarshal(data, &vulns); err != nil { if err := json.Unmarshal(data, &vulns); err != nil {
@ -141,6 +146,7 @@ func TestMatching(t *testing.T) {
} }
func TestGethPubKeysParseable(t *testing.T) { func TestGethPubKeysParseable(t *testing.T) {
t.Parallel()
for _, pubkey := range gethPubKeys { for _, pubkey := range gethPubKeys {
_, err := minisign.NewPublicKey(pubkey) _, err := minisign.NewPublicKey(pubkey)
if err != nil { if err != nil {
@ -150,6 +156,7 @@ func TestGethPubKeysParseable(t *testing.T) {
} }
func TestKeyID(t *testing.T) { func TestKeyID(t *testing.T) {
t.Parallel()
type args struct { type args struct {
id [8]byte id [8]byte
} }
@ -163,7 +170,9 @@ func TestKeyID(t *testing.T) {
{"third key", args{id: extractKeyId(gethPubKeys[2])}, "FD9813B2D2098484"}, {"third key", args{id: extractKeyId(gethPubKeys[2])}, "FD9813B2D2098484"},
} }
for _, tt := range tests { for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := keyID(tt.args.id); got != tt.want { if got := keyID(tt.args.id); got != tt.want {
t.Errorf("keyID() = %v, want %v", got, tt.want) t.Errorf("keyID() = %v, want %v", got, tt.want)
} }

@ -27,6 +27,7 @@ import (
) )
func TestRoundtrip(t *testing.T) { func TestRoundtrip(t *testing.T) {
t.Parallel()
for i, want := range []string{ for i, want := range []string{
"0xf880806482520894d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0a1010000000000000000000000000000000000000000000000000000000000000001801ba0c16787a8e25e941d67691954642876c08f00996163ae7dfadbbfd6cd436f549da06180e5626cae31590f40641fe8f63734316c4bfeb4cdfab6714198c1044d2e28", "0xf880806482520894d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0a1010000000000000000000000000000000000000000000000000000000000000001801ba0c16787a8e25e941d67691954642876c08f00996163ae7dfadbbfd6cd436f549da06180e5626cae31590f40641fe8f63734316c4bfeb4cdfab6714198c1044d2e28",
"0xd5c0d3cb84746573742a2a808213378667617a6f6e6b", "0xd5c0d3cb84746573742a2a808213378667617a6f6e6b",
@ -51,6 +52,7 @@ func TestRoundtrip(t *testing.T) {
} }
func TestTextToRlp(t *testing.T) { func TestTextToRlp(t *testing.T) {
t.Parallel()
type tc struct { type tc struct {
text string text string
want string want string

@ -170,6 +170,7 @@ func testDeletion(t *testing.T, f string) {
// TestImportFutureFormat tests that we reject unsupported future versions. // TestImportFutureFormat tests that we reject unsupported future versions.
func TestImportFutureFormat(t *testing.T) { func TestImportFutureFormat(t *testing.T) {
t.Parallel()
f := fmt.Sprintf("%v/tempdump-future", os.TempDir()) f := fmt.Sprintf("%v/tempdump-future", os.TempDir())
defer func() { defer func() {
os.Remove(f) os.Remove(f)

@ -23,6 +23,7 @@ import (
) )
func Test_SplitTagsFlag(t *testing.T) { func Test_SplitTagsFlag(t *testing.T) {
t.Parallel()
tests := []struct { tests := []struct {
name string name string
args string args string
@ -55,7 +56,9 @@ func Test_SplitTagsFlag(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := SplitTagsFlag(tt.args); !reflect.DeepEqual(got, tt.want) { if got := SplitTagsFlag(tt.args); !reflect.DeepEqual(got, tt.want) {
t.Errorf("splitTagsFlag() = %v, want %v", got, tt.want) t.Errorf("splitTagsFlag() = %v, want %v", got, tt.want)
} }

@ -22,6 +22,7 @@ import (
) )
func TestGetPassPhraseWithList(t *testing.T) { func TestGetPassPhraseWithList(t *testing.T) {
t.Parallel()
type args struct { type args struct {
text string text string
confirmation bool confirmation bool
@ -65,7 +66,9 @@ func TestGetPassPhraseWithList(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := GetPassPhraseWithList(tt.args.text, tt.args.confirmation, tt.args.index, tt.args.passwords); got != tt.want { if got := GetPassPhraseWithList(tt.args.text, tt.args.confirmation, tt.args.index, tt.args.passwords); got != tt.want {
t.Errorf("GetPassPhraseWithList() = %v, want %v", got, tt.want) t.Errorf("GetPassPhraseWithList() = %v, want %v", got, tt.want)
} }

Loading…
Cancel
Save