Browse Source

Added Docker Files to mimic third party API's

This change works towards making the API tests pass
against Mimic'd drivers so that real production accounts
do not need to be set up - namely:
- Mimic - Fastly
- Mimic - Keystone

It also makes the mimic fastly instance the default driver in /etc

Implements: bp/mimic-fastly

Change-Id: I35d36fbc2452fc4e2233c19abefd738c9975edd0
tags/2015.11.0b3
amitgandhinz 4 years ago
parent
commit
0d08dfa66e

+ 53
- 0
docker/api/poppy_sample_mocked.conf View File

@@ -0,0 +1,53 @@
1
+[DEFAULT]
2
+log_file = poppy.log
3
+log_config_append = /etc/logging.conf
4
+debug = True
5
+
6
+[drivers]
7
+transport = pecan
8
+manager = default
9
+dns = rackspace
10
+storage = cassandra
11
+providers = fastly
12
+
13
+[drivers:storage:cassandra]
14
+cluster = "cassandra"
15
+keyspace = poppy
16
+archive_on_delete = True
17
+
18
+[drivers:dns]
19
+retries = 5
20
+
21
+[drivers:distributed_task:taskflow]
22
+jobboard_backend_type = zookeeper
23
+persistent_backend_type = zookeeper
24
+jobboard_backend_host = "zookeeper"
25
+jobboard_backend_port = 2181
26
+persistent_backend_host = "zookeeper"
27
+persistent_backend_port = 2181
28
+
29
+[drivers:provider:fastly]
30
+apikey = "fake_key_for_fastly_mimic"
31
+scheme = "http"
32
+host = "mimic:8900"
33
+
34
+[drivers:dns:rackspace]
35
+auth_endpoint = http://mimic:8900/v2.0/tokens
36
+username = "mock_user"
37
+api_key = "mock_key"
38
+use_shards = True
39
+num_shards = 400
40
+shard_prefix = "cdn"
41
+shared_ssl_num_shards = 5
42
+shared_ssl_shard_prefix = "scdn"
43
+shared_ssl_domain_suffix = "secure.poppycdn.net"
44
+url = "poppycdn.net"
45
+url_404 = notfound.com
46
+email = "you@email.com"
47
+timeout = 30
48
+delay = 1
49
+
50
+[log_delivery]
51
+identity_url = http://mimic:8900/v2.0/tokens
52
+preferred_dcs = 'IAD'
53
+container_name = .CDN_ACCESS_LOGS

+ 6
- 1
docker/compose/dependencies.yml View File

@@ -7,4 +7,9 @@ cassandra:
7 7
     image: library/cassandra
8 8
     ports:
9 9
      - 9160:9160
10
-     - 9042:9042
10
+     - 9042:9042
11
+
12
+mimic:
13
+    image: amitgandhinz/mimic
14
+    ports:
15
+     - 8900:8900

+ 9
- 9
docker/compose/poppy_stack.yml View File

@@ -1,11 +1,3 @@
1
-poppy:
2
-    build: ../api/.
3
-    ports:
4
-        - "80:8080"
5
-    links:
6
-        - cassandra
7
-        - zookeeper
8
-
9 1
 zookeeper:
10 2
     extends:
11 3
         file: dependencies.yml
@@ -14,4 +6,12 @@ zookeeper:
14 6
 cassandra:
15 7
     extends:
16 8
         file: dependencies.yml
17
-        service: cassandra
9
+        service: cassandra
10
+
11
+poppy:
12
+    build: ../api/.
13
+    ports:
14
+        - "80:8080"
15
+    links:
16
+        - cassandra
17
+        - zookeeper

+ 24
- 0
docker/compose/poppy_stack_mocked.yml View File

