fix: resolve flaky holiday hours test and clean up dev scripts

- Use fixed date (Thursday Feb 26, 2026) instead of dynamic tomorrow
  to avoid timezone-related test flakiness
- Remove orphaned SQL fragment from init-script.sql
- Clean up duplicate color code definitions in local-dev-2.sh
- Add Rustfs data wipe and SabreDAV startup to dev script
- Add composer.lock to .gitignore
This commit is contained in:
2026-02-24 23:42:40 +00:00
parent c6fe9e92a7
commit ea1a80dbda
5 changed files with 32 additions and 28 deletions
+16 -8
View File
@@ -857,8 +857,9 @@ func TestAdminBookings_Create_DuringHolidayHours_Rejected(t *testing.T) {
}
defer fixtures.DeleteService(db.DB, serviceID)
// Create an exceptional (holiday) hours group for tomorrow
tomorrowDate := time.Now().AddDate(0, 0, 1)
// Create an exceptional (holiday) hours group for a fixed date (Thursday)
// Using absolute date - no timezone conversions
targetDate := time.Date(2026, 2, 26, 0, 0, 0, 0, time.UTC) // Thursday Feb 26, 2026
var groupID int
err = db.DB.QueryRow(context.Background(), `
INSERT INTO exceptional_working_hours_groups (name, description)
@@ -870,29 +871,36 @@ func TestAdminBookings_Create_DuringHolidayHours_Rejected(t *testing.T) {
}
defer db.DB.Exec(context.Background(), "DELETE FROM exceptional_working_hours_groups WHERE id = $1", groupID)
// Add closed hours for tomorrow (closed all day)
// Add closed hours for targetDate (closed all day)
_, err = db.DB.Exec(context.Background(), `
INSERT INTO exceptional_working_hours (group_id, weekday, start_time, end_time, is_open)
VALUES ($1, $2, $3, $4, $5)
`, groupID, int(tomorrowDate.Weekday()), "00:00:00", "23:59:59", false)
`, groupID, int(targetDate.Weekday()), "00:00:00", "23:59:59", false)
if err != nil {
t.Fatalf("failed to create holiday hours: %v", err)
}
// Apply the group to the week containing tomorrow
// Apply the group to the week containing targetDate
// Must use Monday of that week (matching handler logic)
targetWeekday := int(targetDate.Weekday())
if targetWeekday == 0 {
targetWeekday = 7 // Sunday -> 7
}
mondayOfWeek := targetDate.AddDate(0, 0, -targetWeekday+1)
_, err = db.DB.Exec(context.Background(), `
INSERT INTO exceptional_group_applications (group_id, week_start)
VALUES ($1, $2)
`, groupID, tomorrowDate)
`, groupID, mondayOfWeek)
if err != nil {
t.Fatalf("failed to create holiday application: %v", err)
}
// Try to create booking during holiday - should fail
tomorrowTime := tomorrowDate.Add(14 * time.Hour).Truncate(time.Second) // 2 PM tomorrow
targetTime := targetDate.Add(14 * time.Hour).Truncate(time.Second) // 2 PM on targetDate
req := bookings.AdminCreateBookingForUserRequest{
UserID: userID,
StartTime: tomorrowTime,
StartTime: targetTime,
ServiceIDs: []string{serviceID},
}