-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change FindTaskById function #298
Conversation
Change FindTaskByID so that Marathon-Consul can be used with marathon version > 1.9, this change will fix issue: allegro#296 Refactor test so the output resembles marathon v1.9 Also added 3 tests to test the find tasks method. This change should be backwards compatible
@ojagodzinski The build is failing, how can it fixed? See below output of Travis. The package build succeeds now.
|
I enabled tests and removed one that was failing. Running some of them is still better than not running anything ;) |
I don't understand why the test is failing, it works on my computer (after pulling the latest changes). There is no setup needed, I think. @ojagodzinski Do you understand what is happening, based on your experience? |
There is a problem with len(id.String() > 36 condition, test cases have much shorter ids |
That explains a lot indeed! The reason I added the In my opinion we have two solutions:
@ojagodzinski What would you like me to do? I'll pick up the task on monday. |
It is the most dangerous one. We cannot force apps to use names with some arbitrary length.
so it should fail if ID is not resolved.
divide this case into two separate ones and check id via regex not via HasPrefix in marathon >1.9 There should be also test case with two apps of lenght =1 that should not match in this condition. |
The minimal length requirement must be 1. If an id might match more than 1 task, it should fail and give a warning. Because there is an inconsistency with what could have been expected.
I changed the code a bit, to make it possible to match on ids which are of length 1. Downside of this approach that for each search the whole array of tasks needs to be searched, to add more safety. Before this change the search was stopped when a task was found. |
@ojagodzinski What can I do to solve that problem? |
@ojagodzinski How can we resolve the issues in the pull request? I can't reproduce the issues on the travis build. |
This change will fix issue: #296
It makes the FindTaskById function to match also on the first part of an id, so marathon-consul will be compatible with version 1.9 of marathon.
To avoid matching on too little information, also the requirement of at least a length of an id with 36 chars.