github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/tests/integration/topic_regression_test.go (about)

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"strings"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  
    12  	"github.com/ydb-platform/ydb-go-sdk/v3/topic/topicoptions"
    13  	"github.com/ydb-platform/ydb-go-sdk/v3/topic/topicwriter"
    14  )
    15  
    16  func TestRegressionIssue1011_WriteInitInfoLastSeqNum(t *testing.T) {
    17  	scope := newScope(t)
    18  	w1 := scope.TopicWriter()
    19  	err := w1.Write(scope.Ctx, topicwriter.Message{
    20  		Data: strings.NewReader("123"),
    21  	})
    22  	require.NoError(t, err)
    23  	require.NoError(t, w1.Close(scope.Ctx))
    24  
    25  	// Check
    26  	w2, err := scope.Driver().Topic().StartWriter(
    27  		scope.TopicPath(),
    28  		topicoptions.WithWriterProducerID(scope.TopicWriterProducerID()),
    29  		topicoptions.WithWriterSetAutoSeqNo(false),
    30  	)
    31  	require.NoError(t, err)
    32  
    33  	info, err := w2.WaitInitInfo(scope.Ctx)
    34  	require.Equal(t, int64(1), info.LastSeqNum)
    35  }