This is an automated email from the ASF dual-hosted git repository.
JackieTien97 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-client-go.git
The following commit(s) were added to refs/heads/main by this push:
new 4d5f0c2 Stabilize subscription snapshot and deletion E2E cleanup
4d5f0c2 is described below
commit 4d5f0c237a278514d6ddf63dae06f7b3d7c99378
Author: shuwenwei <[email protected]>
AuthorDate: Fri Nov 27 19:19:21 2026 +0800
Stabilize subscription snapshot and deletion E2E cleanup
---
test/e2e/config_test.go | 8 ++++----
test/e2e/e2e_test.go | 11 ++++++++++-
test/e2e/subscription_tree_test.go | 19 ++++++++++++++-----
3 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/test/e2e/config_test.go b/test/e2e/config_test.go
index c1d7196..401444b 100644
--- a/test/e2e/config_test.go
+++ b/test/e2e/config_test.go
@@ -25,9 +25,9 @@ import (
"testing"
"time"
+ "github.com/apache/iotdb-client-go/v2/client"
"github.com/apache/iotdb-client-go/v2/subscription"
subsession "github.com/apache/iotdb-client-go/v2/subscription/session"
- "github.com/apache/iotdb-client-go/v2/client"
)
const (
@@ -50,12 +50,12 @@ var (
const (
subscriptionE2EDefaultEnabled = false
- subscriptionE2ETestTimeout = 20 * time.Second
- subscriptionE2EOpenTimeout = 10 * time.Second
+ subscriptionE2ETestTimeout = 30 * time.Second
+ subscriptionE2EOpenTimeout = 10 * time.Second
// The server closes an inactive consumer after its 10s timeout plus up
to
// one 5s checker interval, and metadata propagation may add further
delay.
// Keep a full extra checker window for CI scheduling variance.
- subscriptionE2ECleanupTimeout = 30 * time.Second
+ subscriptionE2ECleanupTimeout = 30 * time.Second
subscriptionE2EWriterTimeoutMs = 10000
subscriptionE2EHeartbeatInterval = time.Second
diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go
index 6e888a2..97ffbf0 100644
--- a/test/e2e/e2e_test.go
+++ b/test/e2e/e2e_test.go
@@ -21,6 +21,7 @@ package e2e
import (
"context"
+ "errors"
"fmt"
"log"
"math/rand"
@@ -93,7 +94,15 @@ func (s *e2eTestSuite) latestDeleteTimeseriesProcedureID()
int64 {
func (s *e2eTestSuite) deleteTimeseriesAndWait(paths []string) {
previousID := s.latestDeleteTimeseriesProcedureID()
- s.checkError(s.session.DeleteTimeseries(paths))
+ err := s.session.DeleteTimeseries(paths)
+ if err != nil {
+ var executionError *client.ExecutionError
+ if errors.As(err, &executionError) && executionError.Code ==
client.PathNotExist {
+ // The server may reject deletion of an absent path
before creating a procedure.
+ return
+ }
+ s.checkError(err)
+ }
deadline := time.Now().Add(60 * time.Second)
for time.Now().Before(deadline) {
diff --git a/test/e2e/subscription_tree_test.go
b/test/e2e/subscription_tree_test.go
index cc8bddc..4cdd5a8 100644
--- a/test/e2e/subscription_tree_test.go
+++ b/test/e2e/subscription_tree_test.go
@@ -29,11 +29,11 @@ import (
"testing"
"time"
+ "github.com/apache/iotdb-client-go/v2/client"
"github.com/apache/iotdb-client-go/v2/subscription"
subconsumer "github.com/apache/iotdb-client-go/v2/subscription/consumer"
subpayload "github.com/apache/iotdb-client-go/v2/subscription/payload"
subsession "github.com/apache/iotdb-client-go/v2/subscription/session"
- "github.com/apache/iotdb-client-go/v2/client"
)
func subscriptionE2EContext(t *testing.T) context.Context {
@@ -669,6 +669,9 @@ func TestSubscriptionTreeConsumerReadsMultipleTopics(t
*testing.T) {
firstTopic, secondTopic,
)
seen := map[string]map[subscriptionTreeRow]int{firstTopic: {},
secondTopic: {}}
+ expectedFirst := map[subscriptionTreeRow]int{firstRow: 1}
+ expectedSecond := map[subscriptionTreeRow]int{secondRow: 1}
+ quietPolls := 0
for round := 0; round < subscriptionE2EMaxPollRounds; round++ {
messages, err := consumer.Poll(ctx, subscriptionE2EPollTimeout)
if err != nil {
@@ -688,13 +691,19 @@ func TestSubscriptionTreeConsumerReadsMultipleTopics(t
*testing.T) {
seen[topic][row]++
}
}
- if consumer.AllConsumed() {
- subscriptionTreeRequireRows(t, seen[firstTopic],
firstRow)
- subscriptionTreeRequireRows(t, seen[secondTopic],
secondRow)
+
+ complete := reflect.DeepEqual(seen[firstTopic], expectedFirst)
&&
+ reflect.DeepEqual(seen[secondTopic], expectedSecond)
+ if complete && len(messages) == 0 {
+ quietPolls++
+ } else {
+ quietPolls = 0
+ }
+ if complete && quietPolls >= subscriptionE2EQuietPollRounds {
return
}
}
- t.Fatalf("multi-topic snapshot did not complete: seen=%v", seen)
+ t.Fatalf("multi-topic snapshot delivery did not reach a quiet tail:
seen=%v", seen)
}
// Java reference:
IoTDBConsensusSubscriptionConsumerGroupIT.testTwoConsumersInSameGroupDoNotDuplicateRows.