store: tighten CHECK constraint on host_repo_stats.last_check_status
This commit is contained in:
@@ -138,6 +138,14 @@ func TestMigration0009Schema(t *testing.T) {
|
||||
if lockPresent != 0 {
|
||||
t.Errorf("expected lock_present=0, got %d", lockPresent)
|
||||
}
|
||||
|
||||
// CHECK (last_check_status IN ('ok','errors_found','failed')) must reject
|
||||
// an invalid value.
|
||||
if _, err := s.DB().ExecContext(ctx,
|
||||
`UPDATE host_repo_stats SET last_check_status = ? WHERE host_id = ?`,
|
||||
"wat", "h-0009"); err == nil {
|
||||
t.Fatal("expected CHECK constraint violation on last_check_status='wat', got nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestForeignKeysEnforced(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user