mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
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:
parent
09d754cfbf
commit
f69ebc6af2
17 changed files with 499 additions and 88 deletions
|
@ -59,12 +59,12 @@ type eventJSONStatements struct {
|
|||
bulkSelectEventJSONStmt *sql.Stmt
|
||||
}
|
||||
|
||||
func createEventJSONTable(db *sql.DB) error {
|
||||
func CreateEventJSONTable(db *sql.DB) error {
|
||||
_, err := db.Exec(eventJSONSchema)
|
||||
return err
|
||||
}
|
||||
|
||||
func prepareEventJSONTable(db *sql.DB) (tables.EventJSON, error) {
|
||||
func PrepareEventJSONTable(db *sql.DB) (tables.EventJSON, error) {
|
||||
s := &eventJSONStatements{}
|
||||
|
||||
return s, sqlutil.StatementList{
|
||||
|
@ -97,9 +97,9 @@ func (s *eventJSONStatements) BulkSelectEventJSON(
|
|||
// We might get fewer results than NIDs so we adjust the length of the slice before returning it.
|
||||
results := make([]tables.EventJSONPair, len(eventNIDs))
|
||||
i := 0
|
||||
var eventNID int64
|
||||
for ; rows.Next(); i++ {
|
||||
result := &results[i]
|
||||
var eventNID int64
|
||||
if err := rows.Scan(&eventNID, &result.EventJSON); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue