{"id":268539,"date":"2015-11-19T12:53:08","date_gmt":"2015-11-19T09:53:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=268539"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=268539","title":{"rendered":"\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Go"},"content":{"rendered":"<p>       \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f http-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 Go. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043d\u043e \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0439\u0434\u0435\u0442 Docker, \u043f\u0430\u043a\u0435\u0442 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 httptest \u0438 \u0431\u0438\u043b\u0434-\u0442\u0435\u0433\u0438. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u043c goose. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b go test, \u0431\u0443\u0434\u044c \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0438\u043b\u0438 Continuous Integration \u0441\u0435\u0440\u0432\u0435\u0440.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f25\/bdd\/451\/f25bdd4517e73bb454c7682618612ce0.png\" alt=\"image\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u044b<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u043a\u0430\u043a Go \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0432\u0442\u043e\u0440\u044b Go \u0434\u0435\u043b\u0430\u044e\u0442 \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e Go \u0441\u0442\u0438\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u2014 \u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430, \u0438\u0437 \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0445 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Go \u2014 \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0438 \u0438\u0434\u0451\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0439 <a href=\"https:\/\/golang.org\/pkg\/testing\/\">\u043c\u0438\u043d\u0438\u043c\u0443\u043c<\/a>.<\/p>\n<p>  \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c:  <\/p>\n<ul>\n<li>\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u2014 <b>go test<\/b><\/li>\n<li>\u0442\u0435\u0441\u0442\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 *_test.go. \u041a\u043e\u0434 \u0432 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0430\u0445.<\/li>\n<li>\u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f TestXxx(t *testing.T) \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<li>\u0432 \u043f\u0430\u043a\u0435\u0442\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/golang.org\/pkg\/testing\/\">testing<\/a> \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<\/li>\n<\/ul>\n<p>  \u0421\u043a\u0430\u0436\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u043a\u0440\u0443\u0433\u0430, \u0442\u0435\u0441\u0442 \u043d\u0430 Go \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"go\">package main  import ( \t&quot;math&quot; \t&quot;testing&quot; )  func TestCircle(t *testing.T) { \tarea := CircleArea(10) \twant := 100 * math.Pi \tif area != want { \t\tt.Fatalf(&quot;Want %v, but got %v&quot;, want, area) \t} } <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u043a \u043a \u0443\u043c\u043d\u044b\u043c assert-\u0430\u043c \u0438 \u043e\u0431\u0435\u0440\u0442\u043a\u0430\u043c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u043c. \u041d\u043e \u00ab\u0443\u043c\u043d\u044b\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u00bb \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0443\u0436 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0438 \u043e\u0442\u0434\u0430\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u043e\u0442\u043a\u0443\u043f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u043f\u0430\u043a\u0435\u0442\u0430\u043c, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435. \u0422\u0430\u043a\u043e\u0439 \u0436\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0440\u043e\u0433\u043e\u043c \u0432\u0445\u043e\u0434\u0430 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0438 \u0431\u0435\u0437 \u043f\u043e\u0432\u043e\u0434\u0430. \u041c\u043d\u043e\u0433\u0438\u0435 \u0434\u0430\u0436\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044e\u0431\u0438\u043b\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Test-driven_development\">TDD<\/a> (Testing Driven Development) \u0438\u043c\u0435\u043d\u043d\u043e \u0432 Go. \u041a\u0430\u043a \u0431\u044b, \u0443\u0436\u0435 \u043d\u0435\u0442 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u2014 \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043b\u0438, \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0442\u0430\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438. go test \u0431\u0435\u0440\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u0434, \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0430\u044f \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0434\u043e\u043b\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441\u0442\u0430\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0435 \u044f\u0437\u044b\u043a\u0430 \u0438 \u0441\u0432\u0435\u0440\u0445\u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  go test \u0443\u043c\u0435\u0435\u0442 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f (coverage), \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0438\u043d\u0433\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 (func BenchmarkXxx), \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0440\u0435\u0439\u0441-\u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440 \u0438 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u041e\u0431\u043e \u0432\u0441\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <b>go help test<\/b> \u0438 <b>go help testflag<\/b>.<\/p>\n<h4>\u0422\u0435\u0441\u0442\u0438\u043d\u0433-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438<\/h4>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f Go \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0432\u0430\u0448\u0438\u043c \u0442\u0435\u0441\u0442\u0430\u043c, \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 go test. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f <a href=\"http:\/\/goconvey.co\">GoConvey<\/a>, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 DSL-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f BDD-\u0442\u0435\u0441\u0442\u043e\u0432. \u0412\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441 GoConvey \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"go\">package main  import ( \t&quot;math&quot; \t&quot;testing&quot;         . &quot;github.com\/smartystreets\/goconvey\/convey&quot; )  func TestCircle(t *testing.T) {         Convey(&quot;Circle should work correctly&quot;, t, func() { \t\tConvey(&quot;Area should be calculated correctly&quot;, func() { \t\t\tarea := CircleArea(10) \t\t\tSo(area, ShouldEqual, 100 * math.Pi) \t\t}) \t}) } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a71\/042\/c33\/a71042c33b1a422e91b3ee1560323a9c.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/70d\/94a\/f9c\/70d94af9c9b6414ab4d068325e82be6e.png\"\/><\/p>\n<p>  GoConvey \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0443 <a href=\"https:\/\/github.com\/smartystreets\/goconvey\/wiki\/Assertions\">assertions<\/a>, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0415\u0441\u043b\u0438 \u043d\u0430\u0447\u043d\u0451\u0442\u0435 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u043f\u0440\u043e <a href=\"https:\/\/github.com\/smartystreets\/goconvey\/wiki\/Execution-order\">\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/a> \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 Convey-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u0430\u044f \u0444\u0438\u0448\u043a\u0430. <\/p>\n<p>  \u041a\u0430\u043a \u0431\u043e\u043d\u0443\u0441, \u0443 Goconvey \u0435\u0441\u0442\u044c \u043d\u0430\u0432\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431 UI, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c Desktop-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0438, \u0432\u043e\u043e\u0431\u0449\u0435, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0448\u0430\u0442\u0442\u043b\u0430. \u041e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0443\u0434\u043e\u0431\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u043d\u0438\u0442\u043e\u0440. \u041a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0442\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f, GoConvey \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u0430\u0441 \u043f\u043e\u043b\u044e\u0431\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \ud83d\ude42<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fc5\/e02\/d83\/fc5e02d83ce3494a9118cf67f571dd6d.png\"\/><\/p>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0432\u0440\u043e\u0434\u0435 <a href=\"https:\/\/onsi.github.io\/ginkgo\/\">Ginkgo<\/a>, <a href=\"https:\/\/github.com\/stretchr\/testify\/\">testify<\/a>, <a href=\"http:\/\/labix.org\/gocheck\">gocheck<\/a>, <a href=\"http:\/\/agouti.org\">Agouti<\/a>, <a href=\"http:\/\/onsi.github.io\/gomega\/\">GoMega<\/a> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435. \u0412\u043e\u0442 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/shageman\/gotestit\">\u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435<\/a>.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043f\u043e\u0434\u0445\u043e\u0434 Go \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u00ab\u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u2014 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u043d\u0430 \u043e\u0442\u043a\u0443\u043f \u043a\u043e\u043c\u043c\u044c\u044e\u043d\u0438\u0442\u0438\u00bb \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0443\u0447\u0448\u0435 \u0441\u0435\u0431\u044f \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<h4>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/h4>\n<p>  \u041a\u0430\u043a \u0443\u0436\u0435 \u043e\u0442\u043c\u0435\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, \u0438\u043d\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0446\u0435\u043b\u043e\u043c, \u0430 \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043a\u043e\u0434\u0430, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e \u0438 \u0442\u0443\u0442 \u0441 Go \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>  \u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<ul>\n<li>\u0432\u0435\u0431-\u0431\u0435\u043a\u0435\u043d\u0434, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/gin-gonic\/gin\">gin<\/a><\/li>\n<li>\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u2014 \u0432 MySQL \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u0441\u0445\u0435\u043c\u0430 \u0431\u0430\u0437\u044b \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u2014 <a href=\"https:\/\/bitbucket.org\/liamstask\/goose\/\">goose<\/a><\/li>\n<\/ul>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 REST-\u0431\u0435\u043a\u0435\u043d\u0434, \u0442\u0430\u043a \u0438 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c <a href=\"http:\/\/12factor.net\">12-factor app<\/a>, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0446\u0435\u043b\u044c \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  \u0414\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 MySQL-\u0431\u0430\u0437\u044b) \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u043d\u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e, Docker. \u041f\u043e\u043a\u0430 \u0432\u0435\u0441\u044c \u043c\u0438\u0440 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0440\u0443\u0433-\u0434\u0440\u0443\u0433\u0443, \u0447\u0442\u043e Docker \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0430\u043d\u0430\u0446\u0435\u044f \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043c \u0433\u0434\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e (\u0438 \u0438\u0441\u0442\u0438\u043d\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0436\u0435), \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043e\u043d\u043e.<\/p>\n<h4>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 Dockerfile<\/h4>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u043d\u0435-Go \u0447\u0430\u0441\u0442\u044c\u044e, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c Dockerfile \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  goose \u2014 \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0438\u0449\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e db\/, \u0430 \u0432 \u043d\u0435\u0439:  <\/p>\n<ul>\n<li>\u0444\u0430\u0439\u043b dbconf.yml<\/li>\n<li>\u043f\u0430\u043f\u043a\u0443 migrations\/<\/li>\n<\/ul>\n<p>  \u0412 yaml-\u0444\u0430\u0439\u043b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 goose \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 migrations\/ \u2014 SQL-\u043a\u043e\u0434, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e goose create. \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044d\u0442\u043e <a href=\"https:\/\/bitbucket.org\/liamstask\/goose\/\">\u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u043e<\/a> \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 MySQL, \u043f\u0440\u0438 \u0431\u0438\u043b\u0434\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u0442\u0430\u0440\u0442\u0430\u043d\u0443\u0442\u044c \u0435\u0433\u043e, \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b goose up, \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<br \/>  Dockerfile \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Dockerfile<\/b><\/p>\n<div class=\"spoiler_text\">FROM debian<\/p>\n<p>  ENV DEBIAN_FRONTEND noninteractive<br \/>  RUN apt-get update<br \/>  RUN apt-get install -y mysql-server<\/p>\n<p>  RUN sed -i -e\u00abs\/^bind-address\\s*=\\s*127.0.0.1\/bind-address = 0.0.0.0\/\u00bb \/etc\/mysql\/my.cnf<\/p>\n<p>  RUN apt-get install -y golang git ca-certificates gcc<br \/>  ENV GOPATH \/root<br \/>  RUN go get bitbucket.org\/liamstask\/goose\/cmd\/goose<\/p>\n<p>  ADD. \/db<br \/>  RUN \\<br \/>   service mysql start &#038;&#038; \\<br \/>   sleep 10 &#038;&#038; \\<br \/>   while true; do mysql -e \u00abSELECT 1\u00bb &#038;&gt; \/dev\/null; [ $? -eq 0 ] &#038;&#038; break; echo -n &quot;.&quot;; sleep 1; done &#038;&#038; \\<br \/>   mysql -e \u00abGRANT ALL ON *.* to &#8216;root&#8217;@&#8217;%&#8217;; FLUSH PRIVILEGES;\u00bb &#038;&#038; \\<br \/>   mysql -e \u00abCREATE DATABASE mydb DEFAULT COLLATE utf8_general_ci;\u00bb &#038;&#038; \\<br \/>   \/root\/bin\/goose -env=default up &#038;&#038; \\<br \/>   service mysql stop<\/p>\n<p>  EXPOSE 3306<br \/>  CMD [\u00abmysqld_safe\u00bb]  <\/div>\n<\/div>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u00abdocker build -t mydb_test .\u00bb \u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 docker run -p 3306:3306 mydb_test \u2014 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0432\u0435\u0436\u0435\u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u0443\u044e \u0431\u0430\u0437\u0443, \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0438 \u0432 \u0441\u0432\u0435\u0436\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438.<\/p>\n<h4>\u041f\u0438\u0448\u0435\u043c Go \u0442\u0435\u0441\u0442\u044b<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0431\u0438\u043b\u0434-\u0442\u0435\u0433, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u00ab\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b\u00bb.<br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u043d\u0430\u0448 service_test.go:  <\/p>\n<pre><code class=\"go\">\/\/ +build integration  package main  import (     &quot;testing&quot; ) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 go test \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442, \u0430 go test -tag=integration \u2014 \u0431\u0443\u0434\u0435\u0442. \u041a \u0441\u043b\u043e\u0432\u0443, \u0432 go test \u0435\u0441\u0442\u044c \u0440\u0435\u0436\u0438\u043c -short \u2014 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d:  <\/p>\n<pre><code class=\"go\">if testing.Short() {         t.Skip(&quot;skipping test in short mode.&quot;) }<\/code><\/pre>\n<h4>\u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c, \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0430\u0448 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0442\u0435\u0441\u0442\u0430. \u0414\u043b\u044f Docker \u0435\u0441\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0435 Go-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c <a href=\"http:\/\/github.com\/fsouza\/go-dockerclient\">\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c<\/a> \u043e\u0442 fsouza, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 1.5 \u043b\u0435\u0442. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0440\u0438 \u0448\u0430\u0433\u0430:  <\/p>\n<pre><code class=\"go\">    client, err := docker.NewClientFromEnv()     if err != nil {         t.Fatalf(&quot;Cannot connect to Docker daemon: %s&quot;, err)     }     c, err := client.CreateContainer(createOptions())     if err != nil {         t.Fatalf(&quot;Cannot create Docker container: %s&quot;, err)     }     defer func() {         if err := client.RemoveContainer(docker.RemoveContainerOptions{             ID:    c.ID,             Force: true,         }); err != nil {             t.Fatalf(&quot;cannot remove container: %s&quot;, err)         }     }()      err = client.StartContainer(c.ID, &docker.HostConfig{})     if err != nil {         t.Fatalf(&quot;Cannot start Docker container: %s&quot;, err)     } <\/code><\/pre>\n<p>  createOptions() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c \u043c\u044b \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 mydb_test.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/b><\/p>\n<div class=\"spoiler_text\">func \u0441reateOptions() docker.CreateContainerOptions {<br \/>   ports := make(map[docker.Port]struct{})<br \/>   ports[\u00ab3306\u00bb] = struct{}{}<br \/>   opts := docker.CreateContainerOptions{<br \/>   Config: &#038;docker.Config{<br \/>   Image: \u00abmydb_test\u00bb,<br \/>   ExposedPorts: ports,<br \/>   },<br \/>   }<\/p>\n<p>  return opts<br \/>  }<\/div>\n<\/div>\n<p>  \u0412\u0441\u0451 \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0431\u0430\u0437\u044b, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441 \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 DSN \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441 mysql-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c Go.  <\/p>\n<pre><code class=\"go\">    \/\/ wait for container to wake up     if err := waitStarted(client, c.ID, 5*time.Second); err != nil {         t.Fatalf(&quot;Couldn't reach MySQL server for testing, aborting.&quot;)     }     c, err = client.InspectContainer(c.ID)     if err != nil {         t.Fatalf(&quot;Couldn't inspect container: %s&quot;, err)     }      \/\/ determine IP address for MySQL     ip = strings.TrimSpace(c.NetworkSettings.IPAddress)      \/\/ wait MySQL to wake up     if err := waitReachable(ip+&quot;:3306&quot;, 5*time.Second); err != nil {         t.Fatalf(&quot;Couldn't reach MySQL server for testing, aborting.&quot;)     }      \/\/ pass IP to DB connect code <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0440\u044f\u0447\u0443 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">wait code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/\/ waitReachable waits for hostport to became reachable for the maxWait time. func waitReachable(hostport string, maxWait time.Duration) error {     done := time.Now().Add(maxWait)     for time.Now().Before(done) {         c, err := net.Dial(&quot;tcp&quot;, hostport)         if err == nil {             c.Close()             return nil         }         time.Sleep(100 * time.Millisecond)     }     return fmt.Errorf(&quot;cannot connect %v for %v&quot;, hostport, maxWait) }  \/\/ waitStarted waits for container to start for the maxWait time. func waitStarted(client *docker.Client, id string, maxWait time.Duration) error {     done := time.Now().Add(maxWait)     for time.Now().Before(done) {         c, err := client.InspectContainer(id)         if err != nil {            break         }         if c.State.Running {             return nil         }         time.Sleep(100 * time.Millisecond)     }     return fmt.Errorf(&quot;cannot start container %s for %v&quot;, id, maxWait) } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u043d\u0430 MacOS X, \u0438 \u043d\u0430 Windows, \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c Linux \u0438 \u043d\u0435-Linux \u0441\u0440\u0435\u0434\u0443, \u0438 \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c docker-machine \u0438\u043b\u0438 boot2docker (\u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u043f\u0435\u0440\u0435\u0435\u0445\u0430\u043b \u043d\u0430 docker-machine).<\/p>\n<p>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0443\u0449\u0435\u043d Docker. \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"go\">\/\/ DockerMachineIP returns IP of docker-machine or boot2docker VM instance. \/\/ \/\/ If docker-machine or boot2socker is running and has IP, it will be used to \/\/ connect to dockerized services (MySQL, etc). \/\/ \/\/ Basically, it adds support for MacOS X and Windows. func DockerMachineIP() string { \t\/\/ Docker-machine is a modern solution for docker in MacOS X. \t\/\/ Try to detect it, with fallback to boot2docker \tvar dockerMachine bool \tmachine := os.Getenv(&quot;DOCKER_MACHINE_NAME&quot;) \tif machine != &quot;&quot; { \t\tdockerMachine = true \t}  \tvar buf bytes.Buffer  \tvar cmd *exec.Cmd \tif dockerMachine { \t\tcmd = exec.Command(&quot;docker-machine&quot;, &quot;ip&quot;, machine) \t} else { \t\tcmd = exec.Command(&quot;boot2docker&quot;, &quot;ip&quot;) \t} \tcmd.Stdout = &buf  \tif err := cmd.Run(); err != nil { \t\t\/\/ ignore error, as it's perfectly OK on Linux \t\treturn &quot;&quot; \t}  \treturn buf.String() } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0430 \u043f\u043e\u0440\u0442\u043e\u0432 \u0432 CreateContainerOptions.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0439 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u043d\u0430\u0440\u0443\u0436\u0443, \u044f \u043f\u043e\u043b\u043e\u0436\u0443 \u0435\u0433\u043e \u0432 \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433 <a href=\"https:\/\/docs.google.com\/document\/d\/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU\/edit\">internal<\/a> \u2014 \u044d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e (\u043f\u0435\u0440\u0435)\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u041a\u043e\u0434 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c: <a href=\"http:\/\/pastebin.com\/faUUN0M1\">pastebin.com\/faUUN0M1<\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 DSN \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.  <\/p>\n<pre><code class=\"go\">    \/\/ start db in docker container     dsn, deferFn, err := dockertest.StartMysql()     if err != nil {         t.Fatalf(&quot;cannot start mysql in container for testing: %s&quot;, err)     }     defer deferFn()      db, err := sql.Open(&quot;mysql&quot;, dsn)     if err != nil {         t.Fatalf(&quot;Couldn't connect to test database: %s&quot;, err)     }     defer db.Close() <\/code><\/pre>\n<p>  \u0418 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c db \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e deferFn() \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u2014 \u044d\u0442\u043e \u043d\u0430 \u0441\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 dockertest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0431\u044f \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/p>\n<h4>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c http-\u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h4>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0443 \u043d\u0430\u0441 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 http-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043b\u0438 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043e\u0448\u0438\u0431\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043b\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u00ab\u0441\u043d\u0430\u0440\u0443\u0436\u0438\u00bb curl-\u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043d\u043e \u044d\u0442\u043e \u043d\u0435\u0443\u043a\u043b\u044e\u0436\u0435, \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u0412 Go \u0435\u0441\u0442\u044c \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c http-\u0445\u0435\u043d\u0434\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/golang.org\/pkg\/net\/http\/httptest\/\">net\/http\/httptest<\/a><\/p>\n<p>  httptest \u0431\u044b\u043b, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b\u0438 \u043d\u0430 \u043c\u0435\u043d\u044f \u0432\u0430\u0443-\u044d\u0444\u0444\u0435\u043a\u0442 \u0432 Go. \u0421\u0430\u043c\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f http-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 Go \u0438 \u0431\u0435\u0437 \u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u043d\u043e \u0442\u0443\u0442 \u0431\u044b\u043b\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u043d\u043e. \u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0430\u043a\u0435\u0442 net\/http \u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u044d\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u2014 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 http.Handler, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 ServeHttp(http.ResponseWriter, *http.Request):  <\/p>\n<pre><code class=\"go\">type Handler interface {         ServeHTTP(ResponseWriter, *Request) }<\/code><\/pre>\n<p>  \u0412\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a gin, \u043a\u0430\u043a \u0438 \u043f\u043e\u0434\u043e\u0431\u0430\u0435\u0442 \u0432\u0441\u0435\u043c \u0446\u0438\u0432\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c http-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c \u0432 Go, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u044d\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u0441\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 http.ResponseWriter (\u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441), \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 Request \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0442\u0432\u0435\u0442! \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0440\u0442\u043e\u0432, \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b-\u0442\u0435\u0441\u0442\u0430. \u0418 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e.<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 (\u044f \u0441\u0440\u0430\u0437\u0443 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 GoConvey):  <\/p>\n<pre><code class=\"go\">func NewServer(db *sql.DB) *gin.Engine {     r := gin.Default()     r.Use(cors.Middleware(cors.Options{}))     \/\/ more middlewares ...      \/\/ Health check     r.GET(&quot;\/ping&quot;, ping)      \/\/ CRUD resources     usersRes := &UsersResource{db: db}      \/\/ Define routes     api := r.Group(&quot;\/api&quot;)     {         v1 := api.Group(&quot;\/v1&quot;)         {             rest.CRUD(v1, &quot;\/users&quot;, usersRes)         }     }      return r } ...    r := NewServer(db)    Convey(&quot;Users endpoints should respond correctly&quot;, t, func() {         Convey(&quot;User should return empty list&quot;, func() {             \/\/ it's safe to ignore error here, because we're manually entering URL             req, _ := http.NewRequest(&quot;GET&quot;, &quot;http:\/\/localhost\/api\/v1\/users&quot;, nil)             w := httptest.NewRecorder()             r.ServeHTTP(w, req)              So(w.Code, ShouldEqual, http.StatusOK)             body := strings.TrimSpace(w.Body.String())             So(body, ShouldEqual, &quot;[]&quot;)         })    }) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u2014 \u0441\u043a\u0430\u0436\u0435\u043c, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043d\u043e\u0432\u0430 \u0441\u043f\u0438\u0441\u043e\u043a:  <\/p>\n<pre><code class=\"go\">    Convey(&quot;Create should return ID of newly created user&quot;, func() {             user := &User{Name: &quot;Test user&quot;}             data, err := json.Marshal(user)             So(err, ShouldBeNil)             buf := bytes.NewBuffer(data)             req, err := http.NewRequest(&quot;POST&quot;, &quot;http:\/\/localhost\/api\/v1\/users&quot;, buf)             So(err, ShouldBeNil)             w := httptest.NewRecorder()             r.ServeHTTP(w, req)              So(w.Code, ShouldEqual, http.StatusOK)             body := strings.TrimSpace(w.Body.String())             So(body, ShouldEqual, &quot;1&quot;)     })     Convey(&quot;List should return one user with name 'Test user'&quot;, func() {             req, _ := http.NewRequest(&quot;GET&quot;, &quot;http:\/\/localhost\/api\/v1\/users&quot;, nil)             w := httptest.NewRecorder()             r.ServeHTTP(w, req)              So(w.Code, ShouldEqual, http.StatusOK)             body := w.Body.Bytes()             var users []*User             err := json.Unmarshal(body, &users)             So(err, ShouldBeNil)             user := &User{                   ID: 1,                   Name: &quot;Test user&quot;,              }             So(len(users), ShouldEqual, 1)             So(users[0], ShouldResemble, user)     }) <\/code><\/pre>\n<p>  \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 stateful- \u0438\u043b\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b<\/h4>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, Go \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 unit-\u0442\u0435\u0441\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0441\u0442\u0438\u043c\u0443\u043b \u0438\u0445 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0443, \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f Go \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0432 \u043f\u0440\u0438\u0432\u0435\u0440\u0436\u0435\u043d\u0446\u0435\u0432 BDD \u0438 TDD \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0439, \u043d\u043e \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 integration- \u0438 acceptance-\u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0441\u043b\u0443\u0436\u0438\u0442 \u043b\u0438\u0448\u044c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u0445\u043e\u0442\u044c \u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 1.5 \u0433\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u041d\u0430 \u043c\u043e\u0451\u043c Macbook, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c docker \u0431\u0435\u0436\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b (\u0447\u0435\u0440\u0435\u0437 docker-machine), \u0432\u0435\u0441\u044c \u0442\u0435\u0441\u0442 (\u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430, \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c ~35 http-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432) \u2014 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435, \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0442\u0435\u0441\u0442\u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c. \u041d\u0430 Linux \u044d\u0442\u043e, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>  \u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043d\u0435 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 (\u0440\u0435\u043c\u0430\u0440\u043a\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0445\u0430\u0431\u0440\u0430\u0442\u0440\u043e\u043b\u043b\u044f lair), \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b Go \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0446\u0438\u043a\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e, \u043f\u0438\u0448\u0438\u0442\u0435 \u0442\u0435\u0441\u0442\u044b! \u0421 Go \u044d\u0442\u043e \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u0438\u0439 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \ud83d\ude42               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/271239\/\"> http:\/\/habrahabr.ru\/post\/271239\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f http-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 Go. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043d\u043e \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0439\u0434\u0435\u0442 Docker, \u043f\u0430\u043a\u0435\u0442 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 httptest \u0438 \u0431\u0438\u043b\u0434-\u0442\u0435\u0433\u0438. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MySQL \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u043c goose. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b go test, \u0431\u0443\u0434\u044c \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0438\u043b\u0438 Continuous Integration \u0441\u0435\u0440\u0432\u0435\u0440.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f25\/bdd\/451\/f25bdd4517e73bb454c7682618612ce0.png\" alt=\"image\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-268539","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268539"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268539\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}