@@ -0,0 +1,24 @@
1
+zookeeper:
2
+    extends:
3
+        file: dependencies.yml
4
+        service: zookeeper
5
+
6
+cassandra:
7
+    extends:
8
+        file: dependencies.yml
9
+        service: cassandra
10
+
11
+mimic:
12
+    extends:
13
+        file: dependencies.yml
14
+        service: mimic
15
+
16
+poppy:
17
+    build: ../api/.
18
+    ports:
19
+        - "80:8080"
20
+    links:
21
+        - cassandra
22
+        - zookeeper
23
+        - mimic
24
+

+ 1
- 1
docker/mimic/Dockerfile View File

@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \
13 13
 RUN /usr/bin/curl -s https://bootstrap.pypa.io/get-pip.py | python
14 14
 
15 15
 WORKDIR /home/source
16
-RUN git clone https://github.com/malini-kamalambal/mimic .
16
+RUN git clone https://github.com/rackerlabs/mimic .
17 17
 RUN pip install -r requirements.txt
18 18
 
19 19
 EXPOSE 8900

+ 6
- 7
etc/poppy.conf View File

@@ -38,10 +38,10 @@ transport = pecan
38 38
 manager = default
39 39
 
40 40
 # Storage driver module (e.g., mongodb, sqlite, cassandra)
41
-storage = mockdb
41
+storage = cassandra
42 42
 
43 43
 # Provider modules list (a list of comma separated provider module list)
44
-providers = mock,fastly,akamai
44
+providers = fastly
45 45
 
46 46
 # DNS driver module (e.g. default, designate, rackspace)
47 47
 dns = default
@@ -80,9 +80,6 @@ replication_strategy = class:SimpleStrategy, replication_factor:1
80 80
 # Path to directory containing CQL migration scripts
81 81
 migrations_path = <poppy_code_path>/poppy/storage/cassandra/migrations
82 82
 
83
-[drivers:storage:mockdb]
84
-database = poppy
85
-
86 83
 [drivers:distributed_task:taskflow]
87 84
 jobboard_backend_type = zookeeper
88 85
 persistent_backend_type = zookeeper
@@ -119,8 +116,10 @@ default_cache_ttl = 86400
119 116
 
120 117
 [drivers:provider:fastly]
121 118
 apikey = "MYAPIKEY"
122
-scheme = "https"
123
-host = "api.fastly.com"
119
+# scheme = "https"
120
+# host = "api.fastly.com"
121
+scheme = "http"
122
+host = "dockerhost:8900/fastly"
124 123
 
125 124
 [drivers:provider:maxcdn]
126 125
 alias = "MYALIAS"

+ 1
- 0
kill_poppy.sh View File

@@ -0,0 +1 @@
1
+ps -ef | grep [p]oppy- | awk -F ' ' '{print$2}' | xargs kill -9

+ 92
- 0
run_poppy.sh View File

