Variable Batch Update Support (#100)
* Changing generateBinding.sh check to check for thrift 0.12.0 and adding support for Variable Batch updates. * Adding update strategies change to changelog, changed docker-compose to point to aurora 0.22.0 snapshot. Added test coverage for update strategies.
This commit is contained in:
parent
0b2dd44d94
commit
fe692040aa
10 changed files with 1684 additions and 1013 deletions
|
@ -916,3 +916,70 @@ func TestAuroraJob_UpdateSlaPolicy(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRealisClient_UpdateStrategies(t *testing.T) {
|
||||
|
||||
// Create a single job
|
||||
job := realis.NewJob().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(thermosPayload)).
|
||||
CPU(.01).
|
||||
RAM(4).
|
||||
Disk(10).
|
||||
InstanceCount(6).
|
||||
IsService(true)
|
||||
|
||||
strategies := []struct {
|
||||
UpdateJob *realis.UpdateJob
|
||||
Name string
|
||||
}{
|
||||
{
|
||||
UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()).
|
||||
QueueUpdateStrategy(aurora.QueueJobUpdateStrategy{GroupSize: 2}).
|
||||
InstanceCount(6).
|
||||
WatchTime(1000),
|
||||
Name: "Queue",
|
||||
},
|
||||
{
|
||||
UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()).
|
||||
BatchUpdateStrategy(aurora.BatchJobUpdateStrategy{GroupSize: 2}).
|
||||
InstanceCount(6).
|
||||
WatchTime(1000),
|
||||
Name: "Batch",
|
||||
},
|
||||
{
|
||||
UpdateJob: realis.NewDefaultUpdateJob(job.TaskConfig()).
|
||||
VariableBatchStrategy(aurora.VariableBatchJobUpdateStrategy{GroupSizes: []int32{1, 2, 3}}).
|
||||
InstanceCount(6).
|
||||
WatchTime(1000),
|
||||
Name: "VarBatch",
|
||||
},
|
||||
}
|
||||
|
||||
for _, strategy := range strategies {
|
||||
t.Run("TestRealisClient_UpdateStrategies_"+strategy.Name, func(t *testing.T) {
|
||||
job.Name("update_strategies_" + strategy.Name)
|
||||
resp, err := r.StartJobUpdate(strategy.UpdateJob, "")
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, resp)
|
||||
assert.NotNil(t, resp.GetResult_())
|
||||
assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_())
|
||||
assert.NotNil(t, resp.GetResult_().GetStartJobUpdateResult_().GetKey())
|
||||
|
||||
var ok bool
|
||||
var mErr error
|
||||
key := *resp.GetResult_().GetStartJobUpdateResult_().GetKey()
|
||||
|
||||
if ok, mErr = monitor.JobUpdate(key, 5, 240); !ok || mErr != nil {
|
||||
// Update may already be in a terminal state so don't check for error
|
||||
_, err := r.AbortJobUpdate(key, "Monitor timed out.")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
_, err = r.KillJob(job.JobKey())
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue