aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-03 19:50:33 -0300
committerEuAndreh <eu@euandre.org>2025-05-03 19:50:33 -0300
commit7bf98f14cf2fa74c3591ce7b2b32c4e3c9263c3b (patch)
tree494f86b809ec0d6d69148c7422ea2930c4d437e5 /tests
parentsrc/fiinha.go: os.Exit(rc) instead of ignoring rc (diff)
downloadfiinha-7bf98f14cf2fa74c3591ce7b2b32c4e3c9263c3b.tar.gz
fiinha-7bf98f14cf2fa74c3591ce7b2b32c4e3c9263c3b.tar.xz
re s/guuid/uuid/g
Diffstat (limited to 'tests')
-rw-r--r--tests/fiinha.go554
-rw-r--r--tests/functional/consumer-with-deadletter/fiinha.go14
-rw-r--r--tests/functional/new-instance-takeover/fiinha.go22
-rw-r--r--tests/functional/wait-after-publish/fiinha.go8
4 files changed, 299 insertions, 299 deletions
diff --git a/tests/fiinha.go b/tests/fiinha.go
index 1e77b68..0901190 100644
--- a/tests/fiinha.go
+++ b/tests/fiinha.go
@@ -15,7 +15,7 @@ import (
"time"
"golite"
- "guuid"
+ "uuid"
g "gobang"
)
@@ -222,7 +222,7 @@ func test_publishStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -250,7 +250,7 @@ func test_publishStmt() {
g.Testing("we can publish a message", func() {
- messageID := guuid.New()
+ messageID := uuid.New()
message, err := publish(unsent, messageID)
g.TErrorIf(err)
@@ -262,8 +262,8 @@ func test_publishStmt() {
})
g.Testing("we can publish the same message repeatedly", func() {
- messageID1 := guuid.New()
- messageID2 := guuid.New()
+ messageID1 := uuid.New()
+ messageID2 := uuid.New()
message1, err1 := publish(unsent, messageID1)
message2, err2 := publish(unsent, messageID2)
g.TErrorIf(g.SomeError(err1, err2))
@@ -278,7 +278,7 @@ func test_publishStmt() {
})
g.Testing("publishing a message with the same UUID errors", func() {
- messageID := guuid.New()
+ messageID := uuid.New()
message1, err1 := publish(unsent, messageID)
_, err2 := publish(unsent, messageID)
g.TErrorIf(err1)
@@ -313,7 +313,7 @@ func test_findStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -344,10 +344,10 @@ func test_findStmt() {
db.Close,
)
- pub := func(flowID guuid.UUID) guuid.UUID {
+ pub := func(flowID uuid.UUID) uuid.UUID {
unsentWithFlowID := unsent
unsentWithFlowID.FlowID = flowID
- messageID := guuid.New()
+ messageID := uuid.New()
_, err := publish(unsentWithFlowID, messageID)
g.TErrorIf(err)
return messageID
@@ -355,7 +355,7 @@ func test_findStmt() {
g.Testing("we can find a message by topic and flowID", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
messageID := pub(flowID)
message, err := find(topic, flowID)
g.TErrorIf(err)
@@ -367,13 +367,13 @@ func test_findStmt() {
})
g.Testing("a non-existent message gives us an error", func() {
- message, err := find(topic, guuid.New())
+ message, err := find(topic, uuid.New())
g.TAssertEqual(message, messageT{})
g.TAssertEqual(err, sql.ErrNoRows)
})
g.Testing("findig twice yields the exact same message", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
messageID := pub(flowID)
message1, err1 := find(topic, flowID)
message2, err2 := find(topic, flowID)
@@ -384,7 +384,7 @@ func test_findStmt() {
})
g.Testing("returns the latest entry if multiple are available", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
_ , err0 := find(topic, flowID)
pub(flowID)
@@ -418,7 +418,7 @@ func test_nextStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -464,7 +464,7 @@ func test_nextStmt() {
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message
}
@@ -553,7 +553,7 @@ func test_messageEach() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -587,8 +587,8 @@ func test_messageEach() {
db.Close,
)
- pub := func() guuid.UUID {
- message, err := publish(unsent, guuid.New())
+ pub := func() uuid.UUID {
+ message, err := publish(unsent, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -606,7 +606,7 @@ func test_messageEach() {
})
g.Testing("the callback is called once for each entry", func() {
- messageIDs := []guuid.UUID{
+ messageIDs := []uuid.UUID{
pub(),
pub(),
pub(),
@@ -615,7 +615,7 @@ func test_messageEach() {
rows, err := pending(topic, consumer)
g.TErrorIf(err)
- var collectedIDs []guuid.UUID
+ var collectedIDs []uuid.UUID
err = messageEach(rows, func(message messageT) error {
collectedIDs = append(collectedIDs, message.uuid)
return nil
@@ -721,7 +721,7 @@ func test_pendingStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -765,7 +765,7 @@ func test_pendingStmt() {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message
}
@@ -862,14 +862,14 @@ func test_pendingStmt() {
messages1 := collectPending(topic, consumer)
g.TAssertEqual(len(messages1), 2)
- err = toDead(consumer, message1.uuid, guuid.New())
+ err = toDead(consumer, message1.uuid, uuid.New())
g.TErrorIf(err)
messages2 := collectPending(topic, consumer)
g.TAssertEqual(len(messages2), 1)
g.TAssertEqual(messages2[0], message2)
- err = toDead(consumer, message2.uuid, guuid.New())
+ err = toDead(consumer, message2.uuid, uuid.New())
g.TErrorIf(err)
messages3 := collectPending(topic, consumer)
@@ -959,7 +959,7 @@ func test_commitStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -996,17 +996,17 @@ func test_commitStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
- cmt := func(consumer string, messageID guuid.UUID) error {
+ cmt := func(consumer string, messageID uuid.UUID) error {
g.TErrorIf(take(topic, consumer))
return commit(consumer, messageID)
@@ -1026,7 +1026,7 @@ func test_commitStmt() {
})
g.Testing("we can't commit non-existent messages", func() {
- err := cmt(consumer, guuid.New())
+ err := cmt(consumer, uuid.New())
g.TAssertEqual(
err.(golite.Error).ExtendedCode,
golite.ErrConstraintNotNull,
@@ -1070,7 +1070,7 @@ func test_commitStmt() {
g.Testing("we can't commit a dead message", func() {
messageID := pub(topic)
- err1 := toDead(consumer, messageID, guuid.New())
+ err1 := toDead(consumer, messageID, uuid.New())
err2 := cmt(consumer, messageID)
g.TErrorIf(err1)
g.TAssertEqual(
@@ -1119,7 +1119,7 @@ func test_toDeadStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1156,20 +1156,20 @@ func test_toDeadStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
asDead := func(
consumer string,
- messageID guuid.UUID,
- deadletterID guuid.UUID,
+ messageID uuid.UUID,
+ deadletterID uuid.UUID,
) error {
g.TErrorIf(take(topic, consumer))
return toDead(consumer, messageID, deadletterID)
@@ -1179,8 +1179,8 @@ func test_toDeadStmt() {
g.Testing("we can't mark as dead twice", func() {
messageID := pub(topic)
- err1 := asDead(consumer, messageID, guuid.New())
- err2 := asDead(consumer, messageID, guuid.New())
+ err1 := asDead(consumer, messageID, uuid.New())
+ err2 := asDead(consumer, messageID, uuid.New())
g.TErrorIf(err1)
g.TAssertEqual(
err2.(golite.Error).ExtendedCode,
@@ -1191,7 +1191,7 @@ func test_toDeadStmt() {
g.Testing("we can't reuse a deadletter id", func() {
messageID1 := pub(topic)
messageID2 := pub(topic)
- deadletterID := guuid.New()
+ deadletterID := uuid.New()
err1 := asDead(consumer, messageID1, deadletterID)
err2 := asDead(consumer, messageID2, deadletterID)
@@ -1204,7 +1204,7 @@ func test_toDeadStmt() {
})
g.Testing("we can't mark as dead non-existent messages", func() {
- err := asDead(consumer, guuid.New(), guuid.New())
+ err := asDead(consumer, uuid.New(), uuid.New())
g.TAssertEqual(
err.(golite.Error).ExtendedCode,
golite.ErrConstraintNotNull,
@@ -1215,9 +1215,9 @@ func test_toDeadStmt() {
messageID := pub(topic)
g.TErrorIf(g.SomeError(
- asDead(consumer, messageID, guuid.New()),
- asDead("another consumer", messageID, guuid.New()),
- asDead("yet another consumer", messageID, guuid.New()),
+ asDead(consumer, messageID, uuid.New()),
+ asDead("another consumer", messageID, uuid.New()),
+ asDead("yet another consumer", messageID, uuid.New()),
))
})
@@ -1227,9 +1227,9 @@ func test_toDeadStmt() {
messageID3 := pub("yet other topic")
g.TErrorIf(g.SomeError(
- asDead(consumer, messageID1, guuid.New()),
- asDead(consumer, messageID2, guuid.New()),
- asDead(consumer, messageID3, guuid.New()),
+ asDead(consumer, messageID1, uuid.New()),
+ asDead(consumer, messageID2, uuid.New()),
+ asDead(consumer, messageID3, uuid.New()),
))
})
@@ -1239,9 +1239,9 @@ func test_toDeadStmt() {
messageID3 := pub(topic)
g.TErrorIf(g.SomeError(
- asDead(consumer, messageID1, guuid.New()),
- asDead(consumer, messageID2, guuid.New()),
- asDead(consumer, messageID3, guuid.New()),
+ asDead(consumer, messageID1, uuid.New()),
+ asDead(consumer, messageID2, uuid.New()),
+ asDead(consumer, messageID3, uuid.New()),
))
})
@@ -1253,10 +1253,10 @@ func test_toDeadStmt() {
messageID5 := pub(topic)
g.TErrorIf(g.SomeError(
- asDead(consumer, messageID1, guuid.New()),
+ asDead(consumer, messageID1, uuid.New()),
commit(consumer, messageID2),
commit(consumer, messageID3),
- asDead(consumer, messageID4, guuid.New()),
+ asDead(consumer, messageID4, uuid.New()),
commit(consumer, messageID5),
))
})
@@ -1265,7 +1265,7 @@ func test_toDeadStmt() {
messageID := pub(topic)
err1 := commit(consumer, messageID)
- err2 := asDead(consumer, messageID, guuid.New())
+ err2 := asDead(consumer, messageID, uuid.New())
g.TErrorIf(err1)
g.TAssertEqual(
err2.(golite.Error).ExtendedCode,
@@ -1284,13 +1284,13 @@ func test_toDeadStmt() {
g.TErrorIf(takeErr)
defer takeClose()
- err := toDead(consumer, messageID1, guuid.New())
+ err := toDead(consumer, messageID1, uuid.New())
g.TErrorIf(err)
err = take(topic, consumer)
g.TErrorIf(err)
- err = toDead(consumer, messageID2, guuid.New())
+ err = toDead(consumer, messageID2, uuid.New())
g.TAssertEqual(
err.(golite.Error).ExtendedCode,
golite.ErrConstraintTrigger,
@@ -1317,7 +1317,7 @@ func test_replayStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1355,7 +1355,7 @@ func test_replayStmt() {
)
pub := func() messageT {
- message, err := publish(unsent, guuid.New())
+ message, err := publish(unsent, uuid.New())
g.TErrorIf(err)
return message
}
@@ -1364,8 +1364,8 @@ func test_replayStmt() {
g.Testing("we can replay a message", func() {
message := pub()
- deadletterID := guuid.New()
- replayedID := guuid.New()
+ deadletterID := uuid.New()
+ replayedID := uuid.New()
err1 := toDead(consumer, message.uuid, deadletterID)
replayed, err2 := replay(deadletterID, replayedID)
@@ -1378,11 +1378,11 @@ func test_replayStmt() {
g.Testing("a replayed message keeps its payload", func() {
message := pub()
- deadletterID := guuid.New()
+ deadletterID := uuid.New()
err := toDead(consumer, message.uuid, deadletterID)
g.TErrorIf(err)
- replayed, err := replay(deadletterID, guuid.New())
+ replayed, err := replay(deadletterID, uuid.New())
g.TErrorIf(err)
g.TAssertEqual(message.flowID, replayed.flowID)
g.TAssertEqual(message.payload, replayed.payload)
@@ -1390,13 +1390,13 @@ func test_replayStmt() {
g.Testing("we can't replay a dead message twice", func() {
message := pub()
- deadletterID := guuid.New()
+ deadletterID := uuid.New()
err := toDead(consumer, message.uuid, deadletterID)
g.TErrorIf(err)
- _, err1 := replay(deadletterID, guuid.New())
- _, err2 := replay(deadletterID, guuid.New())
+ _, err1 := replay(deadletterID, uuid.New())
+ _, err2 := replay(deadletterID, uuid.New())
g.TErrorIf(err1)
g.TAssertEqual(
err2.(golite.Error).ExtendedCode,
@@ -1405,7 +1405,7 @@ func test_replayStmt() {
})
g.Testing("we cant replay non-existent messages", func() {
- _, err := replay(guuid.New(), guuid.New())
+ _, err := replay(uuid.New(), uuid.New())
g.TAssertEqual(
err.(golite.Error).ExtendedCode,
golite.ErrConstraintNotNull,
@@ -1414,19 +1414,19 @@ func test_replayStmt() {
g.Testing("messages can die and then be replayed many times", func() {
message := pub()
- deadletterID1 := guuid.New()
- deadletterID2 := guuid.New()
+ deadletterID1 := uuid.New()
+ deadletterID2 := uuid.New()
err := toDead(consumer, message.uuid, deadletterID1)
g.TErrorIf(err)
- replayed1, err := replay(deadletterID1, guuid.New())
+ replayed1, err := replay(deadletterID1, uuid.New())
g.TErrorIf(err)
err = toDead(consumer, replayed1.uuid, deadletterID2)
g.TErrorIf(err)
- replayed2, err := replay(deadletterID2, guuid.New())
+ replayed2, err := replay(deadletterID2, uuid.New())
g.TErrorIf(err)
g.TAssertEqual(message.flowID, replayed1.flowID)
@@ -1453,7 +1453,7 @@ func test_oneDeadStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1493,12 +1493,12 @@ func test_oneDeadStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -1510,7 +1510,7 @@ func test_oneDeadStmt() {
})
g.Testing("deadletters on other topics don't show for us", func() {
- err := toDead(consumer, pub("other topic"), guuid.New())
+ err := toDead(consumer, pub("other topic"), uuid.New())
g.TErrorIf(err)
_, err = oneDead(topic, consumer)
@@ -1519,7 +1519,7 @@ func test_oneDeadStmt() {
g.Testing("deadletters for other consumers don't show for use", func() {
g.TErrorIf(take(topic, "other consumer"))
- err := toDead("other consumer", pub(topic), guuid.New())
+ err := toDead("other consumer", pub(topic), uuid.New())
g.TErrorIf(err)
_, err = oneDead(topic, consumer)
@@ -1527,9 +1527,9 @@ func test_oneDeadStmt() {
})
g.Testing("after being replayed deadletters aren't returned", func() {
- messageID1 := guuid.New()
- messageID2 := guuid.New()
- messageID3 := guuid.New()
+ messageID1 := uuid.New()
+ messageID2 := uuid.New()
+ messageID3 := uuid.New()
err1 := toDead(consumer, pub(topic), messageID1)
err2 := toDead(consumer, pub(topic), messageID2)
@@ -1540,21 +1540,21 @@ func test_oneDeadStmt() {
g.TErrorIf(err)
g.TAssertEqual(deadletter.uuid, messageID1)
- _, err = replay(messageID2, guuid.New())
+ _, err = replay(messageID2, uuid.New())
g.TErrorIf(err)
deadletter, err = oneDead(topic, consumer)
g.TErrorIf(err)
g.TAssertEqual(deadletter.uuid, messageID1)
- _, err = replay(messageID1, guuid.New())
+ _, err = replay(messageID1, uuid.New())
g.TErrorIf(err)
deadletter, err = oneDead(topic, consumer)
g.TErrorIf(err)
g.TAssertEqual(deadletter.uuid, messageID3)
- _, err = replay(messageID3, guuid.New())
+ _, err = replay(messageID3, uuid.New())
g.TErrorIf(err)
_, err = oneDead(topic, consumer)
@@ -1573,7 +1573,7 @@ func test_deadletterEach() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1610,14 +1610,14 @@ func test_deadletterEach() {
db.Close,
)
- pub := func() guuid.UUID {
- message, err := publish(unsent, guuid.New())
+ pub := func() uuid.UUID {
+ message, err := publish(unsent, uuid.New())
g.TErrorIf(err)
return message.uuid
}
- dead := func(messageID guuid.UUID) guuid.UUID {
- deadletterID := guuid.New()
+ dead := func(messageID uuid.UUID) uuid.UUID {
+ deadletterID := uuid.New()
err := toDead(consumer, messageID, deadletterID)
g.TErrorIf(err)
@@ -1638,7 +1638,7 @@ func test_deadletterEach() {
})
g.Testing("the callback is called once for each entry", func() {
- expected := []guuid.UUID{
+ expected := []uuid.UUID{
dead(pub()),
dead(pub()),
dead(pub()),
@@ -1647,7 +1647,7 @@ func test_deadletterEach() {
rows, err := allDead(topic, consumer)
g.TErrorIf(err)
- var deadletterIDs []guuid.UUID
+ var deadletterIDs []uuid.UUID
deadletterEach(rows, func(
deadletter deadletterT,
_ messageT,
@@ -1753,7 +1753,7 @@ func test_allDeadStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1793,12 +1793,12 @@ func test_allDeadStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -1836,7 +1836,7 @@ func test_allDeadStmt() {
})
g.Testing("deadletters on other topics don't show up", func() {
- err := toDead(consumer, pub("other topic"), guuid.New())
+ err := toDead(consumer, pub("other topic"), uuid.New())
g.TErrorIf(err)
deadletters, _ := collectAll(topic, consumer)
@@ -1845,7 +1845,7 @@ func test_allDeadStmt() {
g.Testing("deadletters of other consumers don't show up", func() {
g.TErrorIf(take(topic, "other consumer"))
- err := toDead("other consumer", pub(topic), guuid.New())
+ err := toDead("other consumer", pub(topic), uuid.New())
g.TErrorIf(err)
deadletterIDs, _ := collectAll(topic, consumer)
@@ -1853,12 +1853,12 @@ func test_allDeadStmt() {
})
g.Testing("deadletters are given in order", func() {
- deadletterIDs := []guuid.UUID{
- guuid.New(),
- guuid.New(),
- guuid.New(),
+ deadletterIDs := []uuid.UUID{
+ uuid.New(),
+ uuid.New(),
+ uuid.New(),
}
- messageIDs := []guuid.UUID{
+ messageIDs := []uuid.UUID{
pub(topic),
pub(topic),
pub(topic),
@@ -1884,17 +1884,17 @@ func test_allDeadStmt() {
deadletters, _ := collectAll(topic, consumer)
g.TAssertEqual(len(deadletters), 3)
- _, err := replay(deadletters[0].uuid, guuid.New())
+ _, err := replay(deadletters[0].uuid, uuid.New())
g.TErrorIf(err)
collecteds, _ := collectAll(topic, consumer)
g.TAssertEqual(len(collecteds), 2)
- _, err = replay(deadletters[1].uuid, guuid.New())
+ _, err = replay(deadletters[1].uuid, uuid.New())
g.TErrorIf(err)
collecteds, _ = collectAll(topic, consumer)
g.TAssertEqual(len(collecteds), 1)
- _, err = replay(deadletters[2].uuid, guuid.New())
+ _, err = replay(deadletters[2].uuid, uuid.New())
g.TErrorIf(err)
collecteds, _ = collectAll(topic, consumer)
g.TAssertEqual(len(collecteds), 0)
@@ -1912,7 +1912,7 @@ func test_sizeStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -1955,12 +1955,12 @@ func test_sizeStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -1994,7 +1994,7 @@ func test_sizeStmt() {
g.Testing("deadletters aren't taken into account", func() {
sixthMessageID := pub(topic)
- err := toDead(consumer, sixthMessageID, guuid.New())
+ err := toDead(consumer, sixthMessageID, uuid.New())
g.TErrorIf(err)
n, err := size(topic)
@@ -2006,7 +2006,7 @@ func test_sizeStmt() {
deadletter, err := oneDead(topic, consumer)
g.TErrorIf(err)
- _, err = replay(deadletter.uuid, guuid.New())
+ _, err = replay(deadletter.uuid, uuid.New())
g.TErrorIf(err)
n, err := size(topic)
@@ -2026,7 +2026,7 @@ func test_countStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -2069,12 +2069,12 @@ func test_countStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -2140,7 +2140,7 @@ func test_countStmt() {
message, err := next(topic, consumer)
g.TErrorIf(err)
- err = toDead(consumer, message.uuid, guuid.New())
+ err = toDead(consumer, message.uuid, uuid.New())
g.TErrorIf(err)
n, err := count(topic, consumer)
@@ -2160,7 +2160,7 @@ func test_hasDataStmt() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -2203,12 +2203,12 @@ func test_hasDataStmt() {
db.Close,
)
- pub := func(topic string) guuid.UUID {
+ pub := func(topic string) uuid.UUID {
g.TErrorIf(take(topic, consumer))
unsentWithTopic := unsent
unsentWithTopic.Topic = topic
- message, err := publish(unsentWithTopic, guuid.New())
+ message, err := publish(unsentWithTopic, uuid.New())
g.TErrorIf(err)
return message.uuid
}
@@ -2272,7 +2272,7 @@ func test_hasDataStmt() {
g.TErrorIf(err)
g.TAssertEqual(has1, true)
- err = toDead(consumer, messageID1, guuid.New())
+ err = toDead(consumer, messageID1, uuid.New())
g.TErrorIf(err)
err = commit(consumer, messageID2)
g.TErrorIf(err)
@@ -2294,7 +2294,7 @@ func test_initDB() {
prefix = defaultPrefix
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -2316,9 +2316,9 @@ func test_initDB() {
g.Testing("we can perform all the wrapped operations", func() {
- messageID := guuid.New()
- newMessageID := guuid.New()
- deadletterID := guuid.New()
+ messageID := uuid.New()
+ newMessageID := uuid.New()
+ deadletterID := uuid.New()
messageV1, err := queries.publish(unsent, messageID)
g.TErrorIf(err)
@@ -2617,7 +2617,7 @@ func test_makeNotifyFn() {
panic("waiter pinger")
})
- flowID := guuid.New()
+ flowID := uuid.New()
set := subscriptionsSetM{
"topic": topicSubscriptionT{
@@ -2626,7 +2626,7 @@ func test_makeNotifyFn() {
pinger: pinger1,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter-1": waiterT{
pinger: pinger2,
@@ -2650,7 +2650,7 @@ func test_makeNotifyFn() {
notifyFn := makeNotifyFn(subsFn, topPinger)
message := messageT{
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: "nobody is subscribed to this one",
payload: []byte("nobody with get this payload"),
}
@@ -2675,7 +2675,7 @@ func test_makeNotifyFn() {
})
wg.Add(2)
- flowID := guuid.New()
+ flowID := uuid.New()
set := subscriptionsSetM{
topic: topicSubscriptionT{
@@ -2684,7 +2684,7 @@ func test_makeNotifyFn() {
pinger: pinger1,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter-1": waiterT{
pinger: pinger2,
@@ -2708,7 +2708,7 @@ func test_makeNotifyFn() {
notifyFn := makeNotifyFn(subsFn, topPinger)
message := messageT{
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
flowID: flowID,
payload: []byte("ignored in this test"),
@@ -2722,11 +2722,11 @@ func test_collectClosedWaiters() {
g.TestStart("collectClosedWaiter()")
g.Testing("collects all the reports to be closed", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
- flowID3 := guuid.New()
- flowID4 := guuid.New()
- flowID5 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
+ flowID3 := uuid.New()
+ flowID4 := uuid.New()
+ flowID5 := uuid.New()
mkwaiter := func(closed bool) waiterT {
fn := func() bool {
@@ -2739,7 +2739,7 @@ func test_collectClosedWaiters() {
set := subscriptionsSetM{
"topic-1": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": mkwaiter(false),
"waiter-2": mkwaiter(true),
@@ -2752,7 +2752,7 @@ func test_collectClosedWaiters() {
},
},
"topic-2": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID3: map[string]waiterT{
"waiter-1": mkwaiter(false),
"waiter-2": mkwaiter(false),
@@ -2766,17 +2766,17 @@ func test_collectClosedWaiters() {
},
},
"topic-3": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID5: map[string]waiterT{},
},
},
"topic-4": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
- expected := map[string]map[guuid.UUID][]string{
- "topic-1": map[guuid.UUID][]string{
+ expected := map[string]map[uuid.UUID][]string{
+ "topic-1": map[uuid.UUID][]string{
flowID1: []string{
"waiter-2",
"waiter-3",
@@ -2785,7 +2785,7 @@ func test_collectClosedWaiters() {
"waiter-4",
},
},
- "topic-2": map[guuid.UUID][]string{
+ "topic-2": map[uuid.UUID][]string{
flowID3: []string{},
flowID4: []string{
"waiter-3",
@@ -2794,10 +2794,10 @@ func test_collectClosedWaiters() {
"waiter-6",
},
},
- "topic-3": map[guuid.UUID][]string{
+ "topic-3": map[uuid.UUID][]string{
flowID5: []string{},
},
- "topic-4": map[guuid.UUID][]string{},
+ "topic-4": map[uuid.UUID][]string{},
}
given := collectClosedWaiters(set)
@@ -2816,35 +2816,35 @@ func test_trimEmptyLeaves() {
g.TestStart("trimEmptyLeaves()")
g.Testing("noop on an empty index", func() {
- input := map[string]map[guuid.UUID][]string{}
- expected := map[string]map[guuid.UUID][]string{}
+ input := map[string]map[uuid.UUID][]string{}
+ expected := map[string]map[uuid.UUID][]string{}
trimEmptyLeaves(input)
g.TAssertEqual(input, expected)
})
g.Testing("simplifies tree when it can", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
- flowID3 := guuid.New()
- flowID4 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
+ flowID3 := uuid.New()
+ flowID4 := uuid.New()
- input := map[string]map[guuid.UUID][]string{
- "topic-1": map[guuid.UUID][]string{
+ input := map[string]map[uuid.UUID][]string{
+ "topic-1": map[uuid.UUID][]string{
flowID1: []string{
"waiter-1",
},
flowID2: []string{},
},
- "topic-2": map[guuid.UUID][]string{
+ "topic-2": map[uuid.UUID][]string{
flowID3: []string{},
flowID4: []string{},
},
- "topic-3": map[guuid.UUID][]string{},
+ "topic-3": map[uuid.UUID][]string{},
}
- expected := map[string]map[guuid.UUID][]string{
- "topic-1": map[guuid.UUID][]string{
+ expected := map[string]map[uuid.UUID][]string{
+ "topic-1": map[uuid.UUID][]string{
flowID1: []string{
"waiter-1",
},
@@ -2856,20 +2856,20 @@ func test_trimEmptyLeaves() {
})
g.Testing("fully prune tree if possible", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
- flowID3 := guuid.New()
- flowID4 := guuid.New()
- flowID5 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
+ flowID3 := uuid.New()
+ flowID4 := uuid.New()
+ flowID5 := uuid.New()
- input := map[string]map[guuid.UUID][]string{
- "topic-1": map[guuid.UUID][]string{},
- "topic-2": map[guuid.UUID][]string{},
- "topic-3": map[guuid.UUID][]string{},
- "topic-4": map[guuid.UUID][]string{
+ input := map[string]map[uuid.UUID][]string{
+ "topic-1": map[uuid.UUID][]string{},
+ "topic-2": map[uuid.UUID][]string{},
+ "topic-3": map[uuid.UUID][]string{},
+ "topic-4": map[uuid.UUID][]string{
flowID1: []string{},
},
- "topic-5": map[guuid.UUID][]string{
+ "topic-5": map[uuid.UUID][]string{
flowID2: []string{},
flowID3: []string{},
flowID4: []string{},
@@ -2877,7 +2877,7 @@ func test_trimEmptyLeaves() {
},
}
- expected := map[string]map[guuid.UUID][]string{}
+ expected := map[string]map[uuid.UUID][]string{}
trimEmptyLeaves(input)
g.TAssertEqual(input, expected)
@@ -2914,11 +2914,11 @@ func test_deleteIfEmpty() {
})
g.Testing("noop if there are waiters", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
set := subscriptionsSetM{
"topic": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: nil,
},
},
@@ -2926,7 +2926,7 @@ func test_deleteIfEmpty() {
expected1 := subscriptionsSetM{
"topic": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: nil,
},
},
@@ -2945,7 +2945,7 @@ func test_deleteIfEmpty() {
set := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -2959,14 +2959,14 @@ func test_deleteIfEmpty() {
set := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
expected := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -2979,23 +2979,23 @@ func test_deleteEmptyTopics() {
g.TestStart("deleteEmptyTopics()")
g.Testing("cleans up all empty topics from the set", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
set := subscriptionsSetM{
"empty": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
"has-consumers": topicSubscriptionT{
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
"has-waiters": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: nil,
},
},
@@ -3003,13 +3003,13 @@ func test_deleteEmptyTopics() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID2: nil,
},
},
"has-neither": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -3018,11 +3018,11 @@ func test_deleteEmptyTopics() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
"has-waiters": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: nil,
},
},
@@ -3030,7 +3030,7 @@ func test_deleteEmptyTopics() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID2: nil,
},
},
@@ -3045,14 +3045,14 @@ func test_removeClosedWaiter() {
g.TestStart("removeClosedWaiter()")
g.Testing("removes from set all that we request", func() {
- flowID0 := guuid.New()
- flowID1 := guuid.New()
- flowID2 := guuid.New()
- flowID3 := guuid.New()
+ flowID0 := uuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
+ flowID3 := uuid.New()
set := subscriptionsSetM{
"topic-1": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": waiterT{},
"waiter-2": waiterT{},
@@ -3065,7 +3065,7 @@ func test_removeClosedWaiter() {
},
},
"topic-2": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID3: map[string]waiterT{
"waiter-6": waiterT{},
"waiter-7": waiterT{},
@@ -3074,17 +3074,17 @@ func test_removeClosedWaiter() {
},
},
"topic-3": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
- input := map[string]map[guuid.UUID][]string{
- "topic-0": map[guuid.UUID][]string{
+ input := map[string]map[uuid.UUID][]string{
+ "topic-0": map[uuid.UUID][]string{
flowID0: []string{
"waiter-0",
},
},
- "topic-1": map[guuid.UUID][]string{
+ "topic-1": map[uuid.UUID][]string{
flowID1: []string{
"waiter-2",
},
@@ -3094,7 +3094,7 @@ func test_removeClosedWaiter() {
"waiter-5",
},
},
- "topic-2": map[guuid.UUID][]string{
+ "topic-2": map[uuid.UUID][]string{
flowID3: []string{
"waiter-6",
"waiter-7",
@@ -3105,7 +3105,7 @@ func test_removeClosedWaiter() {
expected := subscriptionsSetM{
"topic-1": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": waiterT{},
},
@@ -3118,11 +3118,11 @@ func test_removeClosedWaiter() {
})
g.Testing("empty flowIDs from input GET LEAKED", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
- input := map[string]map[guuid.UUID][]string{
- "topic-2": map[guuid.UUID][]string{
+ input := map[string]map[uuid.UUID][]string{
+ "topic-2": map[uuid.UUID][]string{
flowID2: []string{
"waiter",
},
@@ -3131,12 +3131,12 @@ func test_removeClosedWaiter() {
set := subscriptionsSetM{
"topic-1": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{},
},
},
"topic-2": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID2: map[string]waiterT{
"waiter": waiterT{},
},
@@ -3146,7 +3146,7 @@ func test_removeClosedWaiter() {
expected := subscriptionsSetM{
"topic-1": topicSubscriptionT{
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{},
},
},
@@ -3183,13 +3183,13 @@ func test_reapClosedWaiters() {
}
open := waiterT{ closed: &openFn }
closed := waiterT{ closed: &closedFn }
- flowID1 := guuid.New()
- flowID2 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
set = subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": open,
"waiter-2": open,
@@ -3205,7 +3205,7 @@ func test_reapClosedWaiters() {
expected1 := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": open,
"waiter-2": open,
@@ -3221,7 +3221,7 @@ func test_reapClosedWaiters() {
expected2 := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-2": open,
"waiter-3": open,
@@ -3236,7 +3236,7 @@ func test_reapClosedWaiters() {
expected3 := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-2": open,
"waiter-3": open,
@@ -3384,10 +3384,10 @@ func test_asPublicMessage() {
g.Testing("it picks the correct fields 🤷", func() {
input := messageT{
- uuid: guuid.New(),
+ uuid: uuid.New(),
timestamp: time.Now(),
topic: "topic",
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: []byte("payload"),
}
@@ -3413,7 +3413,7 @@ func test_queueT_Publish() {
dbpath = golite.InMemory
)
var (
- flowID = guuid.New()
+ flowID = uuid.New()
payload = []byte(payloadStr)
unsent = UnsentMessage{
Topic: topic,
@@ -3459,7 +3459,7 @@ func test_registerConsumerFn() {
consumers: map[string]consumerT{
"consumer": consumer,
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -3468,7 +3468,7 @@ func test_registerConsumerFn() {
})
g.Testing("otherwise it just uses what exists", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
consumer := consumerT{
data: consumerDataT{
@@ -3482,7 +3482,7 @@ func test_registerConsumerFn() {
consumers: map[string]consumerT{
"other-consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{},
},
},
@@ -3494,7 +3494,7 @@ func test_registerConsumerFn() {
"consumer": consumer,
"other-consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{},
},
},
@@ -3530,7 +3530,7 @@ func test_registerConsumerFn() {
consumers: map[string]consumerT{
"consumer": consumer1,
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -3539,7 +3539,7 @@ func test_registerConsumerFn() {
consumers: map[string]consumerT{
"consumer": consumer2,
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -3557,7 +3557,7 @@ func test_registerWaiterFn() {
g.TestStart("registerWaiterFn()")
g.Testing("adds a new topicSubscriptionT{} if needed", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
waiter := waiterT{
data: waiterDataT{
@@ -3572,7 +3572,7 @@ func test_registerWaiterFn() {
expected := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter": waiter,
},
@@ -3585,7 +3585,7 @@ func test_registerWaiterFn() {
})
g.Testing("adds a new waiters map if needed", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
waiter := waiterT{
data: waiterDataT{
@@ -3600,7 +3600,7 @@ func test_registerWaiterFn() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -3609,7 +3609,7 @@ func test_registerWaiterFn() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter": waiter,
},
@@ -3622,7 +3622,7 @@ func test_registerWaiterFn() {
})
g.Testing("otherwise it just uses what exists", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
waiter := waiterT{
data: waiterDataT{
@@ -3637,7 +3637,7 @@ func test_registerWaiterFn() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"other-waiter": waiterT{},
},
@@ -3650,7 +3650,7 @@ func test_registerWaiterFn() {
consumers: map[string]consumerT{
"consumer": consumerT{},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter": waiter,
"other-waiter": waiterT{},
@@ -3664,7 +3664,7 @@ func test_registerWaiterFn() {
})
g.Testing("overwrites existing waiter if desired", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
close1 := func() {}
waiter1 := waiterT{
@@ -3691,7 +3691,7 @@ func test_registerWaiterFn() {
expected1 := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter": waiter1,
},
@@ -3702,7 +3702,7 @@ func test_registerWaiterFn() {
expected2 := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{
"waiter": waiter2,
},
@@ -3736,10 +3736,10 @@ func test_makeConsumeOneFn() {
errorFnErr error
messages []Message
successNames []string
- successIDs []guuid.UUID
+ successIDs []uuid.UUID
errorNames []string
- errorIDs []guuid.UUID
- deadletterIDs []guuid.UUID
+ errorIDs []uuid.UUID
+ deadletterIDs []uuid.UUID
)
data := consumerDataT{
@@ -3752,7 +3752,7 @@ func test_makeConsumeOneFn() {
return callbackErr
}
- successFn := func(name string, messageID guuid.UUID) error {
+ successFn := func(name string, messageID uuid.UUID) error {
successCount++
successNames = append(successNames, name)
successIDs = append(successIDs, messageID)
@@ -3761,8 +3761,8 @@ func test_makeConsumeOneFn() {
errorFn := func(
name string,
- messageID guuid.UUID,
- deadletterID guuid.UUID,
+ messageID uuid.UUID,
+ deadletterID uuid.UUID,
) error {
errorCount++
errorNames = append(errorNames, name)
@@ -3779,10 +3779,10 @@ func test_makeConsumeOneFn() {
errorFn,
)
- message1 := messageT{ uuid: guuid.New() }
- message2 := messageT{ uuid: guuid.New() }
- message3 := messageT{ uuid: guuid.New() }
- message4 := messageT{ uuid: guuid.New() }
+ message1 := messageT{ uuid: uuid.New() }
+ message2 := messageT{ uuid: uuid.New() }
+ message3 := messageT{ uuid: uuid.New() }
+ message4 := messageT{ uuid: uuid.New() }
g.Testing("error from successFn() is propagated", func() {
@@ -3833,11 +3833,11 @@ func test_makeConsumeOneFn() {
g.TAssertEqual(messages, expectedMessages)
g.TAssertEqual(successNames, []string{ "name", "name" })
g.TAssertEqual(errorNames, []string{ "name", "name" })
- g.TAssertEqual(successIDs, []guuid.UUID{
+ g.TAssertEqual(successIDs, []uuid.UUID{
message1.uuid,
message2.uuid,
})
- g.TAssertEqual(errorIDs, []guuid.UUID{
+ g.TAssertEqual(errorIDs, []uuid.UUID{
message3.uuid,
message4.uuid,
})
@@ -3961,7 +3961,7 @@ func test_tryFinding() {
g.Testing("noop in case of failure", func() {
myErr := errors.New("find() error")
- findFn := func(string, guuid.UUID) (messageT, error) {
+ findFn := func(string, uuid.UUID) (messageT, error) {
return messageT{}, myErr
}
@@ -3971,14 +3971,14 @@ func test_tryFinding() {
}
- tryFinding(findFn, "topic", guuid.New(), waitFn)
+ tryFinding(findFn, "topic", uuid.New(), waitFn)
g.TAssertEqual(count, 0)
})
g.Testing("calls waitFn in case of success", func() {
payload := []byte("find() payload")
- findFn := func(string, guuid.UUID) (messageT, error) {
+ findFn := func(string, uuid.UUID) (messageT, error) {
return messageT{ payload: payload }, nil
}
@@ -3988,7 +3988,7 @@ func test_tryFinding() {
}
- tryFinding(findFn, "topic", guuid.New(), waitFn)
+ tryFinding(findFn, "topic", uuid.New(), waitFn)
g.TAssertEqual(payloads, [][]byte{ payload })
})
}
@@ -3997,10 +3997,10 @@ func test_queueT_Subscribe() {
g.TestStart("queueT.Subscribe()")
set := subscriptionsSetM{}
- consumed := []guuid.UUID{}
+ consumed := []uuid.UUID{}
messages := []messageT{
- messageT{ uuid: guuid.New() },
- messageT{ uuid: guuid.New() },
+ messageT{ uuid: uuid.New() },
+ messageT{ uuid: uuid.New() },
}
var takeErr error
@@ -4025,11 +4025,11 @@ func test_queueT_Subscribe() {
},
commit: func(
consumer string,
- messageID guuid.UUID,
+ messageID uuid.UUID,
) error {
return nil
},
- toDead: func(string, guuid.UUID, guuid.UUID) error {
+ toDead: func(string, uuid.UUID, uuid.UUID) error {
g.Unreachable()
return nil
},
@@ -4053,14 +4053,14 @@ func test_queueT_Subscribe() {
defer queue.Unsubscribe("topic", "consumer-1")
wg.Wait()
- g.TAssertEqual(consumed, []guuid.UUID{
+ g.TAssertEqual(consumed, []uuid.UUID{
messages[0].uuid,
messages[1].uuid,
})
})
g.Testing("our callback also gets called when pinged", func() {
- consumed = []guuid.UUID{}
+ consumed = []uuid.UUID{}
var wg sync.WaitGroup
wg.Add(4)
@@ -4076,7 +4076,7 @@ func test_queueT_Subscribe() {
wg.Wait()
- g.TAssertEqual(consumed, []guuid.UUID{
+ g.TAssertEqual(consumed, []uuid.UUID{
messages[0].uuid,
messages[1].uuid,
messages[0].uuid,
@@ -4126,7 +4126,7 @@ func test_queueT_WaitFor() {
queries: queriesT{
find: func(
topic string,
- flowID guuid.UUID,
+ flowID uuid.UUID,
) (messageT, error) {
return message, findErr
},
@@ -4143,7 +4143,7 @@ func test_queueT_WaitFor() {
g.Testing("registers the waiter in the set", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
defer queue.WaitFor("topic", flowID, "waiter-1").Close()
@@ -4160,7 +4160,7 @@ func test_queueT_WaitFor() {
})
g.Testing("the channel gets a message when waiter is pinged", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
payload := []byte("sent payload")
w := queue.WaitFor("topic", flowID, "waiter-2")
@@ -4177,7 +4177,7 @@ func test_queueT_WaitFor() {
g.Testing("we can also WaitFor() after publishing the message", func() {
findErr = nil
- flowID := guuid.New()
+ flowID := uuid.New()
w := queue.WaitFor("topic", flowID, "waiter-3")
defer w.Close()
@@ -4192,7 +4192,7 @@ func test_queueT_WaitFor() {
})
g.Testing("if the data already exists we get it immediatelly", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
w := queue.WaitFor("topic", flowID, "waiter-4")
defer w.Close()
@@ -4250,7 +4250,7 @@ func test_unsubscribeIfExistsFn() {
})
g.Testing("closes consumer and removes it from set", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
count := 0
close := func() {
@@ -4264,7 +4264,7 @@ func test_unsubscribeIfExistsFn() {
close: &close,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{},
},
},
@@ -4273,7 +4273,7 @@ func test_unsubscribeIfExistsFn() {
expected := subscriptionsSetM{
"topic": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID: map[string]waiterT{},
},
},
@@ -4297,7 +4297,7 @@ func test_unsubscribeIfExistsFn() {
close: &close,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -4325,7 +4325,7 @@ func test_queueT_Unsubscribe() {
close: &close,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -4351,9 +4351,9 @@ func test_cleanSubscriptions() {
g.TestStart("cleanSubscriptions()")
g.Testing("all consumers and waiters get close()'d", func() {
- flowID1 := guuid.New()
- flowID2 := guuid.New()
- flowID3 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
+ flowID3 := uuid.New()
type pairT struct{
closed func() bool
@@ -4397,7 +4397,7 @@ func test_cleanSubscriptions() {
close: &close2.fn,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID1: map[string]waiterT{
"waiter-1": waiterT{
close: &close3.fn,
@@ -4419,7 +4419,7 @@ func test_cleanSubscriptions() {
close: &close6.fn,
},
},
- waiters: map[guuid.UUID]map[string]waiterT{
+ waiters: map[uuid.UUID]map[string]waiterT{
flowID3: map[string]waiterT{
"waiter-4": waiterT{
close: &close7.fn,
@@ -4429,7 +4429,7 @@ func test_cleanSubscriptions() {
},
"topic-3": topicSubscriptionT{
consumers: map[string]consumerT{},
- waiters: map[guuid.UUID]map[string]waiterT{},
+ waiters: map[uuid.UUID]map[string]waiterT{},
},
}
@@ -4626,7 +4626,7 @@ func test_inExec() {
queries := queriesT{
publish: func(
unsent UnsentMessage,
- messageID guuid.UUID,
+ messageID uuid.UUID,
) (messageT, error) {
if publishErr != nil {
return messageT{}, publishErr
@@ -4725,9 +4725,9 @@ func test_outExec() {
message := messageT{
id: id,
timestamp: now,
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: payload,
}
messages = append(messages, message)
@@ -4831,7 +4831,7 @@ func test_commitExec() {
return messages[0], nil
},
- commit: func(string, guuid.UUID) error {
+ commit: func(string, uuid.UUID) error {
if commitErr != nil {
return commitErr
}
@@ -4846,9 +4846,9 @@ func test_commitExec() {
message := messageT{
id: id,
timestamp: now,
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: payload,
}
messages = append(messages, message)
@@ -4968,8 +4968,8 @@ func test_deadExec() {
},
toDead: func(
_ string,
- _ guuid.UUID,
- deadletterID guuid.UUID,
+ _ uuid.UUID,
+ deadletterID uuid.UUID,
) error {
if toDeadErr != nil {
return toDeadErr
@@ -4985,9 +4985,9 @@ func test_deadExec() {
message := messageT{
id: id,
timestamp: now,
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: payload,
}
messages = append(messages, message)
@@ -5106,9 +5106,9 @@ func test_listDeadExec() {
message := messageT{
id: id,
timestamp: now,
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: payload,
}
messages = append(messages, message)
@@ -5120,7 +5120,7 @@ func test_listDeadExec() {
message := messages[0]
now := time.Now()
deadletter := deadletterT{
- uuid: guuid.New(),
+ uuid: uuid.New(),
timestamp: now,
consumer: consumer,
messageID: message.uuid,
@@ -5267,7 +5267,7 @@ func test_replayExec() {
return deadletters[0], nil
},
- replay: func(guuid.UUID, guuid.UUID) (messageT, error) {
+ replay: func(uuid.UUID, uuid.UUID) (messageT, error) {
if replayErr != nil {
return messageT{}, replayErr
}
@@ -5285,9 +5285,9 @@ func test_replayExec() {
message := messageT{
id: id,
timestamp: now,
- uuid: guuid.New(),
+ uuid: uuid.New(),
topic: topic,
- flowID: guuid.New(),
+ flowID: uuid.New(),
payload: payload,
}
messages = append(messages, message)
@@ -5297,7 +5297,7 @@ func test_replayExec() {
}
dead := func() {
message := messages[0]
- deadletter := deadletterT{ uuid: guuid.New() }
+ deadletter := deadletterT{ uuid: uuid.New() }
messages = messages[1:]
deadletters = append(deadletters, deadletter)
diff --git a/tests/functional/consumer-with-deadletter/fiinha.go b/tests/functional/consumer-with-deadletter/fiinha.go
index 7d88e0e..37893e1 100644
--- a/tests/functional/consumer-with-deadletter/fiinha.go
+++ b/tests/functional/consumer-with-deadletter/fiinha.go
@@ -4,7 +4,7 @@ import (
"errors"
"runtime"
- "guuid"
+ "uuid"
g "gobang"
)
@@ -47,7 +47,7 @@ func MainTest() {
g.TErrorIf(err)
defer queue.Close()
- pub := func(payload []byte, flowID guuid.UUID) {
+ pub := func(payload []byte, flowID uuid.UUID) {
unsent := UnsentMessage{
Topic: topicX,
FlowID: flowID,
@@ -59,7 +59,7 @@ func MainTest() {
g.Testing("we can WaitFor() a message after a deadletter", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
handlerFn := func(message Message) error {
messageY, err := processNewEventXToY(message)
@@ -73,10 +73,10 @@ func MainTest() {
queue.Subscribe(topicX, "main-worker", handlerFn)
defer queue.Unsubscribe(topicX, "main-worker")
- pub([]byte("event 1"), guuid.New())
- pub([]byte("event 2"), guuid.New())
- pub([]byte("event 3"), guuid.New())
- pub([]byte("event 4"), guuid.New())
+ pub([]byte("event 1"), uuid.New())
+ pub([]byte("event 2"), uuid.New())
+ pub([]byte("event 3"), uuid.New())
+ pub([]byte("event 4"), uuid.New())
pub([]byte("event 5"), flowID)
given := <- queue.WaitFor(topicY, flowID, "waiter").Channel
diff --git a/tests/functional/new-instance-takeover/fiinha.go b/tests/functional/new-instance-takeover/fiinha.go
index 5fdb9b4..5e6ad4b 100644
--- a/tests/functional/new-instance-takeover/fiinha.go
+++ b/tests/functional/new-instance-takeover/fiinha.go
@@ -4,7 +4,7 @@ import (
"runtime"
"os"
- "guuid"
+ "uuid"
g "gobang"
)
@@ -14,7 +14,7 @@ const topic = "topic"
-func pub(queue IQueue, topic string, flowID guuid.UUID) {
+func pub(queue IQueue, topic string, flowID uuid.UUID) {
unsent := UnsentMessage{
Topic: topic,
FlowID: flowID,
@@ -24,7 +24,7 @@ func pub(queue IQueue, topic string, flowID guuid.UUID) {
g.TErrorIf(err)
}
-func handlerFn(publish func(guuid.UUID)) func(Message) error {
+func handlerFn(publish func(uuid.UUID)) func(Message) error {
return func(message Message) error {
publish(message.FlowID)
return nil
@@ -49,8 +49,8 @@ func startInstance(
queue.queries = queries
- pub_ := func(topic string) func(guuid.UUID) {
- return func(flowID guuid.UUID) {
+ pub_ := func(topic string) func(uuid.UUID) {
+ return func(flowID uuid.UUID) {
pub(queue, topic, flowID)
}
}
@@ -76,16 +76,16 @@ func MainTest() {
instanceID1 := os.Getpid()
instanceID2 := instanceID1 + 1
- flowID1 := guuid.New()
- flowID2 := guuid.New()
+ flowID1 := uuid.New()
+ flowID2 := uuid.New()
g.Testing("new instances take ownership of topic+name combo", func() {
q1, err := startInstance(dbpath, instanceID1, "first")
g.TErrorIf(err)
defer q1.Close()
- pub(q1, topic, guuid.New())
- pub(q1, topic, guuid.New())
+ pub(q1, topic, uuid.New())
+ pub(q1, topic, uuid.New())
pub(q1, topic, flowID1)
<- q1.WaitFor("individual-first", flowID1, "w").Channel
@@ -97,8 +97,8 @@ func MainTest() {
<- q2.WaitFor("individual-second", flowID1, "w").Channel
- pub(q2, topic, guuid.New())
- pub(q2, topic, guuid.New())
+ pub(q2, topic, uuid.New())
+ pub(q2, topic, uuid.New())
pub(q2, topic, flowID2)
// FIXME: notify multiple instances so we can add this:
diff --git a/tests/functional/wait-after-publish/fiinha.go b/tests/functional/wait-after-publish/fiinha.go
index a60a57b..71b9b56 100644
--- a/tests/functional/wait-after-publish/fiinha.go
+++ b/tests/functional/wait-after-publish/fiinha.go
@@ -3,7 +3,7 @@ package fiinha
import (
"runtime"
- "guuid"
+ "uuid"
g "gobang"
)
@@ -22,7 +22,7 @@ func MainTest() {
g.TErrorIf(err)
defer queue.Close()
- pub := func(flowID guuid.UUID, payload []byte) {
+ pub := func(flowID uuid.UUID, payload []byte) {
unsent := UnsentMessage{
Topic: topic,
FlowID: flowID,
@@ -34,7 +34,7 @@ func MainTest() {
g.Testing("we can WaitFor() a message before its publishing", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
waiter := queue.WaitFor(topic, flowID, "waiter").Channel
pub(flowID, []byte("payload before"))
@@ -44,7 +44,7 @@ func MainTest() {
})
g.Testing("we can also do it after its publishing", func() {
- flowID := guuid.New()
+ flowID := uuid.New()
pub(flowID, []byte("payload after"))