Add roomserver tests (1/?) (#2434)

* Add EventJSONTable tests

* Add eventJSON tests

* Add EventStateKeysTable tests

* Add EventTypesTable tests

* Add Events Table tests
Move variable declaration outside loops
Switch to testify/assert for tests

* Move variable declaration outside loop

* Remove random data

* Fix issue where the EventReferenceSHA256 is not set

* Add more tests

* Revert "Fix issue where the EventReferenceSHA256 is not set"

This reverts commit 8ae34c4e5f78584f0edb479f5a893556d2b95d19.

* Update GMSL

* Add tests for duplicate entries

* Test what happens if we select non-existing NIDs

* Add test for non-existing eventType

* Really update GMSL
This commit is contained in:
Till 2022-05-09 15:30:32 +02:00 committed by GitHub
parent 09d754cfbf
commit f69ebc6af2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 499 additions and 88 deletions

View file

@ -10,9 +10,8 @@ import (
)
type EventJSONPair struct {
EventNID types.EventNID
RoomVersion gomatrixserverlib.RoomVersion
EventJSON []byte
EventNID types.EventNID
EventJSON []byte
}
type EventJSON interface {
@ -36,7 +35,8 @@ type EventStateKeys interface {
type Events interface {
InsertEvent(
ctx context.Context, txn *sql.Tx, i types.RoomNID, j types.EventTypeNID, k types.EventStateKeyNID, eventID string,
ctx context.Context, txn *sql.Tx, roomNID types.RoomNID, eventTypeNID types.EventTypeNID,
eventStateKeyNID types.EventStateKeyNID, eventID string,
referenceSHA256 []byte, authEventNIDs []types.EventNID, depth int64, isRejected bool,
) (types.EventNID, types.StateSnapshotNID, error)
SelectEvent(ctx context.Context, txn *sql.Tx, eventID string) (types.EventNID, types.StateSnapshotNID, error)