status-go/t/e2e/whisper/whisper_ext_test.go

46 lines
940 B
Go
Raw Normal View History

package whisper
import (
"fmt"
"io/ioutil"
"os"
"testing"
2020-01-02 09:10:19 +00:00
"github.com/stretchr/testify/suite"
"github.com/status-im/status-go/node"
"github.com/status-im/status-go/t/utils"
)
func TestWhisperExtensionSuite(t *testing.T) {
suite.Run(t, new(WhisperExtensionSuite))
}
type WhisperExtensionSuite struct {
suite.Suite
nodes []*node.StatusNode
}
func (s *WhisperExtensionSuite) SetupTest() {
s.nodes = make([]*node.StatusNode, 2)
for i := range s.nodes {
dir, err := ioutil.TempDir("", "test-shhext-")
s.NoError(err)
// network id is irrelevant
cfg, err := utils.MakeTestNodeConfigWithDataDir(fmt.Sprintf("test-shhext-%d", i), dir, 777)
s.Require().NoError(err)
s.nodes[i] = node.New()
s.Require().NoError(s.nodes[i].Start(cfg, nil))
}
}
func (s *WhisperExtensionSuite) TearDown() {
for _, n := range s.nodes {
cfg := n.Config()
s.NotNil(cfg)
s.NoError(n.Stop())
s.NoError(os.Remove(cfg.DataDir))
}
}