summaryrefslogtreecommitdiff
path: root/matcher
AgeCommit message (Collapse)AuthorFilesLines
2018-10-04Fix finishing a JobLukasz Wojciechowski4-13/+41
There are some situations, when Job is finished: * when the request was completed either by CloseRequest or Job timeout; * when Job was interrupted by Dryad failure or by putting Dryad into MAINTENANCE state. The Worker must be prepared only in the first situation. In the second situation Worker should remain in FAIL or MAINTENANCE state. This patch enhances JobsManager interface's Finish method with additional boolean parameter informing if worker should be prepared. Change-Id: I5e527da610b3e34d034b3aaf5fbea7719bbe5e56 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-09-05Get rid of dot imports of boruta packageMaciej Wereski8-34/+34
Using dot imports should be avoided. Such imports were left only in some tests. Change-Id: I1d4db1e2b89e2fd8475c8c657ea72b70bba32c5b Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-08-03Use address of ssh daemon when creating a tunnelAleksander Mistewicz5-43/+46
Change-Id: Ie66daa17104be1ea06849eccaaee78b2b4353c2e Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com> Use net.TCPAddr instead of net.IP as it contains Port field. Some methods were renamed to reflect migration from net.IP to net.TCPAddr. It allows multiple dryads to coexist behind NAT or on a single host. Currently, it is possible to provide network addresses to non-existent address or to a different dryad than expected. Addresses in Register() call are checked only for resolvability. Change-Id: I46cecb8ad6f06fabb88f2262d95c0678329915ab Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
2018-04-27Implement closing requestLukasz Wojciechowski2-1/+6
Adjust test for CloseRequest. Change-Id: I0bc0399206f3285cdd8e20eacf1a5d25815e54f7 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add TimeoutMatcher with testsLukasz Wojciechowski2-0/+115
TimeoutMatcher is a Matcher interface implementation for handling running requests timeouts caused by expiration of requests' job timeout. It tries to run Close on all reported requests. Some of the timeouts might be invalid, because the request has changed it's state to done or failed. Tests base on using MockRequestsManager for mocking up RequestsManager interface. Change-Id: I6540ab50eb84f8ab1b9737ad71e7ae3a5ddd3170 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add DeadlineMatcher with testsLukasz Wojciechowski2-0/+119
DeadlineMatcher is a Matcher interface implementation for handling pending requests timeouts caused by expiration of Deadline times. It tries to set Timeout on all reported requests. Some of the timeouts might be invalid, because the request has change it's state to canceled or running; or the Deadline time itself has been changed. Tests base on using MockRequestsManager for mocking up RequestsManager interface. Change-Id: I4d790b58a26aa7389250ff57b6bfad662d4d3f7b Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add ValidMatcher with testsLukasz Wojciechowski2-0/+296
ValidMatcher is a Matcher interface implementation for handling events related to validation of requests after ValidAfter time is passed. It matches pending, ready to be run requests with idle workers that are capable to fulfill request capabilities and belong to group for which request owner has rights. Tests base on using MockRequestsManager, MockWorkersManager and MockJobsManager for mocking up RequestsManager, WorkersManager and JobsManager interfaces. Change-Id: Ib654f1ef276eecb14dc4ad3114afcccd83a7bf5d Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add RequestsManager interfaceLukasz Wojciechowski2-0/+181
RequestsManager interface defines API for taking actions triggered by matcher events on requests structures. The mock implementation of interface is provided in matcher package. It is generated using mockgen command: mockgen -package matcher \ -destination=matcher/requestsmanager_mock_test.go \ -write_package_comment=false \ git.tizen.org/tools/boruta/matcher RequestsManager Change-Id: Idbf83988dba4cfa761dbfe8cae0a33d0a39245ac Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add JobsManager implementation with testsLukasz Wojciechowski4-0/+382
JobsManagerImpl implements JobsManager interface providing support for jobs management. It uses provided WorkManager for managing workers and Tunnels implementation of Tunneler for handling tunnels. Tests base on usage of MockWorkersManager and MockTunneler for mockuping access to workers and tunnels. Change-Id: I4c469f32fc4f918641f69843567b39bfcce8da4c Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-04-27Add JobsManager interfaceLukasz Wojciechowski2-0/+107
JobsManager interface defines API for taking actions on jobs. The mock implementation of interface is provided in matcher package. It is generated using mockgen command: mockgen -package matcher \ -destination=matcher/jobsmanager_mock_test.go \ -write_package_comment=false \ git.tizen.org/tools/boruta/matcher JobsManager Change-Id: I950b68cbadd2a2e7be3d65406d36082d6ac29ee4 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Move tunnels from workers to separate packageLukasz Wojciechowski1-0/+69
Tunnels package provides implementation of simple data forwarding tunnels between IP addresses pairs. The implementation has been moved from workers package and adjusted to newly defined Tunneler interface. The interface defines basic operations on tunnels (creation, getting address, closing). It provides additional layer of abstraction allowing mockuping tests of parts of the code using tunnels. The mock implementation of interface is provided in matcher package. It is generated using mockgen command: mockgen -package matcher \ -destination=matcher/tunneler_mock_test.go \ -write_package_comment=false \ git.tizen.org/tools/boruta/tunnels Tunneler Change-Id: Ida42f0134f0c365c8f1ffe772b859a0218c301ed Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com> Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
2018-04-27Add WorkersManager interfaceLukasz Wojciechowski2-0/+151
WorkersManager interface defines API for taking actions triggered by matcher events on workers structures. The mock implementation of interface is provided in matcher package. It is generated using mockgen command: mockgen -package matcher \ -destination=matcher/workersmanager_mock_test.go \ -write_package_comment=false \ git.tizen.org/tools/boruta/matcher WorkersManager Change-Id: I026c661696b19a3443afc430e46d96abf9a272d5 Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2018-04-27Add matcher interfaceLukasz Wojciechowski1-0/+31
Matcher is an interface for taking actions related to assigning requests to workers and reacting to requests time events. It should be implemented by objects that are notified about such events. Change-Id: I8c7e3931e16fea8ce8be8f7dbdf28f5a3c13c11e Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>