libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/3] libcloud git commit: modify tests, flake8
Date Fri, 14 Oct 2016 08:45:04 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 939f065ed -> 35eb2797c


modify tests, flake8


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f108598a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f108598a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f108598a

Branch: refs/heads/trunk
Commit: f108598a54edc98337673aaec4280cf64ed5a378
Parents: 0c1808f
Author: Mario Loria <mario@arroyonetworks.com>
Authored: Thu Oct 13 14:54:09 2016 -0400
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Fri Oct 14 19:44:40 2016 +1100

----------------------------------------------------------------------
 .../fixtures/rancher/start_container.json       | 109 +++++++++++++++++++
 libcloud/test/container/test_rancher.py         |   6 +
 2 files changed, 115 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f108598a/libcloud/test/container/fixtures/rancher/start_container.json
----------------------------------------------------------------------
diff --git a/libcloud/test/container/fixtures/rancher/start_container.json b/libcloud/test/container/fixtures/rancher/start_container.json
new file mode 100644
index 0000000..f70ef02
--- /dev/null
+++ b/libcloud/test/container/fixtures/rancher/start_container.json
@@ -0,0 +1,109 @@
+{
+  "id": "1i31",
+  "type": "container",
+  "links": {
+    "self": "http://172.30.0.100:8080/v1/containers/1i31",
+    "account": "http://172.30.0.100:8080/v1/containers/1i31/account",
+    "credentials": "http://172.30.0.100:8080/v1/containers/1i31/credentials",
+    "healthcheckInstanceHostMaps": "http://172.30.0.100:8080/v1/containers/1i31/healthcheckinstancehostmaps",
+    "hosts": "http://172.30.0.100:8080/v1/containers/1i31/hosts",
+    "instanceLabels": "http://172.30.0.100:8080/v1/containers/1i31/instancelabels",
+    "instanceLinks": "http://172.30.0.100:8080/v1/containers/1i31/instancelinks",
+    "instances": "http://172.30.0.100:8080/v1/containers/1i31/instances",
+    "mounts": "http://172.30.0.100:8080/v1/containers/1i31/mounts",
+    "ports": "http://172.30.0.100:8080/v1/containers/1i31/ports",
+    "serviceEvents": "http://172.30.0.100:8080/v1/containers/1i31/serviceevents",
+    "serviceExposeMaps": "http://172.30.0.100:8080/v1/containers/1i31/serviceexposemaps",
+    "services": "http://172.30.0.100:8080/v1/containers/1i31/services",
+    "targetInstanceLinks": "http://172.30.0.100:8080/v1/containers/1i31/targetinstancelinks",
+    "volumes": "http://172.30.0.100:8080/v1/containers/1i31/volumes",
+    "stats": "http://172.30.0.100:8080/v1/containers/1i31/stats",
+    "containerStats": "http://172.30.0.100:8080/v1/containers/1i31/containerstats"
+  },
+  "actions": {
+    "update": "http://172.30.0.100:8080/v1/containers/1i31/?action=update",
+    "error": "http://172.30.0.100:8080/v1/containers/1i31/?action=error",
+    "remove": "http://172.30.0.100:8080/v1/containers/1i31/?action=remove",
+    "start": "http://172.30.0.100:8080/v1/containers/1i31/?action=start",
+    "logs": "http://172.30.0.100:8080/v1/containers/1i31/?action=logs",
+    "setlabels": "http://172.30.0.100:8080/v1/containers/1i31/?action=setlabels"
+  },
+  "name": "newcontainer",
+  "state": "starting",
+  "accountId": "1a5",
+  "blkioDeviceOptions": null,
+  "build": null,
+  "capAdd": null,
+  "capDrop": null,
+  "command": null,
+  "cpuSet": null,
+  "cpuShares": null,
+  "createIndex": null,
+  "created": "2016-10-06T15:55:58Z",
+  "createdTS": 1475769358000,
+  "dataVolumeMounts": {},
+  "dataVolumes": [],
+  "dataVolumesFrom": null,
+  "deploymentUnitUuid": null,
+  "description": null,
+  "devices": null,
+  "dns": [
+    "169.254.169.250"
+  ],
+  "dnsSearch": [
+    "rancher.internal"
+  ],
+  "dockerPorts": [],
+  "domainName": null,
+  "entryPoint": null,
+  "environment": {
+    "STORAGE_TYPE": "file"
+  },
+  "expose": null,
+  "externalId": "ab334bd25d25db7b94fdcead8f5c023b05bed424f56243187aa90f5ef7f07b09",
+  "extraHosts": null,
+  "firstRunning": "2016-10-06T15:56:00Z",
+  "firstRunningTS": 1475769360000,
+  "healthCheck": null,
+  "healthState": null,
+  "hostId": "1h1",
+  "hostname": null,
+  "imageUuid": "docker:rlister/hastebin:latest",
+  "kind": "container",
+  "labels": {
+    "io.rancher.container.uuid": "6d3dcf5f-28b8-4e60-9bf1-618b76a9a805",
+    "io.rancher.container.name": "newcontainer",
+    "io.rancher.container.ip": "10.42.204.104/16"
+  },
+  "logConfig": null,
+  "lxcConf": null,
+  "memory": null,
+  "memorySwap": null,
+  "nativeContainer": false,
+  "networkContainerId": null,
+  "networkMode": "managed",
+  "pidMode": null,
+  "ports": null,
+  "primaryIpAddress": "10.42.204.104",
+  "privileged": false,
+  "publishAllPorts": false,
+  "readOnly": false,
+  "registryCredentialId": null,
+  "removed": null,
+  "requestedHostId": null,
+  "restartPolicy": null,
+  "securityOpt": null,
+  "startCount": 1,
+  "startOnCreate": true,
+  "stdinOpen": false,
+  "systemContainer": null,
+  "transitioning": "yes",
+  "transitioningMessage": null,
+  "transitioningProgress": null,
+  "tty": false,
+  "user": null,
+  "uuid": "6d3dcf5f-28b8-4e60-9bf1-618b76a9a805",
+  "version": "0",
+  "volumeDriver": null,
+  "workingDir": null
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f108598a/libcloud/test/container/test_rancher.py
----------------------------------------------------------------------
diff --git a/libcloud/test/container/test_rancher.py b/libcloud/test/container/test_rancher.py
index f0a6edb..178e298 100644
--- a/libcloud/test/container/test_rancher.py
+++ b/libcloud/test/container/test_rancher.py
@@ -162,12 +162,14 @@ class RancherContainerDriverTestCase(unittest.TestCase):
         started = container.start()
         self.assertEqual(started.id, "1i31")
         self.assertEqual(started.name, "newcontainer")
+        self.assertEqual(started.extra['state'], "starting")
 
     def test_stop_container(self):
         container = self.driver.get_container("1i31")
         stopped = container.stop()
         self.assertEqual(stopped.id, "1i31")
         self.assertEqual(stopped.name, "newcontainer")
+        self.assertEqual(stopped.extra['state'], "stopping")
 
     def test_ex_search_containers(self):
         containers = self.driver.ex_search_containers({"state": "running"})
@@ -178,6 +180,7 @@ class RancherContainerDriverTestCase(unittest.TestCase):
         destroyed = container.destroy()
         self.assertEqual(destroyed.id, "1i31")
         self.assertEqual(destroyed.name, "newcontainer")
+        self.assertEqual(destroyed.extra['state'], "stopping")
 
 
 class RancherMockHttp(MockHttp):
@@ -244,6 +247,9 @@ class RancherMockHttp(MockHttp):
         elif method == 'DELETE' or '?action=stop' in url:
             return (httplib.OK, self.fixtures.load('stop_container.json'), {},
                     httplib.responses[httplib.OK])
+        elif '?action=start' in url:
+            return (httplib.OK, self.fixtures.load('start_container.json'), {},
+                    httplib.responses[httplib.OK])
         else:
             return (httplib.OK, self.fixtures.load('deploy_container.json'),
                     {}, httplib.responses[httplib.OK])


Mime
View raw message