Parse test for spread

This commit is contained in:
Preetha Appan
2018-07-18 12:28:26 -05:00
parent ed4ed16b5d
commit 0e2fefad36
2 changed files with 63 additions and 0 deletions

View File

@@ -55,6 +55,23 @@ func TestParse(t *testing.T) {
},
},
Spreads: []*api.Spread{
{
Attribute: "${meta.rack}",
Weight: 100,
SpreadTarget: []*api.SpreadTarget{
{
Value: "r1",
Percent: 40,
},
{
Value: "r2",
Percent: 60,
},
},
},
},
Update: &api.UpdateStrategy{
Stagger: helper.TimeToPtr(60 * time.Second),
MaxParallel: helper.IntToPtr(2),
@@ -112,6 +129,26 @@ func TestParse(t *testing.T) {
Delay: helper.TimeToPtr(15 * time.Second),
Mode: helper.StringToPtr("delay"),
},
Spreads: []*api.Spread{
{
Attribute: "${node.datacenter}",
Weight: 50,
SpreadTarget: []*api.SpreadTarget{
{
Value: "dc1",
Percent: 50,
},
{
Value: "dc2",
Percent: 25,
},
{
Value: "dc3",
Percent: 25,
},
},
},
},
ReschedulePolicy: &api.ReschedulePolicy{
Interval: helper.TimeToPtr(12 * time.Hour),
Attempts: helper.IntToPtr(5),