Skip to content

Commit d0f4ab6

Browse files
committed
Add tests
1 parent 66e5485 commit d0f4ab6

File tree

3 files changed

+352
-4
lines changed

3 files changed

+352
-4
lines changed

pkg/chunk/dynamodb_table_client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ func (d dynamoTableClient) UpdateTable(ctx context.Context, current, expected Ta
247247
enableAutoScaling := !current.WriteScaleEnabled && expected.WriteScaleEnabled
248248
updateAutoScaling := current.WriteScaleEnabled && expected.WriteScaleEnabled && !current.AutoScalingEquals(expected)
249249
if disableAutoScaling {
250-
err := d.disableAutoScaling(ctx, current)
250+
err := d.disableAutoScaling(ctx, expected)
251251
if err != nil {
252252
return err
253253
}
254254
} else if enableAutoScaling || updateAutoScaling {
255-
err := d.enableAutoScaling(ctx, current)
255+
err := d.enableAutoScaling(ctx, expected)
256256
if err != nil {
257257
return err
258258
}
@@ -306,7 +306,7 @@ func (d dynamoTableClient) UpdateTable(ctx context.Context, current, expected Ta
306306
}
307307

308308
func (d dynamoTableClient) enableAutoScaling(ctx context.Context, desc TableDesc) error {
309-
// Register scallable target
309+
// Registers or updates a scallable target
310310
if err := d.backoffAndRetry(ctx, func(ctx context.Context) error {
311311
return instrument.TimeRequestHistogram(ctx, "ApplicationAutoScaling.RegisterScalableTarget", applicationAutoScalingRequestDuration, func(ctx context.Context) error {
312312
input := &applicationautoscaling.RegisterScalableTargetInput{
@@ -327,7 +327,7 @@ func (d dynamoTableClient) enableAutoScaling(ctx context.Context, desc TableDesc
327327
return err
328328
}
329329

330-
// Put scaling policy
330+
// Puts or updates a scaling policy
331331
if err := d.backoffAndRetry(ctx, func(ctx context.Context) error {
332332
return instrument.TimeRequestHistogram(ctx, "ApplicationAutoScaling.PutScalingPolicy", applicationAutoScalingRequestDuration, func(ctx context.Context) error {
333333
input := &applicationautoscaling.PutScalingPolicyInput{

pkg/chunk/table_manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ func (m *TableManager) calculateExpectedTables() []TableDesc {
182182

183183
if m.cfg.UsePeriodicTables {
184184
// if we are before the switch to periodic table, we need to give this table write throughput
185+
185186
var (
186187
tablePeriodSecs = int64(m.cfg.IndexTables.Period / time.Second)
187188
gracePeriodSecs = int64(m.cfg.CreationGracePeriod / time.Second)

0 commit comments

Comments
 (0)