{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/libbeat/pulls/comments/38757254","id":38757254,"diff_hunk":"@@ -40,10 +40,34 @@ cover:\n \tgo get github.com/pierrre/gotestcover\n \tGOPATH=$(shell $(GODEP) path):$(GOPATH) $(GOPATH)/bin/gotestcover -coverprofile=profile.cov -covermode=count github.com/elastic/libbeat/...\n \tmkdir -p cover\n-\t$(GODEP)  go tool cover -html=profile.cov -o cover/coverage.html\n+\t$(GODEP) go tool cover -html=profile.cov -o cover/coverage.html\n \n .PHONY: clean\n clean:\n \tmake gofmt\n \t-rm profile.cov\n \t-rm -r cover\n+\n+\n+# Builds the environment to test libbeat\n+.PHONY: build-image\n+build-image:\n+\tmake clean\n+\tdocker-compose build\n+\n+# Runs the environment so the redis and elasticsearch can also be used for local development\n+# To use it for running the test, set ES_HOST and REDIS_HOST environment variable to the ip of your docker-machine.\n+.PHONY: run-environment\n+run-environment: build-image\n+\tdocker-compose run -d\n+\n+# Runs the full test suite and puts out the result. This can be run on any docker-machine (local, remote)\n+.PHONY: testsuite\n+testsuite: build-image\n+\tdocker-compose run libbeat make testlong\n+\tdocker ps -a\n+\t# Copy coverage file back to host\n+\tmkdir -p cover\n+\tdocker cp libbeat_libbeat_run_1:/go/src/github.com/elastic/libbeat/profile.cov $(shell pwd)/profile.cov\n+\tdocker cp libbeat_libbeat_run_1:/go/src/github.com/elastic/libbeat/cover/coverage.html $(shell pwd)/cover/coverage.html\n+\tdocker-compose stop","path":"Makefile","position":47,"original_position":47,"commit_id":"79daf29ae567ed0384bc7d4aac895b6cc43704b7","original_commit_id":"79daf29ae567ed0384bc7d4aac895b6cc43704b7","user":{"login":"urso","id":75886,"avatar_url":"https://avatars.githubusercontent.com/u/75886?v=3","gravatar_id":"","url":"https://api.github.com/users/urso","html_url":"https://github.com/urso","followers_url":"https://api.github.com/users/urso/followers","following_url":"https://api.github.com/users/urso/following{/other_user}","gists_url":"https://api.github.com/users/urso/gists{/gist_id}","starred_url":"https://api.github.com/users/urso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urso/subscriptions","organizations_url":"https://api.github.com/users/urso/orgs","repos_url":"https://api.github.com/users/urso/repos","events_url":"https://api.github.com/users/urso/events{/privacy}","received_events_url":"https://api.github.com/users/urso/received_events","type":"User","site_admin":false},"body":"might this stop my test environment I started with run-environment?\r\n\r\nIn case tests fail, we should also copy the the run directory.","created_at":"2015-09-04T14:32:11Z","updated_at":"2015-09-04T14:32:11Z","html_url":"https://github.com/elastic/libbeat/pull/54#discussion_r38757254","pull_request_url":"https://api.github.com/repos/elastic/libbeat/pulls/54","_links":{"self":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/comments/38757254"},"html":{"href":"https://github.com/elastic/libbeat/pull/54#discussion_r38757254"},"pull_request":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/libbeat/pulls/54","id":44194834,"html_url":"https://github.com/elastic/libbeat/pull/54","diff_url":"https://github.com/elastic/libbeat/pull/54.diff","patch_url":"https://github.com/elastic/libbeat/pull/54.patch","issue_url":"https://api.github.com/repos/elastic/libbeat/issues/54","number":54,"state":"open","locked":false,"title":"Environment to run clean test suite with one command","user":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"body":"The test suite of libbeat depends on redis and elasticsearch. The goal was that everyone can start to develop and test the full project with as few commands as possible. To simplify the full test suite I introduced docker-compose and Docker environment to setup and run the test suite with just one command (assuming docker is installed):\r\n\r\n```\r\nmake testsuite\r\n````\r\n\r\nThis command fetches the images, runs the images and all tests. I suggest that this should be the command that every contributor runs before he opens a pull request as it guarantees that all his changes work in a \"standardised\" environment. It makes it possible to run everything also on a remote docker-machine.\r\n\r\n## Environment\r\nThe tests were refactored to fetch the hosts and ports from the environment variables. This was necessary for the dynamic docker environment. In addition, it allows to use the docker redis and elasticsearch image also for the local development. This can be done with the following commands:\r\n\r\n```\r\nexport ES_HOST=IP_OF_YOUR_DOCKER_MACHINE\r\nexport REDIS_HOST=IP_OF_YOUR_DOCKER_MACHINE\r\nmake run-environment\r\n```\r\nLike this the local golang environment can be used but still all tests work without any setup of redis or elasticsearch.\r\n\r\nThe current setup is with Golang 1.4 and the latest release version of elasticsearch.","created_at":"2015-09-04T08:43:59Z","updated_at":"2015-09-04T14:32:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c5a9c3ab1c84b4a447d6d05dba29eebd67b4603","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/libbeat/pulls/54/commits","review_comments_url":"https://api.github.com/repos/elastic/libbeat/pulls/54/comments","review_comment_url":"https://api.github.com/repos/elastic/libbeat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/libbeat/issues/54/comments","statuses_url":"https://api.github.com/repos/elastic/libbeat/statuses/79daf29ae567ed0384bc7d4aac895b6cc43704b7","head":{"label":"ruflin:testsuite-environment","ref":"testsuite-environment","sha":"79daf29ae567ed0384bc7d4aac895b6cc43704b7","user":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"repo":{"id":40750358,"name":"libbeat","full_name":"ruflin/libbeat","owner":{"login":"ruflin","id":244900,"avatar_url":"https://avatars.githubusercontent.com/u/244900?v=3","gravatar_id":"","url":"https://api.github.com/users/ruflin","html_url":"https://github.com/ruflin","followers_url":"https://api.github.com/users/ruflin/followers","following_url":"https://api.github.com/users/ruflin/following{/other_user}","gists_url":"https://api.github.com/users/ruflin/gists{/gist_id}","starred_url":"https://api.github.com/users/ruflin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruflin/subscriptions","organizations_url":"https://api.github.com/users/ruflin/orgs","repos_url":"https://api.github.com/users/ruflin/repos","events_url":"https://api.github.com/users/ruflin/events{/privacy}","received_events_url":"https://api.github.com/users/ruflin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ruflin/libbeat","description":"libbeat contains the common parts of all the Elastic Beats","fork":true,"url":"https://api.github.com/repos/ruflin/libbeat","forks_url":"https://api.github.com/repos/ruflin/libbeat/forks","keys_url":"https://api.github.com/repos/ruflin/libbeat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruflin/libbeat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruflin/libbeat/teams","hooks_url":"https://api.github.com/repos/ruflin/libbeat/hooks","issue_events_url":"https://api.github.com/repos/ruflin/libbeat/issues/events{/number}","events_url":"https://api.github.com/repos/ruflin/libbeat/events","assignees_url":"https://api.github.com/repos/ruflin/libbeat/assignees{/user}","branches_url":"https://api.github.com/repos/ruflin/libbeat/branches{/branch}","tags_url":"https://api.github.com/repos/ruflin/libbeat/tags","blobs_url":"https://api.github.com/repos/ruflin/libbeat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruflin/libbeat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruflin/libbeat/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruflin/libbeat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruflin/libbeat/statuses/{sha}","languages_url":"https://api.github.com/repos/ruflin/libbeat/languages","stargazers_url":"https://api.github.com/repos/ruflin/libbeat/stargazers","contributors_url":"https://api.github.com/repos/ruflin/libbeat/contributors","subscribers_url":"https://api.github.com/repos/ruflin/libbeat/subscribers","subscription_url":"https://api.github.com/repos/ruflin/libbeat/subscription","commits_url":"https://api.github.com/repos/ruflin/libbeat/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruflin/libbeat/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruflin/libbeat/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruflin/libbeat/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruflin/libbeat/contents/{+path}","compare_url":"https://api.github.com/repos/ruflin/libbeat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruflin/libbeat/merges","archive_url":"https://api.github.com/repos/ruflin/libbeat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruflin/libbeat/downloads","issues_url":"https://api.github.com/repos/ruflin/libbeat/issues{/number}","pulls_url":"https://api.github.com/repos/ruflin/libbeat/pulls{/number}","milestones_url":"https://api.github.com/repos/ruflin/libbeat/milestones{/number}","notifications_url":"https://api.github.com/repos/ruflin/libbeat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruflin/libbeat/labels{/name}","releases_url":"https://api.github.com/repos/ruflin/libbeat/releases{/id}","created_at":"2015-08-15T07:13:55Z","updated_at":"2015-08-15T07:13:56Z","pushed_at":"2015-09-04T08:41:50Z","git_url":"git://github.com/ruflin/libbeat.git","ssh_url":"git@github.com:ruflin/libbeat.git","clone_url":"https://github.com/ruflin/libbeat.git","svn_url":"https://github.com/ruflin/libbeat","homepage":"https://www.elastic.co/products/beats","size":1056,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"9f49a3eed4d7ffef2cb8fa8372baf3c9984f5809","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":33370332,"name":"libbeat","full_name":"elastic/libbeat","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/libbeat","description":"libbeat contains the common parts of all the Elastic Beats","fork":false,"url":"https://api.github.com/repos/elastic/libbeat","forks_url":"https://api.github.com/repos/elastic/libbeat/forks","keys_url":"https://api.github.com/repos/elastic/libbeat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/libbeat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/libbeat/teams","hooks_url":"https://api.github.com/repos/elastic/libbeat/hooks","issue_events_url":"https://api.github.com/repos/elastic/libbeat/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/libbeat/events","assignees_url":"https://api.github.com/repos/elastic/libbeat/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/libbeat/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/libbeat/tags","blobs_url":"https://api.github.com/repos/elastic/libbeat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/libbeat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/libbeat/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/libbeat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/libbeat/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/libbeat/languages","stargazers_url":"https://api.github.com/repos/elastic/libbeat/stargazers","contributors_url":"https://api.github.com/repos/elastic/libbeat/contributors","subscribers_url":"https://api.github.com/repos/elastic/libbeat/subscribers","subscription_url":"https://api.github.com/repos/elastic/libbeat/subscription","commits_url":"https://api.github.com/repos/elastic/libbeat/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/libbeat/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/libbeat/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/libbeat/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/libbeat/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/libbeat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/libbeat/merges","archive_url":"https://api.github.com/repos/elastic/libbeat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/libbeat/downloads","issues_url":"https://api.github.com/repos/elastic/libbeat/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/libbeat/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/libbeat/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/libbeat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/libbeat/labels{/name}","releases_url":"https://api.github.com/repos/elastic/libbeat/releases{/id}","created_at":"2015-04-03T15:51:52Z","updated_at":"2015-08-27T01:56:29Z","pushed_at":"2015-09-04T14:23:41Z","git_url":"git://github.com/elastic/libbeat.git","ssh_url":"git@github.com:elastic/libbeat.git","clone_url":"https://github.com/elastic/libbeat.git","svn_url":"https://github.com/elastic/libbeat","homepage":"https://www.elastic.co/products/beats","size":1509,"stargazers_count":54,"watchers_count":54,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":11,"forks":22,"open_issues":11,"watchers":54,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/54"},"html":{"href":"https://github.com/elastic/libbeat/pull/54"},"issue":{"href":"https://api.github.com/repos/elastic/libbeat/issues/54"},"comments":{"href":"https://api.github.com/repos/elastic/libbeat/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/libbeat/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/libbeat/statuses/79daf29ae567ed0384bc7d4aac895b6cc43704b7"}}}}