@@ -0,0 +1,92 @@
1
+#!/bin/bash
2
+DAEMONIZED=false
3
+WORKERS = 6
4
+
5
+for i in "$@"
6
+do
7
+  case $i in
8
+      -d|--daemonized)
9
+      DAEMONIZED=true
10
+      shift # past argument=value
11
+      ;;
12
+
13
+      -w=*|--workers=*)
14
+      WORKERS="${i#*=}"
15
+      shift # past argument=value
16
+      ;;
17
+
18
+      -?|--help)
19
+      echo "USAGE: ./run_poppy.sh -d -w=10"
20
+      echo "-d | --daemonized : run in daemonized mode"
21
+      echo "-w | --workers : the number of poppy-worker processes to spawn (defaults to 6)"
22
+      exit
23
+
24
+      shift
25
+      ;;
26
+
27
+      *)
28
+      echo "Invalid Options"
29
+      echo "Run ./run_poppy.sh --help for valid parameters."
30
+      exit
31
+              # unknown option
32
+      ;;
33
+  esac
34
+done
35
+
36
+pip install docker-compose
37
+
38
+
39
+# remove existing containers
40
+docker kill compose_cassandra_1
41
+docker kill compose_zookeeper_1
42
+docker rm compose_cassandra_1
43
+docker rm compose_zookeeper_1
44
+
45
+# start new containers
46
+docker-compose -f docker/compose/dependencies.yml up -d
47
+
48
+is_cassandra_ready() {
49
+    nc -z dockerhost 9042
50
+}
51
+
52
+is_zookeeper_ready() {
53
+    nc -z dockerhost 2181
54
+}
55
+
56
+# wait until cassandra is ready
57
+while ! is_cassandra_ready -eq 1
58
+do
59
+  echo "still trying to connect to cassandra"
60
+  sleep 1
61
+done
62
+echo "connected successfully to cassandra"
63
+
64
+
65
+# wait until zookeeper is ready
66
+while ! is_zookeeper_ready -eq 1
67
+do
68
+  echo "still trying to connect to zookeeper"
69
+  sleep 1
70
+done
71
+echo "connected successfully to zookeeper"
72
+
73
+# start the poppy-workers
74
+COUNTER=0
75
+while [ $COUNTER -lt $WORKERS ]; do
76
+  exec poppy-worker > /dev/null 2>&1 &
77
+  echo "poppy-worker spawned."
78
+  let COUNTER=COUNTER+1 
79
+done
80
+
81
+
82
+# start the poppy-server
83
+if $DAEMONIZED; then
84
+  exec poppy-server > /dev/null 2>&1 &
85
+  echo "poppy-server spawned."
86
+else
87
+  exec poppy-server
88
+fi
89
+
90
+
91
+
92
+echo "Poppy Server and Workers Started"

+ 31
- 10
tests/api/README.rst View File

@@ -13,7 +13,7 @@ To run the tests
13 13
 
14 14
 1. Install the dependencies::
15 15
 
16
-    pip install -r requirements.txt
16
+    $ pip install -r requirements.txt
17 17
 
18 18
 2. Set the following environment variables::
19 19
 
@@ -21,17 +21,28 @@ To run the tests
21 21
     export CAFE_ROOT_LOG_PATH=~/.poppy/logs
22 22
     export CAFE_TEST_LOG_PATH=~/.poppy/logs
23 23
 
24
-3. The API tests require a running database (eg cassandra), in order to
24
+3. If you desire highlighting in the output, set the following environment variables::
25
+
26
+    export NOSE_WITH_OPENSTACK=1
27
+    export NOSE_OPENSTACK_COLOR=1
28
+    export NOSE_OPENSTACK_RED=0.05
29
+    export NOSE_OPENSTACK_YELLOW=0.025
30
+    export NOSE_OPENSTACK_SHOW_ELAPSED=1
31
+    export NOSE_OPENSTACK_STDOUT=1
32
+
33
+
34
+4. The API tests require a running database (eg cassandra) and zookeeper, in order to
25 35
 run via tox.
26 36
 
27
-4. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH::
37
+    $ ./run_poppy.sh
38
+
39
+5. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH::
28 40
 
29
-    cp tests/etc/api.conf ~/.poppy/tests.conf
41
+    $ cp tests/etc/api.conf ~/.poppy/tests.conf
30 42
 
31
-5. Once you are ready to run the tests::
43
+6. Once you are ready to run the tests::
32 44
 
33
-    cd tests/api
34
-    nosetests
45
+    $ nosetests api
35 46
 
36 47
 
37 48
 Tox Support
@@ -41,14 +52,24 @@ You can run tox using a docker container hosting Cassandra::
41 52
 
42 53
 Note - This will require docker (or boot2docker for MacOSX) to already be installed on the system.
43 54
 
44
-1. Update your `~/.poppy/tests.conf` to point to your docker cassandra container ip address.
55
+1. Update your `~/.poppy/tests.conf` to point to your docker cassandra/zookeeper container ip address.
45 56
 
46 57
 Example 1: Run all API tests against a docker hosted cassandra instance::
47 58
 
48
-    tox -e api
59
+    $ tox -e api
49 60
 
50 61
 Example 2: Run a particular API test function::
51 62
 
