You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/06/25 23:37:39 UTC
[03/14] libcloud git commit: more fixtures for 1.24
more fixtures for 1.24
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c24814df
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c24814df
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c24814df
Branch: refs/heads/trunk
Commit: c24814df7afd6ec694e493d03a53bf59ab7b9de6
Parents: 5101531
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Jun 24 12:51:39 2016 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Jun 24 12:51:39 2016 +1000
----------------------------------------------------------------------
libcloud/container/drivers/docker.py | 10 +-
.../fixtures/docker/mac_124/containers.json | 242 +++++++++++++++++++
.../docker/mac_124/create_container.json | 4 +
.../fixtures/docker/mac_124/search.json | 152 ++++++++++++
libcloud/test/container/test_docker.py | 2 -
5 files changed, 405 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c24814df/libcloud/container/drivers/docker.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py
index 76c3474..1566c04 100644
--- a/libcloud/container/drivers/docker.py
+++ b/libcloud/container/drivers/docker.py
@@ -601,9 +601,13 @@ class DockerContainerDriver(ContainerDriver):
except:
name = data.get('Id')
state = data.get('State')
- status = data.get('Status',
- state.get('Status')
- if state is not None else None)
+ if isinstance(state, dict):
+ status = data.get(
+ 'Status',
+ state.get('Status')
+ if state is not None else None)
+ else:
+ status = data.get('Status')
if 'Exited' in status:
state = ContainerState.STOPPED
elif status.startswith('Up '):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c24814df/libcloud/test/container/fixtures/docker/mac_124/containers.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/docker/mac_124/containers.json b/libcloud/test/container/fixtures/docker/mac_124/containers.json
new file mode 100644
index 0000000..95b61d3
--- /dev/null
+++ b/libcloud/test/container/fixtures/docker/mac_124/containers.json
@@ -0,0 +1,242 @@
+[{
+ "Id": "160936dc54fe8c332095676d9379003534b8cddd7565fa63018996e06dae1b6b",
+ "Names": ["/hubot"],
+ "Image": "stackstorm/hubot",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734872,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 4 seconds",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "d0c614dcdd1c6a89765c989640239a27ab3a99a5ca3dbd1de7494b939f39652c",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.7",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:07"
+ }
+ }
+ },
+ "Mounts": []
+ }, {
+ "Id": "6089a78e3e938a6a693601ad8a3f416d39273f8d2b4d3d3971b82eaa05281d08",
+ "Names": ["/fervent_noether"],
+ "Image": "nginx",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734871,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 5 seconds",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "1298dfe058795ed277e539e80e00cb88bbbcbb08051b1f43f979f878e959e9c4",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.6",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:06"
+ }
+ }
+ },
+ "Mounts": []
+ }, {
+ "Id": "1fa078bc0c56b94a81e62586aebab06042abc524df45fc3197eaff31dd61705f",
+ "Names": ["/cranky_nobel"],
+ "Image": "nginx",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734869,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 6 seconds",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "4985fa8a74f2997ee0794c1866e6492dbc9124705d41596fa27bb4c2505739fb",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.5",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:05"
+ }
+ }
+ },
+ "Mounts": []
+ }, {
+ "Id": "15faa50fa2a41f417cee3f2013fc150d0f90d9ed3102d8533e65099d50476e4d",
+ "Names": ["/sharp_kilby"],
+ "Image": "nginx",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734868,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 7 seconds",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "912a856ada2ab2e84a95ff2ca5236b9e84976e3daf4844623ba80228bb244660",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.4",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:04"
+ }
+ }
+ },
+ "Mounts": []
+ }, {
+ "Id": "c3bd5b03b4d5a636344b75271781c3402341db6be1e76168cb602c5d79439519",
+ "Names": ["/agitated_lalande"],
+ "Image": "nginx",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734867,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 9 seconds",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "2856237f86f145817f3807996c3e89c9ad019d45a29c98cb0ab165abebe11ef9",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.3",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:03"
+ }
+ }
+ },
+ "Mounts": []
+ }, {
+ "Id": "5ad88cda3edccb5523ddd6831a399f406434ef0fc35dc24caa6cd09ee08b7826",
+ "Names": ["/elated_euler"],
+ "Image": "nginx",
+ "ImageID": "sha256:0d409d33b27e47423b049f7f863faa08655a8c901749c2b25b93ca67d01a470d",
+ "Command": "nginx -g 'daemon off;'",
+ "Created": 1466734255,
+ "Ports": [{
+ "PrivatePort": 443,
+ "Type": "tcp"
+ }, {
+ "PrivatePort": 80,
+ "Type": "tcp"
+ }
+ ],
+ "Labels": {},
+ "State": "running",
+ "Status": "Up 10 minutes",
+ "HostConfig": {
+ "NetworkMode": "default"
+ },
+ "NetworkSettings": {
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "beceac1c78e75bd5f8a13a60e3bf95b76aa45cac2d31978ae77934da17c16cc8",
+ "EndpointID": "80646c52b170bffbde82cffd0fff2c7096ecf55b47ec297481127b2a4e622416",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:02"
+ }
+ }
+ },
+ "Mounts": []
+ }
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c24814df/libcloud/test/container/fixtures/docker/mac_124/create_container.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/docker/mac_124/create_container.json b/libcloud/test/container/fixtures/docker/mac_124/create_container.json
new file mode 100644
index 0000000..e05a941
--- /dev/null
+++ b/libcloud/test/container/fixtures/docker/mac_124/create_container.json
@@ -0,0 +1,4 @@
+{
+ "Id": "a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303",
+ "Warnings": null
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c24814df/libcloud/test/container/fixtures/docker/mac_124/search.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/docker/mac_124/search.json b/libcloud/test/container/fixtures/docker/mac_124/search.json
new file mode 100644
index 0000000..42d1f85
--- /dev/null
+++ b/libcloud/test/container/fixtures/docker/mac_124/search.json
@@ -0,0 +1,152 @@
+[{
+ "star_count": 2558,
+ "is_official": true,
+ "name": "mysql",
+ "is_automated": false,
+ "description": "MySQL is a widely used, open-source relational database management system (RDBMS)."
+ }, {
+ "star_count": 164,
+ "is_official": false,
+ "name": "mysql/mysql-server",
+ "is_automated": true,
+ "description": "Optimized MySQL Server Docker images. Created, maintained and supported by the MySQL team at Oracle"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "tozd/mysql",
+ "is_automated": true,
+ "description": "MySQL (MariaDB fork) Docker image."
+ }, {
+ "star_count": 45,
+ "is_official": false,
+ "name": "centurylink/mysql",
+ "is_automated": true,
+ "description": "Image containing mysql. Optimized to be linked to another image/container."
+ }, {
+ "star_count": 8,
+ "is_official": false,
+ "name": "appcontainers/mysql",
+ "is_automated": true,
+ "description": "Centos/Debian Based Customizable MySQL Container - Updated 06/16/2016"
+ }, {
+ "star_count": 2,
+ "is_official": false,
+ "name": "alterway/mysql",
+ "is_automated": true,
+ "description": "Docker Mysql"
+ }, {
+ "star_count": 2,
+ "is_official": false,
+ "name": "drupaldocker/mysql",
+ "is_automated": true,
+ "description": "MySQL for Drupal"
+ }, {
+ "star_count": 2,
+ "is_official": false,
+ "name": "yfix/mysql",
+ "is_automated": true,
+ "description": "Yfix docker built mysql"
+ }, {
+ "star_count": 1,
+ "is_official": false,
+ "name": "phpmentors/mysql",
+ "is_automated": true,
+ "description": "MySQL server image"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "cloudposse/mysql",
+ "is_automated": true,
+ "description": "Improved `mysql` service with support for `mysqld_safe` and `fixtures` loaded from `mysqldump.sql`"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "nanobox/mysql",
+ "is_automated": true,
+ "description": "MySQL service for nanobox.io"
+ }, {
+ "star_count": 36,
+ "is_official": false,
+ "name": "sameersbn/mysql",
+ "is_automated": true,
+ "description": ""
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "vukor/mysql",
+ "is_automated": true,
+ "description": "Build for MySQL. Project available on https://github.com/vukor/docker-web-stack"
+ }, {
+ "star_count": 6,
+ "is_official": false,
+ "name": "marvambass/mysql",
+ "is_automated": true,
+ "description": "MySQL Server based on Ubuntu 14.04"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "lancehudson/docker-mysql",
+ "is_automated": true,
+ "description": "MySQL is a widely used, open-source relational database management system (RDBMS)."
+ }, {
+ "star_count": 1,
+ "is_official": false,
+ "name": "sin30/mysql",
+ "is_automated": true,
+ "description": "MySQL images with my own config files."
+ }, {
+ "star_count": 2,
+ "is_official": false,
+ "name": "azukiapp/mysql",
+ "is_automated": true,
+ "description": "Docker image to run MySQL by Azuki - http://azk.io"
+ }, {
+ "star_count": 1,
+ "is_official": false,
+ "name": "kaluzki/mysql",
+ "is_automated": true,
+ "description": "mysql"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "livingobjects/mysql",
+ "is_automated": true,
+ "description": "MySQL"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "akilli/mysql",
+ "is_automated": true,
+ "description": "akilli/base based MySQL image"
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "projectomakase/mysql",
+ "is_automated": true,
+ "description": "Docker image for MySQL"
+ }, {
+ "star_count": 1,
+ "is_official": false,
+ "name": "tetraweb/mysql",
+ "is_automated": true,
+ "description": ""
+ }, {
+ "star_count": 0,
+ "is_official": false,
+ "name": "dockerizedrupal/mysql",
+ "is_automated": true,
+ "description": "docker-mysql"
+ }, {
+ "star_count": 1,
+ "is_official": false,
+ "name": "debezium/example-mysql",
+ "is_automated": true,
+ "description": "Example MySQL database server with a simple Inventory database, useful for demos and tutorials."
+ }, {
+ "star_count": 16,
+ "is_official": false,
+ "name": "google/mysql",
+ "is_automated": true,
+ "description": "MySQL server for Google Compute Engine"
+ }
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c24814df/libcloud/test/container/test_docker.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_docker.py b/libcloud/test/container/test_docker.py
index 7e18557..0f57fed 100644
--- a/libcloud/test/container/test_docker.py
+++ b/libcloud/test/container/test_docker.py
@@ -14,8 +14,6 @@
# limitations under the License.
import sys
-import os
-from functools import wraps
from libcloud.test import unittest