more json test cases

This commit is contained in:
Darien Raymond
2016-02-04 10:43:04 +00:00
parent be57f48bb3
commit c74bcc9c50
4 changed files with 68 additions and 8 deletions

View File

@@ -95,6 +95,14 @@ func (this *InboundDetourAllocationConfig) UnmarshalJSON(data []byte) error {
this.Strategy = jsonConfig.Strategy
this.Concurrency = jsonConfig.Concurrency
this.Refresh = jsonConfig.RefreshMin
if this.Strategy == AllocationStrategyRandom {
if this.Refresh == 0 {
this.Refresh = 5
}
if this.Concurrency == 0 {
this.Concurrency = 3
}
}
if this.Refresh == 0 {
this.Refresh = DefaultRefreshMinute
}
@@ -128,14 +136,6 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
Refresh: DefaultRefreshMinute,
}
}
if this.Allocation.Strategy == AllocationStrategyRandom {
if this.Allocation.Refresh == DefaultRefreshMinute {
this.Allocation.Refresh = 5
}
if this.Allocation.Concurrency == 0 {
this.Allocation.Concurrency = 3
}
}
return nil
}