52
-    tox -e api api/services/test_services.py:TestCreateService -- -m test_create_service_positive
63
+    $ tox -e api api/services/test_services.py:TestCreateService -- -m test_create_service_positive
64
+
65
+
66
+Mimic Support
67
+-------------
68
+
69
+Occassionaly you want to test against a mock api rather than the real thing to get around rate limiting issues,
70
+and to get around having to create accounts with a certain provider.
71
+
72
+Mimic helps accomplish this goal for testing.
53 73
 
74
+1.  Run the mimic docker container (via ./run_poppy.sh) and point any remote api url in your test.conf file to your http://dockerhost:8900/mimic_service_name
54 75
 

+ 16
- 5
tests/api/admin/test_akamai_SAN_domain_migration.py View File

@@ -26,6 +26,9 @@ class TestSanCertService(base.TestBase):
26 26
 
27 27
     def setUp(self):
28 28
         super(TestSanCertService, self).setUp()
29
+        if self.test_config.run_operator_tests is False:
30
+            self.skipTest(
31
+                'Test Operator Functions is disabled in configuration')
29 32
 
30 33
         self.service_name = self.generate_random_string(prefix='API-Test-')
31 34
         self.flavor_id = self.test_flavor
@@ -93,9 +96,10 @@ class TestSanCertService(base.TestBase):
93 96
         self.service_url = resp.headers["location"]
94 97
 
95 98
     def test_migrate(self):
99
+
96 100
         new_certs = self.akamai_config.san_certs
97 101
         new_certs_list = new_certs.split(',')
98
-        index = random.randint(0, len(new_certs_list)-1)
102
+        index = random.randint(0, len(new_certs_list) - 1)
99 103
         new_cert = new_certs_list[index]
100 104
 
101 105
         get_resp = self.client.get_service(location=self.service_url)
@@ -125,9 +129,10 @@ class TestSanCertService(base.TestBase):
125 129
         self.assertEqual(data, new_cert)
126 130
 
127 131
     def test_migrate_negative_invalid_projectid(self):
132
+
128 133
         new_certs = self.akamai_config.san_certs
129 134
         new_certs_list = new_certs.split(',')
130
-        index = random.randint(0, len(new_certs_list)-1)
135
+        index = random.randint(0, len(new_certs_list) - 1)
131 136
         new_cert = new_certs_list[index]
132 137
 
133 138
         get_resp = self.client.get_service(location=self.service_url)
@@ -141,9 +146,10 @@ class TestSanCertService(base.TestBase):
141 146
         self.assertEqual(resp.status_code, 404)
142 147
 
143 148
     def test_migrate_negative_invalid_serviceid(self):
149
+
144 150
         new_certs = self.akamai_config.san_certs
145 151
         new_certs_list = new_certs.split(',')
146
-        index = random.randint(0, len(new_certs_list)-1)
152
+        index = random.randint(0, len(new_certs_list) - 1)
147 153
         new_cert = new_certs_list[index]
148 154
 
149 155
         get_resp = self.client.get_service(location=self.service_url)
@@ -157,9 +163,10 @@ class TestSanCertService(base.TestBase):
157 163
         self.assertEqual(resp.status_code, 404)
158 164
 
159 165
     def test_migrate_negative_invalid_domain(self):
166
+
160 167
         new_certs = self.akamai_config.san_certs
161 168
         new_certs_list = new_certs.split(',')
162
-        index = random.randint(0, len(new_certs_list)-1)
169
+        index = random.randint(0, len(new_certs_list) - 1)
163 170
         new_cert = new_certs_list[index]
164 171
 
165 172
         get_resp = self.client.get_service(location=self.service_url)
@@ -185,6 +192,10 @@ class TestSanCertServiceWithLogDelivery(base.TestBase):
185 192
     def setUp(self):
186 193
         super(TestSanCertServiceWithLogDelivery, self).setUp()
187 194
 
