mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Parse test for spread
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -23,6 +23,17 @@ job "binstore-storagelocker" {
|
||||
weight = 50
|
||||
}
|
||||
|
||||
spread {
|
||||
attribute = "${meta.rack}"
|
||||
weight = 100
|
||||
target "r1" {
|
||||
percent = 40
|
||||
}
|
||||
target "r2" {
|
||||
percent = 60
|
||||
}
|
||||
}
|
||||
|
||||
update {
|
||||
stagger = "60s"
|
||||
max_parallel = 2
|
||||
@@ -89,6 +100,21 @@ job "binstore-storagelocker" {
|
||||
operator = "="
|
||||
weight = 100
|
||||
}
|
||||
|
||||
spread {
|
||||
attribute = "${node.datacenter}"
|
||||
weight = 50
|
||||
target "dc1" {
|
||||
percent = 50
|
||||
}
|
||||
target "dc2" {
|
||||
percent = 25
|
||||
}
|
||||
target "dc3" {
|
||||
percent = 25
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task "binstore" {
|
||||
driver = "docker"
|
||||
|
||||
Reference in New Issue
Block a user