2023-02-09 12:16:36 +01:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
busTesting "forge.cadoles.com/arcad/edge/pkg/bus/testing"
|
2023-11-28 16:35:49 +01:00
|
|
|
"gitlab.com/wpetit/goweb/logger"
|
|
|
|
"go.uber.org/goleak"
|
2023-02-09 12:16:36 +01:00
|
|
|
)
|
|
|
|
|
2023-11-28 16:35:49 +01:00
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
goleak.VerifyTestMain(m)
|
|
|
|
}
|
|
|
|
|
2023-02-09 12:16:36 +01:00
|
|
|
func TestMemoryBus(t *testing.T) {
|
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("Test disabled when -short flag is set")
|
|
|
|
}
|
|
|
|
|
2023-11-28 16:35:49 +01:00
|
|
|
if testing.Verbose() {
|
|
|
|
logger.SetLevel(logger.LevelDebug)
|
|
|
|
}
|
|
|
|
|
2023-02-09 12:16:36 +01:00
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
t.Run("PublishSubscribe", func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
b := NewBus()
|
|
|
|
busTesting.TestPublishSubscribe(t, b)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("RequestReply", func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
b := NewBus()
|
|
|
|
busTesting.TestRequestReply(t, b)
|
|
|
|
})
|
2023-11-28 16:35:49 +01:00
|
|
|
|
|
|
|
t.Run("CanceledRequestReply", func(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
b := NewBus()
|
|
|
|
busTesting.TestCanceledRequest(t, b)
|
|
|
|
})
|
2023-02-09 12:16:36 +01:00
|
|
|
}
|