Skip to content

Commit

Permalink
feat: add Timezone info to Autoscale
Browse files Browse the repository at this point in the history
  • Loading branch information
crgisch committed Nov 24, 2023
1 parent 815abcc commit 9e308d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tsuru/client/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ func buildScheduleInfo(schedule tsuru.AutoScaleSchedule) string {
startTimeHuman, _ := exprDesc.ToDescription(schedule.Start, cron.Locale_en)
endTimeHuman, _ := exprDesc.ToDescription(schedule.End, cron.Locale_en)

return fmt.Sprintf("Start: %s (%s)\nEnd: %s (%s)\nUnits: %d",
startTimeHuman, schedule.Start, endTimeHuman, schedule.End, schedule.MinReplicas,
return fmt.Sprintf("Start: %s (%s)\nEnd: %s (%s)\nUnits: %d\nTimezone: %s",
startTimeHuman, schedule.Start, endTimeHuman, schedule.End, schedule.MinReplicas, schedule.Timezone,
)
}

Expand Down
13 changes: 8 additions & 5 deletions tsuru/client/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1611,14 +1611,14 @@ Process: web (v10), Min Units: 1, Max Units: 10
+----------+-----------------+
| Triggers | Trigger details |
+----------+-----------------+
| CPU | Target: 20% |
| CPU | Target: 50% |
+----------+-----------------+
Process: worker (v10), Min Units: 2, Max Units: 5
+----------+-----------------+
| Triggers | Trigger details |
+----------+-----------------+
| CPU | Target: 20% |
| CPU | Target: 200% |
+----------+-----------------+
`
Expand Down Expand Up @@ -1697,7 +1697,7 @@ func (s *S) TestAppInfoWithKEDAAutoScale(c *check.C) {
"minReplicas":1,
"start":"0 0 * * *",
"end":"0 6 * * *",
"timezone":"UTC"
"timezone":"America/Sao_Paulo"
}
]
}
Expand Down Expand Up @@ -1733,26 +1733,29 @@ Process: web (v10), Min Units: 1, Max Units: 10
+----------+---------------------------------+
| Triggers | Trigger details |
+----------+---------------------------------+
| CPU | Target: 20% |
| CPU | Target: 50% |
+----------+---------------------------------+
| Schedule | Start: At 06:00 AM (0 6 * * *) |
| | End: At 06:00 PM (0 18 * * *) |
| | Units: 2 |
| | Timezone: UTC |
+----------+---------------------------------+
| Schedule | Start: At 12:00 PM (0 12 * * *) |
| | End: At 03:00 PM (0 15 * * *) |
| | Units: 3 |
| | Timezone: UTC |
+----------+---------------------------------+
Process: worker (v10), Min Units: 2, Max Units: 5
+----------+--------------------------------+
| Triggers | Trigger details |
+----------+--------------------------------+
| CPU | Target: 20% |
| CPU | Target: 200% |
+----------+--------------------------------+
| Schedule | Start: At 12:00 AM (0 0 * * *) |
| | End: At 06:00 AM (0 6 * * *) |
| | Units: 1 |
| | Timezone: America/Sao_Paulo |
+----------+--------------------------------+
`
Expand Down

0 comments on commit 9e308d3

Please sign in to comment.