v0.0.593 made PubSub more generic (namespace can be any comparable type)
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m54s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m54s
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNewPubSub(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
if ps == nil {
|
||||
t.Fatal("NewPubSub returned nil")
|
||||
}
|
||||
@@ -21,7 +21,7 @@ func TestNewPubSub(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_Namespaces(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Initially no namespaces
|
||||
namespaces := ps.Namespaces()
|
||||
@@ -60,7 +60,7 @@ func TestPubSub_Namespaces(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_SubscribeByCallback(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
var received string
|
||||
var wg sync.WaitGroup
|
||||
@@ -94,7 +94,7 @@ func TestPubSub_SubscribeByCallback(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_SubscribeByChan(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
ch, sub := ps.SubscribeByChan("test-ns", 1)
|
||||
defer sub.Unsubscribe()
|
||||
@@ -122,7 +122,7 @@ func TestPubSub_SubscribeByChan(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_SubscribeByIter(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
iterSeq, sub := ps.SubscribeByIter("test-ns", 1)
|
||||
defer sub.Unsubscribe()
|
||||
@@ -165,7 +165,7 @@ func TestPubSub_SubscribeByIter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_Publish(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Test publishing to a namespace with no subscribers
|
||||
subs, receivers := ps.Publish("empty-ns", "hello")
|
||||
@@ -215,7 +215,7 @@ func TestPubSub_Publish(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_PublishWithTimeout(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Add a subscriber with a channel
|
||||
ch, sub := ps.SubscribeByChan("test-ns", 1)
|
||||
@@ -262,7 +262,7 @@ func TestPubSub_PublishWithTimeout(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_PublishWithContext(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Add a subscriber with a channel
|
||||
ch, sub := ps.SubscribeByChan("test-ns", 1)
|
||||
@@ -328,7 +328,7 @@ func TestPubSub_PublishWithContext(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_Unsubscribe(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Add a subscriber
|
||||
ch, sub := ps.SubscribeByChan("test-ns", 1)
|
||||
@@ -372,7 +372,7 @@ func TestPubSub_Unsubscribe(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPubSub_MultipleSubscribers(t *testing.T) {
|
||||
ps := NewPubSub[string](10)
|
||||
ps := NewPubSub[string, string](10)
|
||||
|
||||
// Add multiple subscribers
|
||||
ch1, sub1 := ps.SubscribeByChan("test-ns", 1)
|
||||
|
Reference in New Issue
Block a user