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
704 B

  1. package server_test
  2. import (
  3. "io"
  4. "os"
  5. "path/filepath"
  6. "testing"
  7. "github.com/stretchr/testify/require"
  8. "github.com/tendermint/tendermint/test/fuzz/rpc/jsonrpc/server"
  9. )
  10. const testdataCasesDir = "testdata/cases"
  11. func TestServerTestdataCases(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 := io.ReadAll(f)
  24. require.NoError(t, err)
  25. server.Fuzz(input)
  26. })
  27. }
  28. }