Storage: Watch tests (#85496)

* basic watch tests working

* refactor to read previous event within poller

* add watch test files

* cleanup

* watch tests passing

* debug cleanup

* special handling for canceled context

* cleanup

* fix wire

* fix sqlite_sequence cleanup issue

* move watch tests to integration, wait for provisioned dashboards

* handle context deadline exceeded and eof errors

* add comment about sleep
This commit is contained in:
Dan Cech
2024-04-08 11:42:12 -04:00
committed by GitHub
parent 0672bdf397
commit 5dfe4cf407
13 changed files with 1579 additions and 582 deletions
@@ -122,7 +122,11 @@ func (db *SQLite3) TruncateDBTables(engine *xorm.Engine) error {
}
}
if _, err := sess.Exec("UPDATE sqlite_sequence SET seq = 0 WHERE name != 'dashboard_acl';"); err != nil {
return fmt.Errorf("failed to cleanup sqlite_sequence: %w", err)
// if we have not created any autoincrement columns in the database this will fail, the error is expected and we can ignore it
// we can't discriminate based on code because sqlite returns a generic error code
if err.Error() != "no such table: sqlite_sequence" {
return fmt.Errorf("failed to cleanup sqlite_sequence: %w", err)
}
}
return nil
}