chore: add test for double stop

This commit is contained in:
Gabriel mermelstein 2025-07-24 16:11:23 +02:00
parent 2ed0a5f171
commit 90005c72dd
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D

View File

@ -95,3 +95,34 @@ func TestDoubleStart(t *testing.T) {
require.NoError(t, node.Start())
}
func TestDoubleStop(t *testing.T) {
tcpPort, udpPort, err := GetFreePortIfNeeded(0, 0)
require.NoError(t, err)
config := common.WakuConfig{
Relay: true,
Store: true,
LogLevel: "DEBUG",
Discv5Discovery: true,
ClusterID: 16,
Shards: []uint16{64},
Discv5UdpPort: udpPort,
TcpPort: tcpPort,
}
node, err := NewWakuNode(&config, "node")
require.NoError(t, err)
defer node.StopAndDestroy()
// start node
require.NoError(t, node.Start())
// stop node
require.NoError(t, node.Stop())
// now attempt to stop it again
require.NoError(t, node.Stop())
}