{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/421","repository_url":"https://api.github.com/repos/elastic/elasticsearch-php","labels_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/421/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/421/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/421/events","html_url":"https://github.com/elastic/elasticsearch-php/issues/421","id":157125904,"number":421,"title":"Running test more easier with faster response loop","user":{"login":"Tezd","id":3295937,"avatar_url":"https://avatars.githubusercontent.com/u/3295937?v=3","gravatar_id":"","url":"https://api.github.com/users/Tezd","html_url":"https://github.com/Tezd","followers_url":"https://api.github.com/users/Tezd/followers","following_url":"https://api.github.com/users/Tezd/following{/other_user}","gists_url":"https://api.github.com/users/Tezd/gists{/gist_id}","starred_url":"https://api.github.com/users/Tezd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tezd/subscriptions","organizations_url":"https://api.github.com/users/Tezd/orgs","repos_url":"https://api.github.com/users/Tezd/repos","events_url":"https://api.github.com/users/Tezd/events{/privacy}","received_events_url":"https://api.github.com/users/Tezd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-27T04:05:52Z","updated_at":"2016-06-01T04:22:06Z","closed_at":null,"body":"### Summary of problem or feature request\r\n\r\nTo run the tests it requires you to bring up elasticsearch instance. \r\nAdd those changes to `elasticsearch.yml`:\r\n``` \r\npath.repo: [\"/tmp\"]\r\nrepositories.url.allowed_urls: [\"http://*\"]\r\n```\r\nThose lines are required for repository and snapshot tests.\r\nThen you will need to run tests:\r\n```bash\r\nsudo -H -u elasticsearch bash -c \"/usr/bin/env php vendor/bin/phpunit --bootstrap tests/bootstrap.php --configuration phpunit.xml tests\"\r\n```\r\nSince elasticsearch repositories in `/tmp` folder wont have write permissions and without cleaning them up later tests will be broken due to repository already exists.\r\n\r\nTests are integration test run through the elasticseach-php library(long response loop) and you cant select which ones you want to run they will run all at once.\r\nAnother problem is that in `util/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/test` not all endpoint are tested (ex. reindex, update_by_query).\r\n\r\nIs there specific reason why we need to test endpoint using integration tests from elasticsearch?\r\n\r\n### Suggestion\r\n\r\nUse api documentation from `util/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api` since it is covering all endpoint. Will make current tests unit tests(faster response loop). Still will leave us with running all of them at once. \r\n\r\nTo achieve this we will need to expose endpoints built uri and filtered parameters. And then instead of propagating transport to them and calling performRequest, we will call performRequest in client and namespaces based on return from endpoints\r\nExample mock code renderSearch method from Client:\r\n```php\r\npublic function renderSearchTemplate($params = [])\r\n{\r\n        $this->transport->setOptions($params);\r\n        /** @var callback $endpointBuilder */\r\n        $endpointBuilder = $this->endpoints;\r\n        /** @var \\Elasticsearch\\Endpoints\\RenderSearchTemplate $endpoint */\r\n        $endpoint = $endpointBuilder('RenderSearchTemplate');\r\n        $endpoint->accept($params);\r\n        return $this->transport->performRequest(\r\n              $endpoint->getMethod(),\r\n              $endpoint->getUri(),\r\n              $endpoint->getParams(),\r\n              $endpoint->getBody()\r\n        ); \r\n}\r\n```\r\nLooking forward for your feedback on this suggestion."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/comments/222888966","html_url":"https://github.com/elastic/elasticsearch-php/issues/421#issuecomment-222888966","issue_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/421","id":222888966,"user":{"login":"SergeyShcherbin","id":13617712,"avatar_url":"https://avatars.githubusercontent.com/u/13617712?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeyShcherbin","html_url":"https://github.com/SergeyShcherbin","followers_url":"https://api.github.com/users/SergeyShcherbin/followers","following_url":"https://api.github.com/users/SergeyShcherbin/following{/other_user}","gists_url":"https://api.github.com/users/SergeyShcherbin/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyShcherbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyShcherbin/subscriptions","organizations_url":"https://api.github.com/users/SergeyShcherbin/orgs","repos_url":"https://api.github.com/users/SergeyShcherbin/repos","events_url":"https://api.github.com/users/SergeyShcherbin/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyShcherbin/received_events","type":"User","site_admin":false},"created_at":"2016-06-01T04:22:06Z","updated_at":"2016-06-01T04:22:06Z","body":"Ok, will work on it on weekends."}}
{"actor":{"display_login":"SergeyShcherbin"}}