Skip to content

Commit

Permalink
refactor(test): avoid using internal pkg in mock
Browse files Browse the repository at this point in the history
Mock test should not depend on xsql package

Signed-off-by: Jiyong <[email protected]>
  • Loading branch information
ngjaying committed Apr 23, 2024
1 parent 1af4bd4 commit 8324168
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/mock/test_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/stretchr/testify/assert"

"github.com/lf-edge/ekuiper/contract/v2/api"
"github.com/lf-edge/ekuiper/v2/internal/xsql"
mockContext "github.com/lf-edge/ekuiper/v2/pkg/mock/context"
"github.com/lf-edge/ekuiper/v2/pkg/model"
)
Expand Down Expand Up @@ -58,7 +57,7 @@ func TestSourceConnector(t *testing.T, r api.Source, props map[string]any, expec
switch ss := r.(type) {
case api.BytesSource:
err = ss.Subscribe(ctx, func(ctx api.StreamContext, payload []byte, meta map[string]any, ts time.Time) {
result = append(result, model.NewDefaultRawTuple(payload, xsql.Message(meta), ts))
result = append(result, model.NewDefaultRawTuple(payload, model.DefaultMessage(meta), ts))
limit--
if limit <= 0 {
wg.Done()
Expand All @@ -79,7 +78,7 @@ func TestSourceConnector(t *testing.T, r api.Source, props map[string]any, expec
sender()
}()

ticker := time.After(2 * time.Second)
ticker := time.After(60 * time.Second)
finished := make(chan struct{})
go func() {
wg.Wait()
Expand Down

0 comments on commit 8324168

Please sign in to comment.