Commit Graph

440 Commits

Author SHA1 Message Date
pancho horrillo
273058c3ba Add testutils/jaillover to assist testing process spawning
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-09 16:17:21 +02:00
Héctor Hurtado
2e2fcc4edd Skip WIP in listRoutes tests 2019-10-09 15:50:14 +02:00
Héctor Hurtado
544b01a1ff Merge branch 'master' of ssh://github.com/BBVA/kapow 2019-10-09 15:46:57 +02:00
Héctor Hurtado
876e4da43a Fixed tests for listRoutes and removeRoute 2019-10-09 15:46:49 +02:00
pancho horrillo
49252a78a6 Fix misuse of gorilla/mux.Router{} use mux.NewRouter() instead
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-09 15:22:50 +02:00
César Gallego Rodríguez
6e387eab37 new WIP Tests about mandatory fields 2019-10-09 14:26:44 +02:00
César Gallego Rodríguez
12579c7ac3 fixme about routes added 2019-10-09 14:19:58 +02:00
César Gallego Rodríguez
046d8ffe7d linter fixes 2019-10-09 14:18:54 +02:00
César Gallego Rodríguez
f60c8a2423 control delete route no content on sucess 2019-10-09 14:10:18 +02:00
César Gallego Rodríguez
f14d4ff512 add .vscode directory to ignore file 2019-10-09 13:52:10 +02:00
César Gallego Rodríguez
7c95726a8c 442 when missing mandatory fields (WIP) 2019-10-09 13:51:34 +02:00
pancho horrillo
401644b65e Finish gorillize()
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-09 13:10:04 +02:00
Héctor Hurtado
7d1f0bf97c Added content type check in responses for control api tests 2019-10-09 13:04:11 +02:00
Héctor Hurtado
9b5e39ee9c Added test fot removeRoute and listRoutes in control api 2019-10-09 12:02:43 +02:00
Héctor Hurtado
b794af01e0 Coorected control api test function names 2019-10-09 12:00:47 +02:00
Roberto Abdelkader Martínez Pérez
8729e1e492 Implement Route.Delete()
Co-authored-by: pancho horrillo <pedrofelipe.horrillo@bbva.com>
2019-10-09 11:45:41 +02:00
César Gallego Rodríguez
0249dc722b Merge branch 'master' of personal.github.com:BBVA/kapow 2019-10-09 10:27:46 +02:00
César Gallego Rodríguez
4ca5ef0d54 When marformed route then bad request implementation 2019-10-09 10:27:38 +02:00
Héctor Hurtado
95aea4bce1 Replaced calls to Snapshot by List when accessing Routes state package 2019-10-09 10:22:43 +02:00
Roberto Abdelkader Martínez Pérez
6810cb99ee Add List method to Routes singletone returning the list of numbered routes 2019-10-09 09:54:27 +02:00
Héctor Hurtado
4164f3e3de Added control api validation test for addRoute 2019-10-09 09:39:36 +02:00
Roberto Abdelkader Martínez Pérez
31f6015110 Increase legibility of gorillize function 2019-10-09 08:39:12 +02:00
Roberto Abdelkader Martínez Pérez
f656f9f3b0 Change function gorillize signature slightly 2019-10-08 21:09:48 +02:00
pancho horrillo
2cd96d5a4b Add the controversial gorillize()
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-08 19:39:44 +02:00
pancho horrillo
037347dbe3 Augment safeRouteList.Append() to return a model.Route with index
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-08 17:53:15 +02:00
pancho horrillo
e0dd6f5dd5 Refactor internal/server/user package structure
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-08 17:22:09 +02:00
Héctor Hurtado
6df4369358 Added test for checking Index 2019-10-08 16:18:51 +02:00
Héctor Hurtado
4a258e74ce Added Index fient to the Route model 2019-10-08 15:40:43 +02:00
pancho horrillo
2eb32610a0 Exclude test from race condition verification
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-08 15:34:42 +02:00
pancho horrillo
9ad61249b3 Fix linter warning
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-08 15:33:32 +02:00
Héctor Hurtado
a4b1a5504b Merge branch 'master' of ssh://github.com/BBVA/kapow 2019-10-08 15:15:02 +02:00
Héctor Hurtado
198584f517 First green in control server 2019-10-08 15:14:50 +02:00
pancho horrillo
3b405bd9f6 Add ServeHTTP() method to swappableMux struct
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-08 15:06:08 +02:00
Héctor Hurtado
3fa2357f71 First failing test in control package 2019-10-08 12:35:05 +02:00
Héctor Hurtado
8fe46d1c6b Merge branch 'master' of ssh://github.com/BBVA/kapow 2019-10-08 12:03:13 +02:00
Héctor Hurtado
fe7d962581 Reworking in module definition 2019-10-08 12:02:46 +02:00
Roberto Abdelkader Martínez Pérez
0eb802ea78 Change to latest linter version 2019-10-08 09:48:04 +02:00
Héctor Hurtado
73e05afee3 Merge branch 'master' of ssh://github.com/BBVA/kapow 2019-10-08 09:42:03 +02:00
Héctor Hurtado
98faa6f155 Merge branch 'feature_server_launcher' 2019-10-08 09:41:19 +02:00
Héctor Hurtado
bb0a283813 Prepare to merge master 2019-10-08 09:40:51 +02:00
Roberto Abdelkader Martínez Pérez
f346392eea Add linter to makefile and to circleci 2019-10-08 09:26:57 +02:00
Héctor Hurtado
02f0410685 Merge branch 'feature_control_server' 2019-10-08 09:21:27 +02:00
Héctor Hurtado
e32116abad Rewrite 2019-10-08 09:20:58 +02:00
Roberto Abdelkader Martínez Pérez
0348df1df5 Prevent linter from reporting a deprecation warning in a test 2019-10-08 09:09:47 +02:00
Roberto Abdelkader Martínez Pérez
22f03eb67f Move swappableMux and its methods to its own module 2019-10-08 09:01:40 +02:00
Héctor Hurtado
7fdef70e39 Moved to internal 2019-10-08 08:56:04 +02:00
Héctor Hurtado
56db1ce2ac Moved to internal 2019-10-08 08:54:07 +02:00
pancho horrillo
0cab49f082 Simplify handling of http.Client response
As per the doc¹:

  If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close.
  ...
  On error, any Response can be ignored. A non-nil Response with a non-nil error
  only occurs when CheckRedirect fails, and even then the returned Response.Body
  is already closed.

It is thus safe to defer res.Body.Close() as soon as err has been determined to
be nil.

Also, I've dispensed with the separate variable client, since it is not used
later.

¹: https://godoc.org/net/http#Client.Do
2019-10-08 05:42:33 +02:00
pancho horrillo
7ba54b32b3 Revert to using strings for simplicity
It is safe in this case.

* gock.BodyString(body string) coerces body into a []byte
* client.SetData() eventually resolves to a call to http.Client.Do(), which
handles the string gracefully as well.
2019-10-08 05:28:29 +02:00
pancho horrillo
10586bae95 Add internal/server/user/server{,_test}.go
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
2019-10-07 19:05:59 +02:00