Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed May 29, 2024
1 parent eb80645 commit e3bee27
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/identity/api/v1/identity_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestPublishedUpdatesCanBeRead(t *testing.T) {
svc, _, cleanup := newTestService(t, ctx)
defer cleanup()

inbox_id := "test_inbox"
inbox_id := test.RandomInboxId()
address := "test_address"

_, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address)))
Expand All @@ -173,7 +173,7 @@ func TestPublishedUpdatesAreInOrder(t *testing.T) {
svc, _, cleanup := newTestService(t, ctx)
defer cleanup()

inbox_id := "test_inbox"
inbox_id := test.RandomInboxId()
address := "test_address"

_, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address)))
Expand Down Expand Up @@ -210,10 +210,10 @@ func TestQueryMultipleInboxes(t *testing.T) {
svc, _, cleanup := newTestService(t, ctx)
defer cleanup()

first_inbox_id := "test_inbox"
second_inbox_id := "second_inbox"
first_address := "test_address"
second_address := "test_address"
first_inbox_id := test.RandomInboxId()
second_inbox_id := test.RandomInboxId()
first_address := test.RandomInboxId()
second_address := test.RandomInboxId()

_, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(first_inbox_id, makeCreateInbox(first_address)))
require.NoError(t, err)
Expand All @@ -233,7 +233,7 @@ func TestInboxSizeLimit(t *testing.T) {
svc, _, cleanup := newTestService(t, ctx)
defer cleanup()

inbox_id := "test_inbox"
inbox_id := test.RandomInboxId()
address := "test_address"

_, err := svc.PublishIdentityUpdate(ctx, publishIdentityUpdateRequest(inbox_id, makeCreateInbox(address)))
Expand Down
2 changes: 1 addition & 1 deletion pkg/migrations/mls/20240528181851_init-schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CREATE INDEX idx_address_log_address_inbox_id ON address_log(address, inbox_id);

--bun:split
CREATE TYPE inbox_filter AS (
inbox_id BYTEA,
inbox_id TEXT, -- Because this is serialized as JSON, we can't use a BYTEA type
sequence_id BIGINT
);

2 changes: 1 addition & 1 deletion pkg/mls/store/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ FROM
*
FROM
json_populate_recordset(NULL::inbox_filter, @filters) AS b(inbox_id,
sequence_id)) AS b ON b.inbox_id = a.inbox_id
sequence_id)) AS b ON decode(b.inbox_id, 'hex') = a.inbox_id::BYTEA
AND a.sequence_id > b.sequence_id
ORDER BY
a.sequence_id ASC;
Expand Down
2 changes: 1 addition & 1 deletion pkg/mls/store/queries/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/mls/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,14 @@ func (s *Store) GetInboxLogs(ctx context.Context, batched_req *identity.GetIdent

filters := make(queries.InboxLogFilterList, len(reqs))
for i, req := range reqs {
s.log.Info("Filtering for inbox_id", zap.Any("inbox_id", req.InboxId))
filters[i] = queries.InboxLogFilter{
InboxId: req.InboxId,
SequenceId: int64(req.SequenceId),
}
}
filterBytes, err := filters.ToSql()
s.log.Info("Filter bytes", zap.Any("filter_bytes", filterBytes))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e3bee27

Please sign in to comment.