195
+        if self.test_config.run_operator_tests is False:
196
+            self.skipTest(
197
+                'Test Operator Functions is disabled in configuration')
198
+
188 199
         self.service_name = self.generate_random_string(prefix='API-Test-')
189 200
         self.flavor_id = self.test_flavor
190 201
 
@@ -256,7 +267,7 @@ class TestSanCertServiceWithLogDelivery(base.TestBase):
256 267
     def test_migrate(self):
257 268
         new_certs = self.akamai_config.san_certs
258 269
         new_certs_list = new_certs.split(',')
259
-        index = random.randint(0, len(new_certs_list)-1)
270
+        index = random.randint(0, len(new_certs_list) - 1)
260 271
         new_cert = new_certs_list[index]
261 272
         get_resp = self.client.get_service(location=self.service_url)
262 273
         get_resp_body = get_resp.json()

+ 25
- 0
tests/api/admin/test_get_service_by_domain.py View File

@@ -28,6 +28,10 @@ class TestGetServiceByDomain(base.TestBase):
28 28
     def setUp(self):
29 29
         super(TestGetServiceByDomain, self).setUp()
30 30
 
31
+        if self.test_config.run_operator_tests is False:
32
+            self.skipTest(
33
+                'Test Operator Functions is disabled in configuration')
34
+
31 35
         self.service_name = self.generate_random_string(prefix='api-test')
32 36
         self.flavor_id = self.test_flavor
33 37
 
@@ -141,6 +145,10 @@ class TestGetServiceByDomain(base.TestBase):
141 145
         self.assertEqual(api_resp2.status_code, 200)
142 146
 
143 147
     def test_negative_get_by_non_existing_domain(self):
148
+        if self.test_config.run_operator_tests is False:
149
+            self.skipTest(
150
+                'Test Operator Functions is disabled in configuration')
151
+
144 152
         domain_name = self.domain_list[0]['domain'] + str(uuid.uuid1()) + \
145 153
             ".com"
