Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Fix method of /exec/(id)/json call #163

Merged
merged 1 commit into from
Feb 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3299,7 +3299,7 @@
}
},
"/exec/{id}/json": {
"post": {
"get": {
"summary": "Exec Inspect",
"description": "Return low-level information about the exec command id.",
"operationId": "find",
Expand Down
2 changes: 1 addition & 1 deletion generated/Resource/ExecResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function find($id, $parameters = [], $fetch = self::FETCH_OBJECT)
$url = $url . ('?' . $queryParam->buildQueryString($parameters));
$headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters));
$body = $queryParam->buildFormDataString($parameters);
$request = $this->messageFactory->createRequest('POST', $url, $headers, $body);
$request = $this->messageFactory->createRequest('GET', $url, $headers, $body);
$response = $this->httpClient->sendRequest($request);
if (self::FETCH_OBJECT == $fetch) {
if ('200' == $response->getStatusCode()) {
Expand Down
24 changes: 24 additions & 0 deletions tests/Manager/ExecManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ public function testStartStream()
]);
}

public function testExecFind()
{
$createContainerResult = $this->createContainer();

$execConfig = new ExecConfig();
$execConfig->setCmd(["/bin/true"]);

$execCreateResult = $this->getManager()->create($createContainerResult->getId(), $execConfig);

$execStartConfig = new ExecStartConfig();
$execStartConfig->setDetach(false);
$execStartConfig->setTty(false);

$this->getManager()->start($execCreateResult->getId(), $execStartConfig);

$execFindResult = $this->getManager()->find($execCreateResult->getId());

$this->assertInstanceOf('Docker\API\Model\ExecCommand', $execFindResult);

self::getDocker()->getContainerManager()->kill($createContainerResult->getId(), [
'signal' => 'SIGKILL'
]);
}

private function createContainer()
{
$containerConfig = new ContainerConfig();
Expand Down