Changing how constraints are handled internally (#115)

* Updating Changelog to reflect what's changing in 1.22.1

* Bug fix: Setting the same constraint multiple times is no longer allowed.

* Constraints map has been added to handle constraints being added to Aurora Jobs.

* Lowering timeout to avoid flaky test for bad payload timeout.

* Adding attributes to Mesos agents in order to test limits by constraint.



* Make two instances schedulable per zone in order to experience flaky behavior.
This commit is contained in:
Renan I. Del Valle 2020-01-15 08:21:12 -08:00 committed by GitHub
parent 9da3b96b1f
commit c6a2a23ddb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 37 deletions

View file

@ -306,6 +306,40 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
_, err = r.KillJob(job.JobKey())
assert.NoError(t, err)
})
t.Run("Duplicate_constraints", func(t *testing.T) {
job.Name("thermos_duplicate_constraints").
AddValueConstraint("zone", false, "east", "west").
AddValueConstraint("zone", false, "east").
AddValueConstraint("zone", true, "west")
_, err := r.CreateJob(job)
require.NoError(t, err)
success, err := monitor.Instances(job.JobKey(), 2, 1, 50)
assert.True(t, success)
assert.NoError(t, err)
_, err = r.KillJob(job.JobKey())
assert.NoError(t, err)
})
t.Run("Overwrite_constraints", func(t *testing.T) {
job.Name("thermos_overwrite_constraints").
AddLimitConstraint("zone", 1).
AddValueConstraint("zone", true, "west", "east").
AddLimitConstraint("zone", 2)
_, err := r.CreateJob(job)
require.NoError(t, err)
success, err := monitor.Instances(job.JobKey(), 2, 1, 50)
assert.True(t, success)
assert.NoError(t, err)
_, err = r.KillJob(job.JobKey())
assert.NoError(t, err)
})
}
// Test configuring an executor that doesn't exist for CreateJob API
@ -505,7 +539,7 @@ func TestRealisClient_CreateService(t *testing.T) {
timeoutClient, err := realis.NewRealisClient(
realis.SchedulerUrl(auroraURL),
realis.BasicAuth("aurora", "secret"),
realis.TimeoutMS(10),
realis.TimeoutMS(5),
)
require.NoError(t, err)
defer timeoutClient.Close()