146 154
         resp = self.operator_client.admin_get_service_by_domain_name(
@@ -180,6 +188,10 @@ class TestGetServiceBySharedDomain(base.TestBase):
180 188
     def setUp(self):
181 189
         super(TestGetServiceBySharedDomain, self).setUp()
182 190
 
191
+        if self.test_config.run_operator_tests is False:
192
+            self.skipTest(
193
+                'Test Operator Functions is disabled in configuration')
194
+
183 195
         self.service_name = self.generate_random_string(prefix='API-Test-')
184 196
         self.flavor_id = self.test_flavor
185 197
 
@@ -247,6 +259,7 @@ class TestGetServiceBySharedDomain(base.TestBase):
247 259
         self.service_url = resp.headers["location"]
248 260
 
249 261
     def test_get_service_by_domain(self):
262
+
250 263
         get_resp = self.client.get_service(self.service_url)
251 264
         resp_body = get_resp.json()
252 265
         domain = resp_body['domains'][0]['domain']
@@ -281,6 +294,11 @@ class TestGetServiceBySANCertDomain(base.TestBase):
281 294
 
282 295
     def setUp(self):
283 296
         super(TestGetServiceBySANCertDomain, self).setUp()
297
+
298
+        if self.test_config.run_operator_tests is False:
299
+            self.skipTest(
300
+                'Test Operator Functions is disabled in configuration')
301
+
284 302
         self.service_name = self.generate_random_string(prefix='API-Test-')
285 303
         self.flavor_id = self.test_flavor
286 304
 
@@ -348,6 +366,7 @@ class TestGetServiceBySANCertDomain(base.TestBase):
348 366
         self.service_url = resp.headers["location"]
349 367
 
350 368
     def test_get_service_by_domain(self):
369
+
351 370
         get_resp = self.client.get_service(self.service_url)
352 371
         resp_body = get_resp.json()
353 372
         domain = resp_body['domains'][0]['domain']
@@ -382,6 +401,11 @@ class TestGetServiceByCustomCertDomain(base.TestBase):
382 401
 
383 402
     def setUp(self):
384 403
         super(TestGetServiceByCustomCertDomain, self).setUp()
404
+
405
+        if self.test_config.run_operator_tests is False:
406
+            self.skipTest(
407
+                'Test Operator Functions is disabled in configuration')
408
+
385 409
         self.service_name = self.generate_random_string(prefix='API-Test-')
386 410
         self.flavor_id = self.test_flavor
387 411
 
@@ -449,6 +473,7 @@ class TestGetServiceByCustomCertDomain(base.TestBase):
449 473
         self.service_url = resp.headers["location"]
450 474
 
451 475
     def test_get_service_by_domain(self):
476
+
452 477
         get_resp = self.client.get_service(self.service_url)
453 478
         resp_body = get_resp.json()
454 479
         domain = resp_body['domains'][0]['domain']

+ 25
- 0
tests/api/admin/test_perform_action.py View File

@@ -25,6 +25,11 @@ class TestHttpService(base.TestBase):
25 25
 
26 26
     def setUp(self):
27 27
         super(TestHttpService, self).setUp()
28
+
29
+        if self.test_config.run_operator_tests is False:
30
+            self.skipTest(
31
+                'Test Operator Functions is disabled in configuration')
32
+
28 33
         self.service_name = self.generate_random_string(prefix='API-Test-')
29 34
         self.flavor_id = self.test_flavor
30 35
 
@@ -198,6 +203,11 @@ class TestSharedCertService(base.TestBase):
198 203
 
199 204
     def setUp(self):
200 205
         super(TestSharedCertService, self).setUp()
206
+
207
+        if self.test_config.run_operator_tests is False:
208
+            self.skipTest(
209
+                'Test Operator Functions is disabled in configuration')
210
+
201 211
         self.service_name = self.generate_random_string(prefix='API-Test-')
202 212
         self.flavor_id = self.test_flavor
203 213
 
@@ -352,6 +362,11 @@ class TestSanCertService(base.TestBase):
352 362
 
353 363
     def setUp(self):
354 364
         super(TestSanCertService, self).setUp()
365
+
366
+        if self.test_config.run_operator_tests is False:
367
+            self.skipTest(
368
+                'Test Operator Functions is disabled in configuration')
369
+
355 370
         self.service_name = self.generate_random_string(prefix='API-Test-')
356 371
         self.flavor_id = self.test_flavor
357 372
 
@@ -506,6 +521,11 @@ class TestCustomCertService(base.TestBase):
506 521
 
507 522
     def setUp(self):
508 523
         super(TestCustomCertService, self).setUp()
524
+
525
+        if self.test_config.run_operator_tests is False:
526
+            self.skipTest(
527
+                'Test Operator Functions is disabled in configuration')
528
+
509 529
         self.service_name = self.generate_random_string(prefix='API-Test-')
510 530
         self.flavor_id = self.test_flavor
511 531
 
@@ -660,6 +680,11 @@ class TestHttpServiceWithLogDelivery(base.TestBase):
660 680
 
661 681
     def setUp(self):
662 682
         super(TestHttpServiceWithLogDelivery, self).setUp()
683
+
684
+        if self.test_config.run_operator_tests is False:
685
+            self.skipTest(
686
+                'Test Operator Functions is disabled in configuration')
687
+
663 688
         self.service_name = self.generate_random_string(prefix='API-Test-')
664 689
         self.flavor_id = self.test_flavor
665 690
 

+ 6
- 4
tests/api/base.py View File

@@ -25,6 +25,7 @@ from tests.api.utils import config
25 25
 
26 26
 
27 27
 class TestBase(fixtures.BaseTestFixture):
28
+
28 29
     """Child class of fixtures.BaseTestFixture for testing CDN.
29 30
 
30 31
     Inherit from this and write your test methods. If the child class defines
@@ -92,16 +93,17 @@ class TestBase(fixtures.BaseTestFixture):
92 93
                     operator_project_id
93 94
             else:
94 95
                 cls.operator_url = cls.config.base_url + '/v1.0'
96
+
95 97
             cls.operator_client = client.PoppyClient(
96 98
                 cls.operator_url, operator_auth_token, operator_project_id,
97 99
                 serialize_format='json',
98 100
                 deserialize_format='json')
99 101
 
100
-        cls.dns_config = config.DNSConfig()
101
-        cls.dns_client = client.DNSClient(cls.dns_config.dns_username,
102
-                                          cls.dns_config.dns_api_key)
102
+            cls.dns_config = config.DNSConfig()
103
+            cls.dns_client = client.DNSClient(cls.dns_config.dns_username,
104
+                                              cls.dns_config.dns_api_key)
103 105
 
104
-        cls.akamai_config = config.AkamaiConfig()
106
+            cls.akamai_config = config.AkamaiConfig()
105 107
 
106 108
     def generate_random_string(self, prefix='API-Tests', length=12):
107 109
         """Generates a random string of given prefix & length"""

+ 3
- 1
tests/api/services/test_services.py View File

@@ -357,7 +357,9 @@ class TestServiceActions(base.TestBase):
357 357
 
358 358
         self.service_url = resp.headers["location"]
359 359
         self.client.wait_for_service_status(
360
-            location=self.service_url, status='deployed')
360
+            location=self.service_url,
361
+            status='deployed',
362
+            abort_on_status='failed')
361 363
 
362 364
     @attrib.attr('smoke')
363 365
     def test_delete_service(self):

+ 5
- 0
tests/api/utils/client.py View File

@@ -58,6 +58,7 @@ class AuthClient(client.HTTPClient):
58 58
 
59 59
 
60 60
 class DNSClient(client.HTTPClient):
61
+
61 62
     def __init__(self, username, api_key):
62 63
         super(DNSClient, self).__init__()
63 64
 
@@ -339,6 +340,8 @@ class PoppyClient(client.AutoMarshallingHTTPClient):
339 340
                     # this is for debugging purpose,
340 341
                     # will be removed later, so simply use print
341 342
                     print(body.get('errors', []))
343
+                    assert False, ("Aborted on status {0}").format(
344
+                        current_status)
342 345
                     return service
343 346
 
344 347
             current_time = int(time.time())
@@ -366,6 +369,8 @@ class PoppyClient(client.AutoMarshallingHTTPClient):
366 369
                     # this is for debugging purpose,
367 370
                     # will be removed later, so simply use print
368 371
                     print(resp.get('errors', []))
372
+                    assert False, ("Aborted on status {0}").format(
373
+                        current_status)
369 374
                     return resp
370 375
 
371 376
             current_time = int(time.time())

+ 2
- 8
tox.ini View File

@@ -66,9 +66,6 @@ import_exceptions = poppy.openstack.common.gettextutils._
66 66
 [testenv:api]
67 67
 deps = -r{toxinidir}/requirements/requirements.txt
68 68
        -r{toxinidir}/tests/test-requirements.txt
69
-whitelist_externals =
70
-        docker
71
-        sleep
72 69
 setenv = CAFE_CONFIG_FILE_PATH={homedir}/.poppy/tests.conf
73 70
          CAFE_ROOT_LOG_PATH={homedir}/.poppy/logs
74 71
          CAFE_TEST_LOG_PATH={homedir}/.poppy/logs
@@ -82,9 +79,6 @@ setenv = CAFE_CONFIG_FILE_PATH={homedir}/.poppy/tests.conf
82 79
 
83 80
 commands =
84 81
     pip install git+https://github.com/stackforge/opencafe.git#egg=cafe
85
-    pip install -U fig
82
+    ./run_poppy.sh -d
86 83
 
87
-    fig -f docker/fig/fig_cassandra.yml up -d
88
-    sleep 5
89
-    poppy-server --daemon
90
-    nosetests {posargs:--nologcapture}
84
+    nosetests api --nologcapture

Loading…
Cancel
Save