You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
715 B

  1. package addrbook_test
  2. import (
  3. "io/ioutil"
  4. "os"
  5. "path/filepath"
  6. "testing"
  7. "github.com/stretchr/testify/require"
  8. "github.com/tendermint/tendermint/test/fuzz/p2p/addrbook"
  9. )
  10. const testdataCasesDir = "testdata/cases"
  11. func TestAddrbookTestdataCases(t *testing.T) {
  12. entries, err := os.ReadDir(testdataCasesDir)
  13. require.NoError(t, err)
  14. for _, e := range entries {
  15. entry := e
  16. t.Run(entry.Name(), func(t *testing.T) {
  17. defer func() {
  18. r := recover()
  19. require.Nilf(t, r, "testdata/cases test panic")
  20. }()
  21. f, err := os.Open(filepath.Join(testdataCasesDir, entry.Name()))
  22. require.NoError(t, err)
  23. input, err := ioutil.ReadAll(f)
  24. require.NoError(t, err)
  25. addrbook.Fuzz(input)
  26. })
  27. }
  28. }