From b72dfd089f61a6dd89e2b82985ce3920e24cc94c Mon Sep 17 00:00:00 2001 From: Neil Garb Date: Wed, 13 Nov 2024 07:29:15 +0200 Subject: [PATCH] Tidy --- rsql/db_internal_test.go | 15 +++++++++------ .../testdata/Test_makeInsertManyQuery/more.golden | 10 +++++----- rsql/testdata/Test_makeInsertManyQuery/one.golden | 2 +- .../Test_makeInsertManyQuery/with_metadata.golden | 2 +- .../Test_makeInsertManyQuery/with_trace.golden | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/rsql/db_internal_test.go b/rsql/db_internal_test.go index 1b5944d..0e46067 100644 --- a/rsql/db_internal_test.go +++ b/rsql/db_internal_test.go @@ -46,7 +46,7 @@ func Test_makeInsertManyQuery(t *testing.T) { t.Run("one", func(t *testing.T) { q, args, err := makeInsertManyQuery(ctx, defaultSchema, []EventToInsert{ - {"fid1", testEventType(1), nil}, + {"fid", testEventType(1), nil}, }) jtest.RequireNil(t, err) assert(t, q, args) @@ -64,7 +64,10 @@ func Test_makeInsertManyQuery(t *testing.T) { t.Run("more", func(t *testing.T) { var events []EventToInsert for i := range 5 { - events = append(events, EventToInsert{"fid", testEventType(i), nil}) + events = append(events, EventToInsert{ + ForeignID: fmt.Sprintf("fid%d", i+1), + Type: testEventType(i), + }) } q, args, err := makeInsertManyQuery(ctx, defaultSchema, events) jtest.RequireNil(t, err) @@ -73,16 +76,16 @@ func Test_makeInsertManyQuery(t *testing.T) { t.Run("metadata_error", func(t *testing.T) { _, _, err := makeInsertManyQuery(ctx, defaultSchema, []EventToInsert{ - {"fid1", testEventType(1), []byte("metadata")}, + {"fid", testEventType(1), []byte("metadata")}, }) - require.ErrorContains(t, err, "metadata not enable") + require.ErrorContains(t, err, "metadata not enabled") }) t.Run("with_metadata", func(t *testing.T) { schemaWithMetadata := defaultSchema schemaWithMetadata.metadataField = "metadata" q, args, err := makeInsertManyQuery(ctx, schemaWithMetadata, []EventToInsert{ - {"fid1", testEventType(1), []byte("metadata")}, + {"fid", testEventType(1), []byte("metadata")}, }) jtest.RequireNil(t, err) assert(t, q, args) @@ -102,7 +105,7 @@ func Test_makeInsertManyQuery(t *testing.T) { jtest.RequireNil(t, err) ctx := tracing.Inject(ctx, data) q, args, err := makeInsertManyQuery(ctx, schemaWithTrace, []EventToInsert{ - {"fid1", testEventType(1), nil}, + {"fid", testEventType(1), nil}, }) jtest.RequireNil(t, err) assert(t, q, args) diff --git a/rsql/testdata/Test_makeInsertManyQuery/more.golden b/rsql/testdata/Test_makeInsertManyQuery/more.golden index 2f809e7..fef9a7d 100644 --- a/rsql/testdata/Test_makeInsertManyQuery/more.golden +++ b/rsql/testdata/Test_makeInsertManyQuery/more.golden @@ -1,12 +1,12 @@ insert into events (foreign_id, type, timestamp) values (?, ?, now(6)), (?, ?, now(6)), (?, ?, now(6)), (?, ?, now(6)), (?, ?, now(6)) -fid +fid1 0 -fid +fid2 1 -fid +fid3 2 -fid +fid4 3 -fid +fid5 4 \ No newline at end of file diff --git a/rsql/testdata/Test_makeInsertManyQuery/one.golden b/rsql/testdata/Test_makeInsertManyQuery/one.golden index da8d066..73f087c 100644 --- a/rsql/testdata/Test_makeInsertManyQuery/one.golden +++ b/rsql/testdata/Test_makeInsertManyQuery/one.golden @@ -1,4 +1,4 @@ insert into events (foreign_id, type, timestamp) values (?, ?, now(6)) -fid1 +fid 1 \ No newline at end of file diff --git a/rsql/testdata/Test_makeInsertManyQuery/with_metadata.golden b/rsql/testdata/Test_makeInsertManyQuery/with_metadata.golden index 3a2d809..3efbdf1 100644 --- a/rsql/testdata/Test_makeInsertManyQuery/with_metadata.golden +++ b/rsql/testdata/Test_makeInsertManyQuery/with_metadata.golden @@ -1,5 +1,5 @@ insert into events (foreign_id, type, timestamp, metadata) values (?, ?, now(6), ?) -fid1 +fid 1 [109 101 116 97 100 97 116 97] \ No newline at end of file diff --git a/rsql/testdata/Test_makeInsertManyQuery/with_trace.golden b/rsql/testdata/Test_makeInsertManyQuery/with_trace.golden index fbf6581..54ac453 100644 --- a/rsql/testdata/Test_makeInsertManyQuery/with_trace.golden +++ b/rsql/testdata/Test_makeInsertManyQuery/with_trace.golden @@ -1,5 +1,5 @@ insert into events (foreign_id, type, timestamp, trace) values (?, ?, now(6), ?) -fid1 +fid 1 [10 32 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 57 18 16 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 50] \ No newline at end of file