Exercise 8 PR #95

Merged
reynisson merged 68 commits from dev into main 2021-11-29 06:46:44 +00:00
136 changed files with 4797 additions and 234 deletions

View File

@ -26,14 +26,28 @@ services:
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
tapas-db:
image: mongo
restart: unless-stopped
container_name: tapas_mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- "27017:27017"
command: mongod --quiet --logpath /dev/null
tapas-tasks:
image: openjdk
command: "java -jar /data/tapas-tasks-0.0.1-SNAPSHOT.jar"
restart: unless-stopped
depends_on:
- tapas-db
volumes:
- ./:/data/
environment:
roster.uri: http://roster:8082
spring.data.mongodb.uri: mongodb://root:password@tapas-db:27017
labels:
- "traefik.enable=true"
- "traefik.http.routers.tapas-tasks.rule=Host(`tapas-tasks.${PUB_IP}.nip.io`)"
@ -47,6 +61,8 @@ services:
image: openjdk
command: "java -jar /data/tapas-auction-house-0.0.1-SNAPSHOT.jar"
restart: unless-stopped
depends_on:
- tapas-db
volumes:
- ./:/data/
environment:
@ -64,13 +80,16 @@ services:
image: openjdk
command: "java -jar /data/roster-0.0.1-SNAPSHOT.jar"
restart: unless-stopped
depends_on:
- tapas-db
volumes:
- ./:/data/
environment:
task-list.uri: http://tapas-tasks:8081
executor-robot.uri: http://executor-robot:8084
executor-computation.uri: http://executor-computation:8085
task.list.uri: http://tapas-tasks:8081
executor.robot.uri: http://executor-robot:8084
executor.computation.uri: http://executor-computation:8085
mqtt.broker.uri: tcp://broker.hivemq.com:1883
spring.data.mongodb.uri: mongodb://root:password@tapas-db:27017
labels:
- "traefik.enable=true"
- "traefik.http.routers.roster.rule=Host(`roster.${PUB_IP}.nip.io`)"
@ -84,10 +103,13 @@ services:
image: openjdk
command: "java -jar /data/executor-pool-0.0.1-SNAPSHOT.jar"
restart: unless-stopped
depends_on:
- tapas-db
volumes:
- ./:/data/
environment:
mqtt.broker.uri: tcp://broker.hivemq.com:1883
spring.data.mongodb.uri: mongodb://root:password@tapas-db:27017
labels:
- "traefik.enable=true"
- "traefik.http.routers.executor-pool.rule=Host(`executor-pool.${PUB_IP}.nip.io`)"
@ -104,11 +126,12 @@ services:
depends_on:
- executor-pool
- roster
- tapas-db
volumes:
- ./:/data/
environment:
executor_pool_uri: http://executor-pool:8083
roster_uri: http://roster:8082
EXECUTOR_POOL_URI: http://executor-pool:8083
ROSTER_URI: http://roster:8082
labels:
- "traefik.enable=true"
- "traefik.http.routers.executor-computation.rule=Host(`executor-computation.${PUB_IP}.nip.io`)"
@ -124,11 +147,12 @@ services:
depends_on:
- executor-pool
- roster
- tapas-db
volumes:
- ./:/data/
environment:
executor_pool_uri: http://executor-pool:8083
roster_uri: http://roster:8082
EXECUTOR_POOL_URI: http://executor-pool:8083
ROSTER_URI: http://roster:8082
labels:
- "traefik.enable=true"
- "traefik.http.routers.executor-robot.rule=Host(`executor-robot.${PUB_IP}.nip.io`)"

View File

@ -0,0 +1,266 @@
[2021-11-28 16:28:04 DEBUG] [cli:103] ###############################################################################
[2021-11-28 16:28:04 DEBUG] [cli:104] Running command 'run'
[2021-11-28 16:28:04 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 16:28:05 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:28:05 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:28:05 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:28:05 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 16:28:05 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:28:05 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:28:05 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:28:05 INFO] [experiment:109] Experiment looks valid
[2021-11-28 16:28:05 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 16:28:05 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:28:05 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:28:05 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:28:05 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:28:05 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:28:05 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-28 16:28:05 DEBUG] [__init__:49] Initializing controls
[2021-11-28 16:28:05 INFO] [run:336] Steady-state strategy: default
[2021-11-28 16:28:05 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 16:28:05 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:28:05 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:28:05 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 16:28:05 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:28:05 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output
self.send(msg)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send
self.connect()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x10438d220>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/enable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438d220>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 24, in enable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/enable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438d220>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 24, in enable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
chaoslib.exceptions.ActivityFailed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/enable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438d220>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-28 16:28:05 ERROR] [activity:213] => failed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/enable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438d220>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:28:05 INFO] [activity:188] Action: configure_assaults
[2021-11-28 16:28:05 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:28:05 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output
self.send(msg)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send
self.connect()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x10438de50>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/assaults (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438de50>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 83, in change_assaults_configuration
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/assaults (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438de50>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 83, in change_assaults_configuration
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
chaoslib.exceptions.ActivityFailed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/assaults (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438de50>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-28 16:28:05 ERROR] [activity:213] => failed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8085): Max retries exceeded with url: /actuator/chaosmonkey/assaults (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10438de50>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:28:05 INFO] [run:885] Let's rollback...
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:28:05 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:28:05 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 16:28:05 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:28:05 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 16:28:05 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 16:54:22 DEBUG] [cli:103] ###############################################################################
[2021-11-28 16:54:22 DEBUG] [cli:104] Running command 'run'
[2021-11-28 16:54:22 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 16:54:23 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 16:54:23 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:54:23 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:54:23 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:54:23 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:54:23 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 16:54:23 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:54:23 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:54:23 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:54:23 INFO] [experiment:109] Experiment looks valid
[2021-11-28 16:54:23 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 16:54:23 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:54:23 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:54:23 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:54:23 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:54:23 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:54:23 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-28 16:54:23 DEBUG] [__init__:49] Initializing controls
[2021-11-28 16:54:23 INFO] [run:336] Steady-state strategy: default
[2021-11-28 16:54:23 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 16:54:23 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 16:54:23 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:54:23 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 16:54:23 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:54:23 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:54:23 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 16:54:23 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:54:24 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-28T15:54:24.502699Z"}'
[2021-11-28 16:54:24 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:54:24 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:54:24 INFO] [activity:188] Action: configure_assaults
[2021-11-28 16:54:24 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:54:25 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-28 16:54:25 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:54:25 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:54:25 INFO] [run:885] Let's rollback...
[2021-11-28 16:54:25 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:54:25 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 16:54:25 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:54:25 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 16:54:25 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:54:25 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 16:54:25 DEBUG] [caching:42] Clearing activities cache

View File

@ -0,0 +1,24 @@
{
"title": "Disable chaos monkey",
"description": "Disable",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [],
"rollbacks": [
{
"name": "disable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "disable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
]
}

View File

@ -0,0 +1,54 @@
{
"title": "Testing exceptions",
"description": "Testing exceptions!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": true,
"exception": {
"type": "java.lang.RuntimeException",
"arguments": [
{
"className": "java.lang.String",
"value": "Exception assault has been carried out"
}
]
}
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,113 @@
{
"chaoslib-version": "1.23.0",
"platform": "macOS-12.0-arm64-arm-64bit",
"node": "Marcels-MBP-M1",
"experiment": {
"title": "What is the impact of an expired certificate on our application chain?",
"description": "If a certificate expires, we should gracefully deal with the issue.",
"tags": [
"tls"
],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": [],
"dry": null
},
"start": "2021-11-28T15:54:23.134945",
"status": "completed",
"deviated": false,
"steady_states": {
"before": null,
"after": null,
"during": []
},
"run": [
{
"activity": {
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
"output": "{\"status\":\"Chaos Monkey is enabled\",\"enabledAt\":\"2021-11-28T15:54:24.502699Z\"}",
"status": "succeeded",
"start": "2021-11-28T15:54:23.135657",
"end": "2021-11-28T15:54:24.853870",
"duration": 1.718213
},
{
"activity": {
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
"output": "Assault config has changed",
"status": "succeeded",
"start": "2021-11-28T15:54:24.854282",
"end": "2021-11-28T15:54:25.705360",
"duration": 0.851078
}
],
"rollbacks": [],
"end": "2021-11-28T15:54:25.706100",
"duration": 2.609093189239502
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing kill & restart",
"description": "Testing behavoir when killing and restarting the application",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 5000,
"latencyActive": false,
"exceptionsActive": false,
"killApplicationActive": true,
"restartApplicationActive": true
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing latency",
"description": "Testing latency!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,49 @@
{
"title": "Testing memory",
"description": "Testing memory!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8085/actuator",
"assaults_configuration": {
"level": 5,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": false,
"memoryActive": true,
"memoryMillisecondsHoldFilledMemory": 90000,
"memoryMillisecondsWaitNextIncrease": 100,
"memoryFillIncrementFraction": 0.9,
"memoryFillTargetFraction": 0.95,
"runtimeAssaultCronExpression": "*/1 * * * * ?"
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

14
.experiments/readme.md Normal file
View File

@ -0,0 +1,14 @@
# Create python env
python3 -m venv ~/.venvs/chaostk
# Activate python env
source ~/.venvs/chaostk/bin/activate
# Run tests
chaos run latency.json
chaos run kill-restart.json
# Disable tests
chaos run disable.json

View File

@ -0,0 +1,135 @@
[2021-11-28 14:43:28 DEBUG] [cli:103] ###############################################################################
[2021-11-28 14:43:28 DEBUG] [cli:104] Running command 'run'
[2021-11-28 14:43:28 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 14:43:42 DEBUG] [cli:103] ###############################################################################
[2021-11-28 14:43:42 DEBUG] [cli:104] Running command 'run'
[2021-11-28 14:43:42 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 14:43:42 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 14:43:42 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 14:43:42 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 14:43:42 DEBUG] [caching:24] Building activity cache...
[2021-11-28 14:43:42 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 14:43:42 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 14:43:42 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 14:43:42 DEBUG] [secret:78] Loading secrets...
[2021-11-28 14:43:42 DEBUG] [secret:104] Done loading secrets
[2021-11-28 14:43:42 INFO] [experiment:109] Experiment looks valid
[2021-11-28 14:43:42 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 14:43:42 DEBUG] [caching:24] Building activity cache...
[2021-11-28 14:43:42 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 14:43:42 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 14:43:42 DEBUG] [secret:78] Loading secrets...
[2021-11-28 14:43:42 DEBUG] [secret:104] Done loading secrets
[2021-11-28 14:43:42 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-28 14:43:42 DEBUG] [__init__:49] Initializing controls
[2021-11-28 14:43:42 INFO] [run:336] Steady-state strategy: default
[2021-11-28 14:43:42 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 14:43:42 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 14:43:42 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 14:43:42 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 14:43:42 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 14:43:42 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 14:43:42 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 14:43:42 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 14:43:43 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 36, in enable_chaosmonkey
raise FailedActivity(f"Enable ChaosMonkey failed: {response.text}")
chaoslib.exceptions.ActivityFailed: Enable ChaosMonkey failed: {"timestamp":"2021-11-28T13:43:43.069+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/enable"}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 36, in enable_chaosmonkey
raise FailedActivity(f"Enable ChaosMonkey failed: {response.text}")
chaoslib.exceptions.ActivityFailed: chaoslib.exceptions.ActivityFailed: Enable ChaosMonkey failed: {"timestamp":"2021-11-28T13:43:43.069+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/enable"}
[2021-11-28 14:43:43 ERROR] [activity:213] => failed: chaoslib.exceptions.ActivityFailed: Enable ChaosMonkey failed: {"timestamp":"2021-11-28T13:43:43.069+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/enable"}
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 14:43:43 INFO] [activity:188] Action: configure_assaults
[2021-11-28 14:43:43 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 14:43:43 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 96, in change_assaults_configuration
raise FailedActivity(
chaoslib.exceptions.ActivityFailed: Change ChaosMonkey Assaults Configuration failed: {"timestamp":"2021-11-28T13:43:43.203+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/assaults"}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 96, in change_assaults_configuration
raise FailedActivity(
chaoslib.exceptions.ActivityFailed: chaoslib.exceptions.ActivityFailed: Change ChaosMonkey Assaults Configuration failed: {"timestamp":"2021-11-28T13:43:43.203+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/assaults"}
[2021-11-28 14:43:43 ERROR] [activity:213] => failed: chaoslib.exceptions.ActivityFailed: Change ChaosMonkey Assaults Configuration failed: {"timestamp":"2021-11-28T13:43:43.203+00:00","status":404,"error":"Not Found","message":"No message available","path":"/actuator/chaosmonkey/assaults"}
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 14:43:43 INFO] [run:885] Let's rollback...
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 14:43:43 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 14:43:43 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 14:43:43 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 14:43:43 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 14:43:43 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 16:24:55 DEBUG] [cli:103] ###############################################################################
[2021-11-28 16:24:55 DEBUG] [cli:104] Running command 'run'
[2021-11-28 16:24:55 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 16:24:55 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 16:24:55 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:24:55 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 16:24:55 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:24:55 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:24:55 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 16:24:55 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:24:55 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:24:55 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:24:55 INFO] [experiment:109] Experiment looks valid
[2021-11-28 16:24:55 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 16:24:55 DEBUG] [caching:24] Building activity cache...
[2021-11-28 16:24:55 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 16:24:55 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 16:24:55 DEBUG] [secret:78] Loading secrets...
[2021-11-28 16:24:55 DEBUG] [secret:104] Done loading secrets
[2021-11-28 16:24:55 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-28 16:24:55 DEBUG] [__init__:49] Initializing controls
[2021-11-28 16:24:55 INFO] [run:336] Steady-state strategy: default
[2021-11-28 16:24:55 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 16:24:55 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 16:24:55 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:24:55 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 16:24:55 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:24:55 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:24:55 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 16:24:55 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:24:56 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-28T15:24:56.52458Z"}'
[2021-11-28 16:24:56 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:24:56 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:24:56 INFO] [activity:188] Action: configure_assaults
[2021-11-28 16:24:56 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 16:24:57 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-28 16:24:57 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 16:24:57 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 16:24:57 INFO] [run:885] Let's rollback...
[2021-11-28 16:24:57 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:24:57 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 16:24:57 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 16:24:57 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 16:24:57 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 16:24:57 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 16:24:57 DEBUG] [caching:42] Clearing activities cache

View File

@ -0,0 +1,24 @@
{
"title": "Disable chaos monkey",
"description": "Disable",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [],
"rollbacks": [
{
"name": "disable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "disable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
]
}

View File

@ -0,0 +1,54 @@
{
"title": "Testing exceptions",
"description": "Testing exceptions!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": true,
"exception": {
"type": "java.lang.RuntimeException",
"arguments": [
{
"className": "java.lang.String",
"value": "Exception assault has been carried out"
}
]
}
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,113 @@
{
"chaoslib-version": "1.23.0",
"platform": "macOS-12.0-arm64-arm-64bit",
"node": "Marcels-MBP-M1",
"experiment": {
"title": "What is the impact of an expired certificate on our application chain?",
"description": "If a certificate expires, we should gracefully deal with the issue.",
"tags": [
"tls"
],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": [],
"dry": null
},
"start": "2021-11-28T15:24:55.984078",
"status": "completed",
"deviated": false,
"steady_states": {
"before": null,
"after": null,
"during": []
},
"run": [
{
"activity": {
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
"output": "{\"status\":\"Chaos Monkey is enabled\",\"enabledAt\":\"2021-11-28T15:24:56.52458Z\"}",
"status": "succeeded",
"start": "2021-11-28T15:24:55.984855",
"end": "2021-11-28T15:24:56.785205",
"duration": 0.80035
},
{
"activity": {
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
"output": "Assault config has changed",
"status": "succeeded",
"start": "2021-11-28T15:24:56.785494",
"end": "2021-11-28T15:24:57.394090",
"duration": 0.608596
}
],
"rollbacks": [],
"end": "2021-11-28T15:24:57.394597",
"duration": 1.4326798915863037
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing kill & restart",
"description": "Testing behavoir when killing and restarting the application",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 5000,
"latencyActive": false,
"exceptionsActive": false,
"killApplicationActive": true,
"restartApplicationActive": true
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing latency",
"description": "Testing latency!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,49 @@
{
"title": "Testing memory",
"description": "Testing memory!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8082/actuator",
"assaults_configuration": {
"level": 5,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": false,
"memoryActive": true,
"memoryMillisecondsHoldFilledMemory": 90000,
"memoryMillisecondsWaitNextIncrease": 100,
"memoryFillIncrementFraction": 0.9,
"memoryFillTargetFraction": 0.95,
"runtimeAssaultCronExpression": "*/1 * * * * ?"
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,936 @@
[2021-11-27 11:35:02 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:35:02 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:35:02 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:35:02 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:35:02 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:35:02 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:35:02 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:35:02 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:35:02 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:35:02 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:35:02 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:35:02 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:35:02 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:35:02 ERROR] [cli:251] hypothesis requires a title
[2021-11-27 11:35:02 DEBUG] [cli:252] hypothesis requires a title
[2021-11-27 11:35:57 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:35:57 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:35:57 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:35:58 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:35:58 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:35:58 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:35:58 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:35:58 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:35:58 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:35:58 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:35:58 ERROR] [cli:251] experiment requires a description
[2021-11-27 11:35:58 DEBUG] [cli:252] experiment requires a description
[2021-11-27 11:36:18 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:36:18 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:36:18 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:36:18 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:36:18 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:36:18 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:36:18 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:36:18 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:36:18 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:36:18 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:36:18 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:36:18 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:36:18 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:36:18 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:36:18 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:36:18 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:36:18 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:36:18 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:36:18 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:36:18 INFO] [run:319] Running experiment: Testing kill & restart
[2021-11-27 11:36:18 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:36:18 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:36:18 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:36:18 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:36:18 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:36:18 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:36:18 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:36:18 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:18 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:36:18 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:19 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:36:19.060458Z"}'
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:19 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:36:19 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:19 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:36:19 INFO] [run:885] Let's rollback...
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:36:19 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:19 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:36:19 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:19 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output
self.send(msg)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send
self.connect()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x106688100>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106688100>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106688100>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
chaoslib.exceptions.ActivityFailed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106688100>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:36:19 ERROR] [activity:213] => failed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x106688100>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:36:19 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:36:19 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:36:19 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:36:19 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:36:54 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:36:54 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:36:54 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:36:54 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:36:54 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:36:54 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:36:54 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:36:54 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:36:54 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:36:54 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:36:54 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:36:54 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:36:54 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:36:54 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:36:54 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:36:54 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:36:54 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:36:54 INFO] [run:319] Running experiment: Testing kill & restart
[2021-11-27 11:36:54 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:36:54 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:36:54 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:36:54 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:36:54 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:36:54 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:54 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:36:54.668324Z"}'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:36:54 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:54 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:36:54 INFO] [run:885] Let's rollback...
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:36:54 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:36:54 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:36:54 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output
self.send(msg)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send
self.connect()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x104be0100>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x104be0100>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x104be0100>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
chaoslib.exceptions.ActivityFailed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x104be0100>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:36:54 ERROR] [activity:213] => failed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x104be0100>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:36:54 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:36:54 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:36:54 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:36:54 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:36:59 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:36:59 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:36:59 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:37:00 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:37:00 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:37:00 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:37:00 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:37:00 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:37:00 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:37:00 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:37:00 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:37:00 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:37:00 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:37:00 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:37:00 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:37:00 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:37:00 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:37:00 INFO] [run:319] Running experiment: Testing kill & restart
[2021-11-27 11:37:00 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:37:00 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:37:00 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:37:00 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:37:00 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:37:00 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:37:00 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:37:00.591716Z"}'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:37:00 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:37:00 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:37:00 INFO] [run:885] Let's rollback...
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:37:00 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:37:00 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:37:00 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is disabled","disabledAt":"2021-11-27T10:37:00.650024Z"}'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:37:00 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:37:00 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:37:00 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:37:00 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:38:39 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:38:39 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:38:39 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:38:40 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:38:40 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:38:40 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:38:40 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:38:40 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:38:40 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:38:40 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:38:40 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:38:40 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:38:40 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:38:40 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:38:40 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:38:40 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:38:40 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:38:40 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:38:40 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:38:40 INFO] [run:319] Running experiment: Testing kill & restart
[2021-11-27 11:38:40 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:38:40 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:38:40 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:38:40 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:38:40 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:38:40 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:38:40 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:38:40 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:40 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:38:40 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:38:41 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:38:40.795245Z"}'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:41 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:38:41 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:38:41 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:38:41 INFO] [run:885] Let's rollback...
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:38:41 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:41 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:38:41 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:38:41 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is disabled","disabledAt":"2021-11-27T10:38:41.923689Z"}'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:38:41 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:38:41 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:38:41 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:38:41 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:42:14 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:42:14 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:42:14 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:42:15 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:42:15 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:42:15 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:42:15 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:42:15 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:42:15 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:42:15 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:42:15 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:42:15 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:42:15 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:42:15 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:42:15 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:42:15 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:42:15 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:42:15 INFO] [run:319] Running experiment: Testing kill & restart
[2021-11-27 11:42:15 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:42:15 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:42:15 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:42:15 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:42:15 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:42:15 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:42:15 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:42:15 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:42:15.310527Z"}'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:42:15 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:42:15 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:42:15 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:42:15 INFO] [run:885] Let's rollback...
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:42:15 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:42:15 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:42:15 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:42:15 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:42:15 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:43:22 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:43:22 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:43:22 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:43:23 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:43:23 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:43:23 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:43:23 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:43:23 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:43:23 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:43:23 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:43:23 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:43:23 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:43:23 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:43:23 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:43:23 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:43:23 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:43:23 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:43:23 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-27 11:43:23 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:43:23 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:43:23 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:43:23 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:43:23 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:23 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:43:23 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:43:23 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:43:23.565576Z"}'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:23 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:43:23 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:43:23 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:43:23 INFO] [run:885] Let's rollback...
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:43:23 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:43:23 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:43:23 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:43:23 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:43:23 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:43:50 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:43:50 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:43:50 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:43:50 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:43:50 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:43:50 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:43:50 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:43:50 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:43:50 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:43:50 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:43:50 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:43:50 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:43:50 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:43:50 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:43:50 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:43:50 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:43:50 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:43:50 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-27 11:43:50 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:43:50 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:43:50 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:43:50 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:43:50 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:50 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:43:50 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:43:50 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:43:50.888054Z"}'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:50 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:43:50 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:43:50 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:43:50 INFO] [run:885] Let's rollback...
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:43:50 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:43:50 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:43:50 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:43:50 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:43:50 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:47:20 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:47:20 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:47:20 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:47:21 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:47:21 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:47:21 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:47:21 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:47:21 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:47:21 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:47:21 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:47:21 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:47:21 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:47:21 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:47:21 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:47:21 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:47:21 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:47:21 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:47:21 INFO] [run:319] Running experiment: Disable chaos monkey
[2021-11-27 11:47:21 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:47:21 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:47:21 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:47:21 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:47:21 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:47:21 INFO] [activity:113] No declared activities, let's move on.
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:47:21 INFO] [run:885] Let's rollback...
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:47:21 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:47:21 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:47:21 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:47:21 DEBUG] [activity:260] Activity failed
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1034, in _send_output
self.send(msg)
File "/opt/homebrew/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 974, in send
self.connect()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
conn = self._new_conn()
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x1024bf220>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1024bf220>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1024bf220>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/activity.py", line 253, in run_activity
result = run_python_activity(activity, configuration, secrets)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 58, in run_python_activity
raise ActivityFailed(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaoslib/provider/python.py", line 56, in run_python_activity
return func(**arguments)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py", line 53, in disable_chaosmonkey
response = api.call_api(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/api.py", line 56, in call_api
return requests.request(
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
chaoslib.exceptions.ActivityFailed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1024bf220>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:47:21 ERROR] [activity:213] => failed: requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /actuator/chaosmonkey/disable (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1024bf220>: Failed to establish a new connection: [Errno 61] Connection refused'))
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:47:21 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:47:21 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:47:21 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:47:21 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:47:29 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:47:29 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:47:29 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:47:30 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:47:30 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:47:30 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:47:30 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:47:30 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:47:30 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:47:30 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:47:30 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:47:30 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:47:30 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:47:30 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:47:30 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:47:30 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:47:30 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:47:30 INFO] [run:319] Running experiment: Disable chaos monkey
[2021-11-27 11:47:30 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:47:30 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:47:30 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:47:30 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:47:30 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:47:30 INFO] [activity:113] No declared activities, let's move on.
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:47:30 INFO] [run:885] Let's rollback...
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:47:30 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:47:30 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:47:30 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:47:30 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is disabled","disabledAt":"2021-11-27T10:47:30.172107Z"}'
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:47:30 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:47:30 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:47:30 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:47:30 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:49:33 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:49:33 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:49:33 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:49:33 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:49:33 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:49:33 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:49:33 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:49:33 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:49:33 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:49:33 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:49:33 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:49:33 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:49:33 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:49:33 DEBUG] [caching:35] Cached 2 activities
[2021-11-27 11:49:33 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:49:33 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:49:33 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:49:33 INFO] [run:319] Running experiment: What is the impact of an expired certificate on our application chain?
[2021-11-27 11:49:33 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:49:33 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:49:33 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:49:33 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:49:33 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:49:33 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-27 11:49:33 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:49:33 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-27T10:49:33.912573Z"}'
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:49:33 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:49:33 INFO] [activity:188] Action: configure_assaults
[2021-11-27 11:49:33 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:49:34 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-27 11:49:34 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:49:34 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:49:34 INFO] [run:885] Let's rollback...
[2021-11-27 11:49:34 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:49:34 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-27 11:49:34 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:49:34 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:49:34 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:49:34 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:49:34 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:50:00 DEBUG] [cli:103] ###############################################################################
[2021-11-27 11:50:00 DEBUG] [cli:104] Running command 'run'
[2021-11-27 11:50:00 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-27 11:50:01 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-27 11:50:01 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:50:01 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:50:01 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-27 11:50:01 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:50:01 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:50:01 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:50:01 INFO] [experiment:109] Experiment looks valid
[2021-11-27 11:50:01 DEBUG] [caching:42] Clearing activities cache
[2021-11-27 11:50:01 DEBUG] [caching:24] Building activity cache...
[2021-11-27 11:50:01 DEBUG] [caching:35] Cached 0 activities
[2021-11-27 11:50:01 DEBUG] [configuration:54] Loading configuration...
[2021-11-27 11:50:01 DEBUG] [secret:78] Loading secrets...
[2021-11-27 11:50:01 DEBUG] [secret:104] Done loading secrets
[2021-11-27 11:50:01 INFO] [run:319] Running experiment: Disable chaos monkey
[2021-11-27 11:50:01 DEBUG] [__init__:49] Initializing controls
[2021-11-27 11:50:01 INFO] [run:336] Steady-state strategy: default
[2021-11-27 11:50:01 INFO] [run:340] Rollbacks strategy: default
[2021-11-27 11:50:01 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:50:01 INFO] [run:599] Playing your experiment's method now...
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:50:01 INFO] [activity:113] No declared activities, let's move on.
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-27 11:50:01 INFO] [run:885] Let's rollback...
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:50:01 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:50:01 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-27 11:50:01 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-27 11:50:01 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is disabled","disabledAt":"2021-11-27T10:50:01.207712Z"}'
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-27 11:50:01 INFO] [run:450] Experiment ended with status: completed
[2021-11-27 11:50:01 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-27 11:50:01 DEBUG] [__init__:82] Cleaning up controls
[2021-11-27 11:50:01 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:00:15 DEBUG] [cli:103] ###############################################################################
[2021-11-28 18:00:15 DEBUG] [cli:104] Running command 'run'
[2021-11-28 18:00:15 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 18:00:15 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 18:00:15 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:00:15 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:00:15 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:00:15 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 18:00:15 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 18:00:15 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:00:15 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:00:15 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:00:15 INFO] [experiment:109] Experiment looks valid
[2021-11-28 18:00:15 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:00:15 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:00:15 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 18:00:15 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:00:15 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:00:15 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:00:15 INFO] [run:319] Running experiment: Testing latency
[2021-11-28 18:00:15 DEBUG] [__init__:49] Initializing controls
[2021-11-28 18:00:15 INFO] [run:336] Steady-state strategy: default
[2021-11-28 18:00:15 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 18:00:15 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 18:00:15 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:00:15 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 18:00:15 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:00:15 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:00:15 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 18:00:15 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 18:00:17 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-28T17:00:16.734825Z"}'
[2021-11-28 18:00:17 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:00:17 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:00:17 INFO] [activity:188] Action: configure_assaults
[2021-11-28 18:00:17 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 18:00:19 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-28 18:00:19 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:00:19 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:00:19 INFO] [run:885] Let's rollback...
[2021-11-28 18:00:19 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:00:19 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 18:00:19 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:00:19 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 18:00:19 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:00:19 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 18:00:19 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:07:50 DEBUG] [cli:103] ###############################################################################
[2021-11-28 18:07:50 DEBUG] [cli:104] Running command 'run'
[2021-11-28 18:07:50 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 18:07:50 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 18:07:50 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:07:50 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:07:50 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:07:50 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 18:07:50 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 18:07:50 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:07:50 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:07:50 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:07:50 INFO] [experiment:109] Experiment looks valid
[2021-11-28 18:07:50 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:07:50 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:07:50 DEBUG] [caching:35] Cached 2 activities
[2021-11-28 18:07:50 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:07:50 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:07:51 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:07:51 INFO] [run:319] Running experiment: Testing latency
[2021-11-28 18:07:51 DEBUG] [__init__:49] Initializing controls
[2021-11-28 18:07:51 INFO] [run:336] Steady-state strategy: default
[2021-11-28 18:07:51 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 18:07:51 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:07:51 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:07:51 INFO] [activity:188] Action: enable_chaosmonkey
[2021-11-28 18:07:51 DEBUG] [python:33] Activity 'enable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 18:07:51 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is enabled","enabledAt":"2021-11-28T17:07:51.182021Z"}'
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:07:51 INFO] [activity:188] Action: configure_assaults
[2021-11-28 18:07:51 DEBUG] [python:33] Activity 'configure_assaults' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 18:07:51 DEBUG] [activity:205] => succeeded with 'Assault config has changed'
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:07:51 INFO] [run:885] Let's rollback...
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:07:51 INFO] [rollback:27] No declared rollbacks, let's move on.
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:07:51 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 18:07:51 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:07:51 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 18:07:51 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:09:39 DEBUG] [cli:103] ###############################################################################
[2021-11-28 18:09:39 DEBUG] [cli:104] Running command 'run'
[2021-11-28 18:09:39 DEBUG] [cli:108] Using settings file '/Users/maece/.chaostoolkit/settings.yaml'
[2021-11-28 18:09:40 DEBUG] [settings:30] The Chaos Toolkit settings file could not be found at '/Users/maece/.chaostoolkit/settings.yaml'.
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'loader'
[2021-11-28 18:09:40 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:09:40 DEBUG] [caching:35] Cached 0 activities
[2021-11-28 18:09:40 INFO] [experiment:58] Validating the experiment's syntax
[2021-11-28 18:09:40 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:09:40 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:09:40 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:09:40 INFO] [experiment:109] Experiment looks valid
[2021-11-28 18:09:40 DEBUG] [caching:42] Clearing activities cache
[2021-11-28 18:09:40 DEBUG] [caching:24] Building activity cache...
[2021-11-28 18:09:40 DEBUG] [caching:35] Cached 0 activities
[2021-11-28 18:09:40 DEBUG] [configuration:54] Loading configuration...
[2021-11-28 18:09:40 DEBUG] [secret:78] Loading secrets...
[2021-11-28 18:09:40 DEBUG] [secret:104] Done loading secrets
[2021-11-28 18:09:40 INFO] [run:319] Running experiment: Disable chaos monkey
[2021-11-28 18:09:40 DEBUG] [__init__:49] Initializing controls
[2021-11-28 18:09:40 INFO] [run:336] Steady-state strategy: default
[2021-11-28 18:09:40 INFO] [run:340] Rollbacks strategy: default
[2021-11-28 18:09:40 INFO] [run:345] No steady state hypothesis defined. That's ok, just exploring.
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:09:40 INFO] [run:599] Playing your experiment's method now...
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:09:40 INFO] [activity:113] No declared activities, let's move on.
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'method'
[2021-11-28 18:09:40 INFO] [run:885] Let's rollback...
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:09:40 INFO] [rollback:30] Rollback: disable_chaosmonkey
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:09:40 INFO] [activity:188] Action: disable_chaosmonkey
[2021-11-28 18:09:40 DEBUG] [python:33] Activity 'disable_chaosmonkey' loaded from '/Users/maece/.venvs/chaostk/lib/python3.9/site-packages/chaosspring/actions.py'
[2021-11-28 18:09:40 DEBUG] [activity:205] => succeeded with '{"status":"Chaos Monkey is disabled","disabledAt":"2021-11-28T17:09:40.443253Z"}'
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'activity'
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'rollback'
[2021-11-28 18:09:40 INFO] [run:450] Experiment ended with status: completed
[2021-11-28 18:09:40 DEBUG] [__init__:389] No controls to apply on 'experiment'
[2021-11-28 18:09:40 DEBUG] [__init__:82] Cleaning up controls
[2021-11-28 18:09:40 DEBUG] [caching:42] Clearing activities cache

View File

@ -0,0 +1,24 @@
{
"title": "Disable chaos monkey",
"description": "Disable",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [],
"rollbacks": [
{
"name": "disable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "disable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
]
}

View File

@ -0,0 +1,54 @@
{
"title": "Testing exceptions",
"description": "Testing exceptions!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": true,
"exception": {
"type": "java.lang.RuntimeException",
"arguments": [
{
"className": "java.lang.String",
"value": "Exception assault has been carried out"
}
]
}
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,62 @@
{
"chaoslib-version": "1.23.0",
"platform": "macOS-12.0-arm64-arm-64bit",
"node": "Marcels-MBP-M1",
"experiment": {
"title": "Disable chaos monkey",
"description": "Disable",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [],
"rollbacks": [
{
"name": "disable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "disable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"dry": null
},
"start": "2021-11-28T17:09:40.224824",
"status": "completed",
"deviated": false,
"steady_states": {
"before": null,
"after": null,
"during": []
},
"run": [],
"rollbacks": [
{
"activity": {
"name": "disable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "disable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
"output": "{\"status\":\"Chaos Monkey is disabled\",\"disabledAt\":\"2021-11-28T17:09:40.443253Z\"}",
"status": "succeeded",
"start": "2021-11-28T17:09:40.226419",
"end": "2021-11-28T17:09:40.531586",
"duration": 0.305167
}
],
"end": "2021-11-28T17:09:40.531671",
"duration": 0.33724117279052734
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing kill & restart",
"description": "Testing behavoir when killing and restarting the application",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 5000,
"latencyActive": false,
"exceptionsActive": false,
"killApplicationActive": true,
"restartApplicationActive": true
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,45 @@
{
"title": "Testing latency",
"description": "Testing latency!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator",
"assaults_configuration": {
"level": 5,
"latencyRangeStart": 2000,
"latencyRangeEnd": 15000,
"latencyActive": true,
"exceptionsActive": false,
"killApplicationActive": false,
"restartApplicationActive": false
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

View File

@ -0,0 +1,49 @@
{
"title": "Testing memory",
"description": "Testing memory!",
"tags": [],
"steady-state-hypothesis": {
"title": "Hypothesis",
"probes": []
},
"method": [
{
"name": "enable_chaosmonkey",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator"
},
"func": "enable_chaosmonkey",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
},
{
"name": "configure_assaults",
"provider": {
"arguments": {
"base_url": "http://localhost:8081/actuator",
"assaults_configuration": {
"level": 5,
"latencyActive": false,
"killApplicationActive": false,
"restartApplicationActive": false,
"exceptionsActive": false,
"memoryActive": true,
"memoryMillisecondsHoldFilledMemory": 90000,
"memoryMillisecondsWaitNextIncrease": 100,
"memoryFillIncrementFraction": 0.9,
"memoryFillTargetFraction": 0.95,
"runtimeAssaultCronExpression": "*/1 * * * * ?"
}
},
"func": "change_assaults_configuration",
"module": "chaosspring.actions",
"type": "python"
},
"type": "action"
}
],
"rollbacks": []
}

13
app/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
# Dockerfile/Docker-Compose file based on an initial version authored by Alexander Lontke (ASSE, Fall Semester 2021)
FROM maven as build
COPY . /app
RUN mvn -f app/pom.xml --batch-mode --update-snapshots verify
FROM openjdk
COPY --from=build /app/target/app-0.1.0.jar ./app-0.1.0.jar
CMD java -jar app-0.1.0.jar

View File

@ -0,0 +1,23 @@
# 2. Seperate service for Executors and Executor Pool
Date: 2021-11-21
## Status
Accepted
## Context
The executor pool has a complete list of all executors and knows if they are available or not, executors can execute tasks that match their type. The executors can therefore be part of the executor pool service, or each executor is a standalone service, as well as the executor pool.
## Decision
We will use a separate microservice for each executor and one service for the executor pool.
Having the executor pool and the executors as separate services would increase fault tolerance. If the executor pool goes down, the executors would stay online and execute their tasks without being affected by the executor pools outage. Likewise, if an executor goes down it does not impact other executors or the executor pool.
Different executors can have different execution times and a different load. This means the executors scale differently. Thus, we need a separate service for each executor.
Executors of different kinds will also scale differently than the executor pool and new executors of new types might be added at some point, further increasing the need for separate services to guarantee scalability and evolvability.
New executors will be added/removed during runtime. Therefore, we need a high extensibility.
## Consequences
Executors will be added/removed quite frequently, making the deployment of the system easier and less risk-prone if each executor is a separate service, also separated from the executor pool, which just keeps track of the executors and their status. However, having these separate services, the complexity might increase, and the testability of the system will decrease.

View File

@ -1,21 +0,0 @@
# 2. Seperate service for Executors
Date: 2021-10-18
## Status
Accepted
## Context
The users need to be able to add new executors to the executor pool. The functionality of the executor is currently unknown.
## Decision
We will use a separate microservice for each executor.
New executors will be added/removed during runtime. Therefore, we need a high extensibility.
Different executors can have different execution times and a different load. This means the executors scale differently.
## Consequences
Having executors as its own service we can deploy new executors independently and easily add new executors during runtime and guarantee high scalability as well as evolvability.

View File

@ -1,21 +0,0 @@
# 3. Seperate service for assignment domain
Date: 2021-10-18
## Status
Accepted
## Context
The Assignment Service handles the assignment of a task to a corresponding and available executor. It keeps track of all the connections between tasks and executors.
## Decision
The assignment domain will be its own service.
The assignment service will be a central point in our application. It will have most of the business logic in it and will communicate with all the different services. Therefore, other services can be kind of “dumb” and only need to focus on their simple tasks.
The code of the assignment will change more often than the code of the other services, thus having the assignment service split from the other makes it more deployable.
## Consequences
Having this system as its own service we reduce the Fault tolerance because the assignment service can be the single point of failure. We can mitigate this risk by implementing (server) replication and/or having an event driven communication with persisting messages. Therefore, all other services can run independently, and the assignment service can recover from a crash.

View File

@ -0,0 +1,21 @@
# 3. Separate service for the Roster
Date: 2021-11-21
## Status
Accepted
## Context
The roster acts as an orchestrator for the system. It communicates directly with the task list, the executors, the executor pool, and the auction house. It handles the assignment of a task to a corresponding and available executor, keeps track of all the connections between tasks and executors, and communicates the status of tasks and executors to other services.
## Decision
The Roster domain will be its own service.
The Roster service will be a central point in our application. It will have most of the workflow logic in it and will communicate with all the different services. Therefore, other services can focus on their business logic and be largely ignorant of the overall workflow.
The code of the assignment will change more often than the code of the other services, thus having the assignment service split from the other makes it more deployable.
## Consequences
Having this system as its own service will reduce the fault tolerance because the assignment service can be the single point of failure. We can mitigate this risk by implementing (server) replication and/or having an event driven communication with persisting messages. Therefore, all other services can run independently, and the assignment service can recover from a crash. Additionally, we need to ensure a high level of interoperability, since the roster has to communicate with all other parts of the system.

View File

@ -1,21 +0,0 @@
# 4. Seperate service for executor pool
Date: 2021-10-18
## Status
Accepted
## Context
The Executor pool keeps track of the connected executors and their purpose and status.
## Decision
We will have a separate service for the executor pool.
There are no other domains which share the same or similar functionality.
The executor pool also scales differently than other services.
## Consequences
Having the executor pool as a separate service will help with the deployability of this service but will make the overall structure more complex and reduces testability.

View File

@ -0,0 +1,20 @@
# 4. Separate service for the Task List
Date: 2021-11-21
## Status
Accepted
## Context
Tasks are created in the task list, and the status of each task (created, assigned, executing, executed) is tracked in the task list as well. The task list mainly communicates with the roster so that tasks can get assigned and the roster will give the task list feedback about the tasks status.
## Decision
The task list will be its own service.
The task list needs to scale based on the number of active users and the intensity of their activity at any time while the scaling of other parts of the system can be constrained by other factors.
## Consequences
Although having the task list as its own service might slightly increase the complexity of the system and decrease the testability, it also makes the system easier to deploy and protective of its data. However, to ensure that this data is always available and does not get lost, the task list needs to be able to recover all its data (the entire history of all tasks) in case it goes down.

View File

@ -4,7 +4,7 @@ Date: 2021-10-18
## Status
Accepted
Superceded by [8. Switch to an event-driven microservices architecture](0008-switch-to-an-event-driven-microservices-architecture.md)
## Context

View File

@ -0,0 +1,22 @@
# 7. Seperate service for Auction House
Date: 2021-11-21
## Status
Accepted
## Context
The auction house is the service that can connect to other groups auction houses. If there is a task whose task type does not match that of our executors, the auction house can start an auction where other groups can bid on doing the task for us. Moreover, it can also bid on other groups auctions.
## Decision
The auction house will be its own service.
The auction house is the only part of our system that has external communication; therefore, it makes sense to have it as its own service, also to guarantee better deployability.
The auction house does not scale directly based on the number of tasks, but only the proportion which needs external executors. Moreover, there could be limits on the number of auctions that could be started. Therefore, the auction house scales differently to other services.
Moreover, having the auction house as its own service also improves the fault tolerance of our system.
## Consequences
Since the auction house will be a standalone service, we have to make sure that if it goes down, it can recover its data in some way (which auctions it has launched, which auctions it has placed bids on or even won, etc.). Even though the testability and latency of our system might worsen by having a separate service for the auction house, we can implement different kinds of communication for internal and external communication in a much easier way.

View File

@ -0,0 +1,26 @@
# 8. Switch to an event-driven microservices architecture
Date: 2021-11-21
## Status
Proposed
Supercedes [5. Event driven communication](0005-event-driven-communication.md)
## Context
Our Tapas App is currently implemented based on a microservice architecture, where the services communicate synchronously via request-response. Each service encapsulates a different bounded context with different functional and non-functional requirements. Internal communication could also be done using asynchronous or event-driven communication.
## Decision
Pros:
Scalability: Different services within the Tapas app are not always able to scale at the same rate. For example, we could have thousands of users adding printing tasks at the same time, but maybe we only have one printer. In this scenario we might want to scale the task-list service up to handle the creation load, but scaling up the printing executor operates on a different time-scale (i.e. adding a printer takes time). Moreover, we could have a lot of new tasks coming in, most of which can be executed internally. In this case we want to be able to scale up the task list but might not need to scale up the auction house. Event-driven communication would decrease the coupling of services. Consequently, the scalability of individual services would be enhanced as they no longer depend on the scalability of other services. This improves the apps overall scalability. Since scalability is one of the systems top 3 -ility, this seems quite important.
Fault tolerance: Another of the systems top 3 -ilities is fault tolerance. We could have highly unstable IoT executors that fail often. This should not disrupt the systems overall operation. The decoupling facilitated by event-driven, asynchronous, communication ensures that when individual services go down, the impact of other services is limited and once they go back up then can recover the systems state from persisted messages.
Cons:
Error handling, workflow control, and event timing:
The aforementioned topics outline the drawbacks of event- driven architecture. These drawbacks can be mitigated by using an orchestrator (like we currently do with the roster) to orchestrate assignment of tasks, auctioning off tasks and error handling when executors fail. More research needed.
## Consequences
Consequences to be determined but would relate to the three concepts mentioned as cons.

View File

@ -0,0 +1,19 @@
# 9. common library for shared code
Date: 2021-11-21
## Status
Accepted
## Context
The numerous services that make up the Tapas app all have common, non-domain specific, functionality that can be shared via a common library, or be replicated in each service.
## Decision
Use a common code library for shared code which does not change frequently, but if it would be changed, would need to be changed everywhere.
## Consequences
Changes in the common code will most likely require multiple services to be redeployed. However, those services would most likely have to have been changed individually and redepolyed anyways. Another consequence is that versioning becomes more complicated.

View File

@ -0,0 +1,20 @@
# 10. executor base library
Date: 2021-11-21
## Status
Accepted
## Context
Executors all use the same logic to communicate with other services. This means that their code base is near identical except for the code that implements their specific task execution. The code that implements the executor's shared logic can either be implemented by a shared library, or replicated across all executors.
## Decision
Since all executors use the same logic to communicate with other services, any change to this logic would have to be made for every executor. We will therefore use a shared library for executors, called executor-base. The library includes all the shared logic which every executor needs.
Having this shared logic in a separate library makes it easy to change the common logic at one place. The code sharing happens at compile time, which reduces the chance of runtime errors, compared to other code sharing approaches. If other people need to create executors, they can just reference the executor-base library and implement the actual execution part. Therefore they dont need to worry about the the connection implementations to the Tapas system.
## Consequences
It becomes easier to change the way that the executors communicate with the rest of the system. Moreover, changes are less risky as they only need to be implemented once. It also becomes easier for other teams within the organisation to create executors as they can use the executor-base to implement the shared logic. However, using a shared library will increase the complexity of the executors. Also there needs to be a clear way to use proper versioning. Lastly, by using this library we might be making assumptions for future executors that might not hold. For example, if we want to create more lightweight executors for IoT devices we might need to create a separate base package (if the current one becomes too fat), so that the executors can stay lightweight and dont implement unused code.

View File

@ -0,0 +1,19 @@
# 11. seperation of common and executor-base library
Date: 2021-11-21
## Status
Accepted
## Context
We have two code sharing libraries, the executor-base and the common library. The executor-base implements shared logic that all executors need, but other services don't. The common library has much more wide reaching implementations, such as the implementation of the SelfValidating class. These could form a single common library, or two seperate common libraries.
## Decision
There will be a separate library for common and executor-base. The libraries share different type of code, and have different reasons to change. It would not make sense to have the shared code from executors in every other service which needs access to other shared code. Services that use the code in the common library should not need to be dependent in any way on the executor-base.
## Consequences
Changes impact fewer services. However, this decision will increase the number of service dependencies and therefore increase complexity in managing those dependencies.

View File

@ -1,5 +1,20 @@
version: "3.6"
services:
tapas-db:
image: mongo
restart: unless-stopped
container_name: tapas_mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- "27017:27017"
command: mongod --quiet --logpath /dev/null
hivemq:
image: hivemq/hivemq4
restart: unless-stopped
ports:
- "1883:1883"
tapas-tasks:
container_name: tapas-tasks
build:
@ -9,54 +24,63 @@ services:
ports:
- "8081:8081"
- "5005:5005"
depends_on:
- tapas-db
# - hivemq
volumes:
- ./tapas-tasks/src:/opt/app/src
- ./tapas-tasks/target:/opt/app/target
assignment:
container_name: assignment
roster:
container_name: roster
build:
context: "./assignment"
dockerfile: "Dockerfile"
context: "."
dockerfile: "./roster/Dockerfile"
target: development
depends_on:
- tapas-db
# - hivemq
ports:
- "8082:8082"
- "5006:5005"
volumes:
- ./assignment/src:/opt/app/src
- ./assignment/target:/opt/app/target
- ./roster/src:/opt/app/src
- ./roster/target:/opt/app/target
executor-pool:
container_name: executor-pool
build:
context: "./executor-pool"
dockerfile: "Dockerfile"
target: development
depends_on:
- tapas-db
# - hivemq
ports:
- "8083:8083"
- "5007:5005"
volumes:
- ./executor-pool/src:/opt/app/src
- ./executor-pool/target:/opt/app/target
executor1:
container_name: executor1
executor-computation:
container_name: executor-computation
build:
context: "./executor1"
dockerfile: "Dockerfile"
target: development
ports:
- "8084:8084"
- "5008:5005"
volumes:
- ./executor1/src:/opt/app/src
- ./executor1/target:/opt/app/target
executor2:
container_name: executor2
build:
context: "./executor2"
dockerfile: "Dockerfile"
context: "."
dockerfile: "./executor-computation/Dockerfile"
target: development
ports:
- "8085:8085"
- "5008:5005"
volumes:
- ./executor-computation/src:/opt/app/src
- ./executor-computation/target:/opt/app/target
executor-robot:
container_name: executor-robot
build:
context: "."
dockerfile: "./executor-robot/Dockerfile"
target: development
ports:
- "8084:8084"
- "5009:5005"
volumes:
- ./executor2/src:/opt/app/src
- ./executor2/target:/opt/app/target
- ./executor-robot/src:/opt/app/src
- ./executor-robot/target:/opt/app/target

View File

@ -66,6 +66,21 @@
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>chaos-monkey-spring-boot</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -15,8 +15,8 @@ import ch.unisg.executorbase.executor.domain.ExecutionFinishedEvent;
public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort {
String server = System.getenv("roster_uri") == null ?
"http://localhost:8082" : System.getenv("roster_uri");
String server = System.getenv("ROSTER_URI") == null ?
"http://localhost:8082" : System.getenv("ROSTER_URI");
Logger logger = Logger.getLogger(ExecutionFinishedEventAdapter.class.getName());

View File

@ -23,8 +23,8 @@ import org.json.JSONObject;
@Primary
public class GetAssignmentAdapter implements GetAssignmentPort {
String server = System.getenv("roster_uri") == null ?
"http://localhost:8082" : System.getenv("roster_uri");
String server = System.getenv("ROSTER_URI") == null ?
"http://localhost:8082" : System.getenv("ROSTER_URI");
Logger logger = Logger.getLogger(GetAssignmentAdapter.class.getName());

View File

@ -22,8 +22,8 @@ import ch.unisg.executorbase.executor.domain.ExecutorType;
@Primary
public class NotifyExecutorPoolAdapter implements NotifyExecutorPoolPort {
String server = System.getenv("executor_pool_uri") == null ?
"http://localhost:8083" : System.getenv("executor_pool_uri");
String server = System.getenv("EXECUTOR_POOL_URI") == null ?
"http://localhost:8083" : System.getenv("EXECUTOR_POOL_URI");
Logger logger = Logger.getLogger(NotifyExecutorPoolAdapter.class.getName());

View File

@ -1,3 +1,15 @@
server.port=8081
roster.url=http://127.0.0.1:8082
executor.pool.url=http://127.0.0.1:8083
spring.profiles.active=chaos-monkey
chaos.monkey.enabled=false
management.endpoint.chaosmonkey.enabled=true
management.endpoint.chaosmonkeyjmx.enabled=true
# include specific endpoints
management.endpoints.web.exposure.include=health,info,chaosmonkey
chaos.monkey.watcher.controller=true
chaos.monkey.watcher.restController=true
chaos.monkey.watcher.service=true
chaos.monkey.watcher.repository=true
chaos.monkey.watcher.component=true

View File

@ -2,17 +2,30 @@ FROM openjdk:11 AS development
WORKDIR /opt/app
# ENV SPRING_DATASOURCE_URL=jdbc:mysql://backend-db:3306/db
ENV EXECUTOR_POOL_URI=http://executor-pool:8083
ENV ROSTER_URI=http://roster:8082
COPY .mvn/ .mvn
COPY mvnw pom.xml mvnw.cmd ./
COPY executor-computation/.mvn ./.mvn
COPY executor-computation/mvnw executor-computation/pom.xml executor-computation/mvnw.cmd ./
RUN apt-get clean && apt-get update && apt-get install dos2unix
RUN dos2unix mvnw
RUN ./mvnw dependency:go-offline
COPY common/pom.xml /opt/app/common/
COPY common/src /opt/app/common/src
COPY common/*target /opt/app/common/target
COPY src /opt/app/src
COPY *target /opt/app/target
COPY executor-base/pom.xml /opt/app/executor-base/
COPY executor-base/src /opt/app/executor-base/src
COPY executor-base/*target /opt/app/executor-base/target
COPY executor-computation/src /opt/app/src
COPY executor-computation/*target /opt/app/target
RUN ./mvnw -f /opt/app/common/pom.xml clean install
RUN ./mvnw -f /opt/app/executor-base/pom.xml clean install
RUN ./mvnw clean install
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.jvmArguments=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005\"", "-Dspring.devtools.restart.enabled=true"]

View File

@ -52,6 +52,21 @@
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>chaos-monkey-spring-boot</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,5 +1,7 @@
package ch.unisg.executorcomputation;
import java.util.concurrent.TimeUnit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -9,6 +11,14 @@ import ch.unisg.executorcomputation.executor.domain.Executor;
public class ExecutorcomputationApplication {
public static void main(String[] args) {
try {
TimeUnit.SECONDS.sleep(40);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SpringApplication.run(ExecutorcomputationApplication.class, args);
Executor.getExecutor();
}

View File

@ -34,11 +34,11 @@ public class Executor extends ExecutorBase {
double result = Double.NaN;
// try {
// TimeUnit.SECONDS.sleep(5);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (operator.equalsIgnoreCase("+")) {
String[] parts = inputData.split("\\+");

View File

@ -1 +1,14 @@
server.port=8085
spring.profiles.active=chaos-monkey
chaos.monkey.enabled=false
management.endpoint.chaosmonkey.enabled=true
management.endpoint.chaosmonkeyjmx.enabled=true
# include specific endpoints
management.endpoints.web.exposure.include=health,info,chaosmonkey
chaos.monkey.watcher.controller=true
chaos.monkey.watcher.restController=true
chaos.monkey.watcher.service=true
chaos.monkey.watcher.repository=true
chaos.monkey.watcher.component=true

View File

@ -2,7 +2,9 @@ FROM openjdk:11 AS development
WORKDIR /opt/app
# ENV SPRING_DATASOURCE_URL=jdbc:mysql://backend-db:3306/db
ENV ROSTER_URI=http://roster:8082
ENV SPRING_DATA_MONGODB_URI=mongodb://root:password@tapas-db:27017
ENV MQTT_BROKER_URI=tcp://hivemq:1883
COPY .mvn/ .mvn
COPY mvnw pom.xml mvnw.cmd ./
@ -10,9 +12,9 @@ COPY mvnw pom.xml mvnw.cmd ./
RUN apt-get clean && apt-get update && apt-get install dos2unix
RUN dos2unix mvnw
RUN ./mvnw dependency:go-offline
COPY src /opt/app/src
COPY *target /opt/app/target
RUN ./mvnw clean install
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.jvmArguments=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005\"", "-Dspring.devtools.restart.enabled=true"]

View File

@ -17,6 +17,7 @@
<java.version>11</java.version>
<sonar.organization>scs-asse-fs21-group1</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<skipTests>true</skipTests>
</properties>
<dependencies>
<dependency>
@ -68,6 +69,21 @@
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit4</artifactId>
<version>0.22.0</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -1,13 +1,41 @@
package ch.unisg.executorpool;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import ch.unisg.executorpool.adapter.out.persistence.mongodb.ExecutorRepository;
import ch.unisg.executorpool.application.port.out.LoadExecutorPort;
import ch.unisg.executorpool.domain.ExecutorPool;
@SpringBootApplication
@EnableMongoRepositories(basePackageClasses = ExecutorRepository.class)
public class ExecutorPoolApplication {
@Autowired
private LoadExecutorPort loadExecutorPort;
public static void main(String[] args) {
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SpringApplication.run(ExecutorPoolApplication.class, args);
}
@PostConstruct
public void initializeExecutorPool() {
// Is this allowed in main or does it need to be in a service?
ExecutorPool.getExecutorPool().initExecutorPool(loadExecutorPort.loadAllExecutors());
}
}

View File

@ -0,0 +1,31 @@
package ch.unisg.executorpool.adapter.out.persistence.mongodb;
import java.net.URI;
import java.net.URISyntaxException;
import org.springframework.stereotype.Component;
import ch.unisg.executorpool.domain.ExecutorClass;
@Component
public class ExecutorMapper {
ExecutorClass mapToDomainEntity(MongoExecutorDocument executorClass) {
try {
return new ExecutorClass(
new ExecutorClass.ExecutorUri(new URI(executorClass.executorUri)),
new ExecutorClass.ExecutorTaskType(executorClass.executorTaskType)
);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
MongoExecutorDocument mapToMongoDocument(ExecutorClass executorClass) {
return new MongoExecutorDocument(executorClass.getExecutorUri().getValue().toString(),
executorClass.getExecutorTaskType().getValue()
);
}
}

View File

@ -0,0 +1,51 @@
package ch.unisg.executorpool.adapter.out.persistence.mongodb;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.unisg.executorpool.application.port.out.AddExecutorPort;
import ch.unisg.executorpool.application.port.out.LoadExecutorPort;
import ch.unisg.executorpool.application.port.out.RemoveExecutorPort;
import ch.unisg.executorpool.domain.ExecutorClass;
import lombok.RequiredArgsConstructor;
@Component
@RequiredArgsConstructor
public class ExecutorPersistenceAdapter implements AddExecutorPort, RemoveExecutorPort, LoadExecutorPort {
@Autowired
private final ExecutorRepository executorRepository;
private final ExecutorMapper executorMapper;
@Override
public void addExecutor(ExecutorClass executorClass) {
MongoExecutorDocument mongoExecutorDocument = executorMapper.mapToMongoDocument(executorClass);
executorRepository.save(mongoExecutorDocument);
}
@Override
public void removeExecutor(ExecutorClass executorClass) {
executorRepository.deleteByExecutorUri(executorClass.getExecutorUri().getValue().toString());
}
@Override
public ExecutorClass loadExecutor(ExecutorClass.ExecutorUri executorUri, ExecutorClass.ExecutorTaskType executorTaskType) {
MongoExecutorDocument mongoExecutorDocument = executorRepository.findByExecutorUri(executorUri.getValue().toString(), executorTaskType.getValue());
ExecutorClass executorClass = executorMapper.mapToDomainEntity(mongoExecutorDocument);
return executorClass;
}
@Override
public List<ExecutorClass> loadAllExecutors() {
List<ExecutorClass> executorClasses = new ArrayList<>();
for (MongoExecutorDocument exe : executorRepository.findAll()) {
executorClasses.add(executorMapper.mapToDomainEntity(exe));
}
return executorClasses;
}
}

View File

@ -0,0 +1,17 @@
package ch.unisg.executorpool.adapter.out.persistence.mongodb;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ExecutorRepository extends MongoRepository<MongoExecutorDocument, String> {
public MongoExecutorDocument findByExecutorUri(String executorUri, String executorTaskType);
public List<MongoExecutorDocument> findByExecutorTaskType(String executorTaskType);
public void deleteByExecutorUri(String executorUri);
}

View File

@ -0,0 +1,19 @@
package ch.unisg.executorpool.adapter.out.persistence.mongodb;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.Data;
@Data
@Document(collection = "executors")
public class MongoExecutorDocument {
public String executorUri;
public String executorTaskType;
public MongoExecutorDocument(String executorUri, String executorTaskType) {
this.executorUri = executorUri;
this.executorTaskType = executorTaskType;
}
}

View File

@ -0,0 +1,9 @@
package ch.unisg.executorpool.application.port.out;
import ch.unisg.executorpool.domain.ExecutorClass;
public interface AddExecutorPort {
void addExecutor(ExecutorClass executorClass);
}

View File

@ -1,7 +1,6 @@
package ch.unisg.executorpool.application.port.out;
import ch.unisg.executorpool.domain.ExecutorAddedEvent;
import org.eclipse.paho.client.mqttv3.MqttException;
public interface ExecutorAddedEventPort {
void publishExecutorAddedEvent(ExecutorAddedEvent event);

View File

@ -0,0 +1,13 @@
package ch.unisg.executorpool.application.port.out;
import java.util.List;
import ch.unisg.executorpool.domain.ExecutorClass;
public interface LoadExecutorPort {
ExecutorClass loadExecutor(ExecutorClass.ExecutorUri executorUri, ExecutorClass.ExecutorTaskType executorTaskType);
List<ExecutorClass> loadAllExecutors();
}

View File

@ -0,0 +1,9 @@
package ch.unisg.executorpool.application.port.out;
import ch.unisg.executorpool.domain.ExecutorClass;
public interface RemoveExecutorPort {
void removeExecutor(ExecutorClass executorClass);
}

View File

@ -2,11 +2,11 @@ package ch.unisg.executorpool.application.service;
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolUseCase;
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolCommand;
import ch.unisg.executorpool.application.port.out.AddExecutorPort;
import ch.unisg.executorpool.application.port.out.ExecutorAddedEventPort;
import ch.unisg.executorpool.domain.ExecutorAddedEvent;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorPool;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
@ -16,9 +16,11 @@ import javax.transaction.Transactional;
public class AddNewExecutorToExecutorPoolService implements AddNewExecutorToExecutorPoolUseCase {
private final ExecutorAddedEventPort executorAddedEventPort;
private final AddExecutorPort addExecutorToRepositoryPort;
public AddNewExecutorToExecutorPoolService(ExecutorAddedEventPort executorAddedEventPort){
public AddNewExecutorToExecutorPoolService(ExecutorAddedEventPort executorAddedEventPort, AddExecutorPort addExecutorToRepositoryPort){
this.executorAddedEventPort = executorAddedEventPort;
this.addExecutorToRepositoryPort = addExecutorToRepositoryPort;
}
@Override
@ -29,6 +31,8 @@ public class AddNewExecutorToExecutorPoolService implements AddNewExecutorToExec
var executorAddedEvent = new ExecutorAddedEvent(newExecutor);
executorAddedEventPort.publishExecutorAddedEvent(executorAddedEvent);
addExecutorToRepositoryPort.addExecutor(newExecutor);
return newExecutor;
}
}

View File

@ -3,10 +3,10 @@ package ch.unisg.executorpool.application.service;
import ch.unisg.executorpool.application.port.in.RemoveExecutorFromExecutorPoolCommand;
import ch.unisg.executorpool.application.port.in.RemoveExecutorFromExecutorPoolUseCase;
import ch.unisg.executorpool.application.port.out.ExecutorRemovedEventPort;
import ch.unisg.executorpool.application.port.out.RemoveExecutorPort;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorPool;
import ch.unisg.executorpool.domain.ExecutorRemovedEvent;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
@ -17,9 +17,11 @@ import java.util.Optional;
public class RemoveExecutorFromExecutorPoolService implements RemoveExecutorFromExecutorPoolUseCase {
private final ExecutorRemovedEventPort executorRemovedEventPort;
private final RemoveExecutorPort removeExecutorFromRepositoryPort;
public RemoveExecutorFromExecutorPoolService(ExecutorRemovedEventPort executorRemovedEventPort){
public RemoveExecutorFromExecutorPoolService(ExecutorRemovedEventPort executorRemovedEventPort, RemoveExecutorPort removeExecutorFromRepositoryPort){
this.executorRemovedEventPort = executorRemovedEventPort;
this.removeExecutorFromRepositoryPort = removeExecutorFromRepositoryPort;
}
@Override
@ -29,6 +31,7 @@ public class RemoveExecutorFromExecutorPoolService implements RemoveExecutorFrom
if(removedExecutor.isPresent()){
var executorRemovedEvent = new ExecutorRemovedEvent(removedExecutor.get());
removeExecutorFromRepositoryPort.removeExecutor(removedExecutor.get());
executorRemovedEventPort.publishExecutorRemovedEvent(executorRemovedEvent);
}

View File

@ -18,7 +18,7 @@ public class ExecutorClass {
this.executorTaskType = executorTaskType;
}
protected static ExecutorClass createExecutorClass(ExecutorUri executorUri, ExecutorTaskType executorTaskType){
public static ExecutorClass createExecutorClass(ExecutorUri executorUri, ExecutorTaskType executorTaskType){
System.out.println("New Executor: " + executorUri.value.toString() + " " + executorTaskType.getValue());
return new ExecutorClass(executorUri, executorTaskType);
}

View File

@ -67,6 +67,12 @@ public class ExecutorPool {
return Optional.empty();
}
public void initExecutorPool(List<ExecutorClass> executors){
for (ExecutorClass executor : executors) {
listOfExecutors.value.add(executor);
}
}
@Value
public static class ListOfExecutors {
private List<ExecutorClass> value;

View File

@ -1,6 +1,5 @@
package ch.unisg.executorpool.domain;
import ch.unisg.executorpool.domain.ExecutorClass;
import lombok.Getter;
public class ExecutorRemovedEvent {

View File

@ -1,3 +1,6 @@
server.port=8083
mqtt.broker.uri=tcp://localhost:1883
spring.data.mongodb.uri=mongodb://root:password@localhost:27017
spring.data.mongodb.database=tapas-executors

View File

@ -0,0 +1,65 @@
package ch.unisg.executorpool;
import static org.mockito.Mockito.times;
import java.net.URI;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import static org.mockito.BDDMockito.*;
import static org.assertj.core.api.Assertions.*;
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolCommand;
import ch.unisg.executorpool.application.port.out.AddExecutorPort;
import ch.unisg.executorpool.application.port.out.ExecutorAddedEventPort;
import ch.unisg.executorpool.application.service.AddNewExecutorToExecutorPoolService;
import ch.unisg.executorpool.domain.ExecutorAddedEvent;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorPool;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
public class AddNewExecutorToExecutorPoolServiceTest {
private final AddExecutorPort addExecutorPort = Mockito.mock(AddExecutorPort.class);
private final ExecutorAddedEventPort newExecutorAddedEventPort = Mockito.mock(ExecutorAddedEventPort.class);
private final AddNewExecutorToExecutorPoolService addNewExecutorToExecutorPoolService = new AddNewExecutorToExecutorPoolService(
newExecutorAddedEventPort, addExecutorPort);
@Test
void addingSucceeds() {
ExecutorClass newExecutor = givenAnExecutorWithTypeAndUri(new ExecutorClass.ExecutorTaskType("test-type"),
new ExecutorClass.ExecutorUri(URI.create("example.org")));
ExecutorPool executorPool = givenAnEmptyExecutorPool(ExecutorPool.getExecutorPool());
AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(
newExecutor.getExecutorUri(), newExecutor.getExecutorTaskType());
ExecutorClass addedExecutor = addNewExecutorToExecutorPoolService.addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand);
assertThat(addedExecutor).isNotNull();
assertThat(executorPool.getListOfExecutors().getValue()).hasSize(1);
then(newExecutorAddedEventPort).should(times(1)).publishExecutorAddedEvent(any(ExecutorAddedEvent.class));
}
private ExecutorPool givenAnEmptyExecutorPool(ExecutorPool executorPool) {
executorPool.getListOfExecutors().getValue().clear();
return executorPool;
}
private ExecutorClass givenAnExecutorWithTypeAndUri(ExecutorClass.ExecutorTaskType executorTaskType,
ExecutorUri executorUri) {
ExecutorClass executor = Mockito.mock(ExecutorClass.class);
given(executor.getExecutorTaskType()).willReturn(executorTaskType);
given(executor.getExecutorUri()).willReturn(executorUri);
return executor;
}
}

View File

@ -0,0 +1,70 @@
package ch.unisg.executorpool;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import static org.assertj.core.api.BDDAssertions.*;
import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation;
import ch.unisg.executorpool.application.port.out.AddExecutorPort;
import ch.unisg.executorpool.domain.ExecutorPool;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AddNewExecutorToExecutorPoolSystemTest {
@Autowired
private TestRestTemplate restTemplate;
@Autowired
private AddExecutorPort addExecutorPort;
@Test
void AddNewExecutorToExecutorPool() throws JSONException {
ExecutorTaskType executorTaskType = new ExecutorTaskType("system-integration-test-type");
ExecutorUri executorUri = new ExecutorUri(java.net.URI.create("example.org"));
ResponseEntity response = whenAddNewExecutorToEmptyPool(executorTaskType, executorUri);
JSONObject responseJson = new JSONObject(response.getBody().toString());
String respExecutorUri = responseJson.getString("executorUri");
String respExecutorTaskType = responseJson.getString("executorTaskType");
then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
then(respExecutorUri).isEqualTo(executorUri.getValue().toString());
then(respExecutorTaskType).isEqualTo(executorTaskType.getValue());
then(ExecutorPool.getExecutorPool().getListOfExecutors().getValue()).hasSize(1);
}
private ResponseEntity whenAddNewExecutorToEmptyPool(ExecutorTaskType executorTaskType,
ExecutorUri executorUri) throws JSONException {
ExecutorPool.getExecutorPool().getListOfExecutors().getValue().clear();
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE);
String jsonPayLoad = new JSONObject().put("executorTaskType", executorTaskType.getValue())
.put("executorUri", executorUri.getValue()).toString();
HttpEntity<String> request = new HttpEntity<>(jsonPayLoad,headers);
return restTemplate.exchange("/executor-pool/AddExecutor", HttpMethod.POST, request, Object.class);
}
}

View File

@ -0,0 +1,75 @@
package ch.unisg.executorpool;
import java.util.Optional;
import ch.unisg.executorpool.application.port.out.LoadExecutorPort;
import org.bson.json.JsonObject;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import static org.mockito.BDDMockito.eq;
import static org.mockito.BDDMockito.then;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation;
import ch.unisg.executorpool.adapter.in.web.AddNewExecutorToExecutorPoolWebController;
import ch.unisg.executorpool.adapter.out.persistence.mongodb.ExecutorRepository;
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolCommand;
import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolUseCase;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
import org.json.JSONObject;
@WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class)
public class AddNewExecutorToExecutorPoolWebControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private AddNewExecutorToExecutorPoolUseCase addNewExecutorToExecutorPoolUseCase;
@MockBean
ExecutorRepository executorRepository;
@MockBean
LoadExecutorPort loadExecutorPort;
@Test
void testAddNewExecutorToExecutorPool() throws Exception {
String executorTaskType = "test-request-type";
String executorUri = "example.org";
String jsonPayLoad = new JSONObject().put("executorTaskType", executorTaskType).put("executorUri", executorUri).toString();
ExecutorClass executorStub = ExecutorClass.createExecutorClass(new ExecutorUri(java.net.URI.create(executorUri)),
new ExecutorClass.ExecutorTaskType(executorTaskType));
AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(
new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType));
Mockito.when(addNewExecutorToExecutorPoolUseCase
.addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand))
.thenReturn(executorStub);
mockMvc.perform(post("/executor-pool/AddExecutor")
.contentType(ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE)
.content(jsonPayLoad))
.andExpect(status().isCreated());
then(addNewExecutorToExecutorPoolUseCase).should()
.addNewExecutorToExecutorPool(eq(new AddNewExecutorToExecutorPoolCommand(
new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType))));
}
}

View File

@ -0,0 +1,20 @@
package ch.unisg.executorpool;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import org.junit.jupiter.api.Test;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
public class DependencyRuleTests {
@Test
void testPackageDependencies() {
noClasses()
.that()
.resideInAPackage("ch.unisg.executorpool.domain..")
.should()
.dependOnClassesThat()
.resideInAnyPackage("ch.unisg.executorpool.application..")
.check(new ClassFileImporter()
.importPackages("ch.unisg.executorpool.."));
}
}

View File

@ -1,13 +0,0 @@
package ch.unisg.executorpool;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ExecutorPoolApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -0,0 +1,59 @@
package ch.unisg.executorpool;
import java.net.URI;
import java.util.Optional;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.*;
import ch.unisg.executorpool.domain.ExecutorClass;
import ch.unisg.executorpool.domain.ExecutorPool;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri;
import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType;
public class ExecutorPoolTest {
private static final URI URI = null;
@Test
void addNewExecutorToExecutorPoolSuccess() {
ExecutorPool executorPool = ExecutorPool.getExecutorPool();
executorPool.getListOfExecutors().getValue().clear();
ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) ,
new ExecutorTaskType("test-type"));
assertThat(newExecutor.getExecutorTaskType().getValue()).isEqualTo("test-type");
assertThat(executorPool.getListOfExecutors().getValue()).hasSize(1);
assertThat(executorPool.getListOfExecutors().getValue().get(0)).isEqualTo(newExecutor);
}
@Test
void retrieveExecutorSuccess() {
ExecutorPool executorPool = ExecutorPool.getExecutorPool();
executorPool.getListOfExecutors().getValue().clear();
ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type"));
var retrievedExecutors = executorPool.getAllExecutorsByType(newExecutor.getExecutorTaskType());
assertThat(retrievedExecutors.size()).isEqualTo(1);
assertThat(retrievedExecutors.get(0)).isEqualTo(newExecutor);
}
@Test
void retrieveExecutorFailure() {
ExecutorPool executorPool = ExecutorPool.getExecutorPool();
executorPool.getListOfExecutors().getValue().clear();
executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type"));
var fakeType = new ExecutorTaskType("fake-type");
var retrievedExecutor = executorPool.getAllExecutorsByType(fakeType);
assertThat(retrievedExecutor.size()).isEqualTo(0);
}
}

View File

@ -2,17 +2,30 @@ FROM openjdk:11 AS development
WORKDIR /opt/app
# ENV SPRING_DATASOURCE_URL=jdbc:mysql://backend-db:3306/db
ENV EXECUTOR_POOL_URI=http://executor-pool:8083
ENV ROSTER_URI=http://roster:8082
COPY .mvn/ .mvn
COPY mvnw pom.xml mvnw.cmd ./
COPY executor-computation/.mvn ./.mvn
COPY executor-computation/mvnw executor-computation/pom.xml executor-computation/mvnw.cmd ./
RUN apt-get clean && apt-get update && apt-get install dos2unix
RUN dos2unix mvnw
RUN ./mvnw dependency:go-offline
COPY common/pom.xml /opt/app/common/
COPY common/src /opt/app/common/src
COPY common/*target /opt/app/common/target
COPY src /opt/app/src
COPY *target /opt/app/target
COPY executor-base/pom.xml /opt/app/executor-base/
COPY executor-base/src /opt/app/executor-base/src
COPY executor-base/*target /opt/app/executor-base/target
COPY executor-computation/src /opt/app/src
COPY executor-computation/*target /opt/app/target
RUN ./mvnw -f /opt/app/common/pom.xml clean install
RUN ./mvnw -f /opt/app/executor-base/pom.xml clean install
RUN ./mvnw clean install
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.jvmArguments=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005\"", "-Dspring.devtools.restart.enabled=true"]

View File

@ -1,5 +1,7 @@
package ch.unisg.executorrobot;
import java.util.concurrent.TimeUnit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -9,6 +11,14 @@ import ch.unisg.executorrobot.executor.domain.Executor;
public class ExecutorrobotApplication {
public static void main(String[] args) {
try {
TimeUnit.SECONDS.sleep(40);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SpringApplication.run(ExecutorrobotApplication.class, args);
Executor.getExecutor();
}

View File

@ -2,17 +2,30 @@ FROM openjdk:11 AS development
WORKDIR /opt/app
# ENV SPRING_DATASOURCE_URL=jdbc:mysql://backend-db:3306/db
ENV TASK_LIST_URI=jhttp://tapas-tasks:8081
ENV EXECUTOR_ROBOT_URI=http://executor-robot:8084
ENV EXECUTOR_COMPUTATION_URI=http://executor-computation:8085
ENV MQTT_BROKER_URI=tcp://hivemq:1883
ENV SPRING_DATA_MONGODB_URI=mongodb://root:password@tapas-db:27017
COPY .mvn/ .mvn
COPY mvnw pom.xml mvnw.cmd ./
COPY roster/.mvn ./.mvn
COPY roster/mvnw roster/pom.xml roster/mvnw.cmd ./
RUN apt-get clean && apt-get update && apt-get install dos2unix
RUN dos2unix mvnw
RUN ./mvnw dependency:go-offline
COPY common/pom.xml /opt/app/common/
COPY common/src /opt/app/common/src
COPY common/*target /opt/app/common/target
COPY src /opt/app/src
COPY *target /opt/app/target
COPY roster/src /opt/app/src
COPY roster/*target /opt/app/target
RUN ./mvnw -f /opt/app/common/pom.xml clean install
RUN ./mvnw clean install
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.jvmArguments=\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005\"", "-Dspring.devtools.restart.enabled=true"]

View File

@ -17,6 +17,7 @@
<java.version>11</java.version>
<sonar.organization>scs-asse-fs21-group1</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<skipTests>true</skipTests>
</properties>
<dependencies>
<dependency>
@ -73,9 +74,24 @@
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit4</artifactId>
<version>0.22.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>

View File

@ -1,8 +1,13 @@
package ch.unisg.roster;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import ch.unisg.roster.roster.adapter.out.persistence.mongodb.RosterRepository;
import ch.unisg.roster.roster.application.port.in.LoadRosterItemPort;
import ch.unisg.roster.roster.domain.Roster;
import ch.unisg.roster.roster.domain.RosterItem;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -11,19 +16,24 @@ import org.springframework.core.env.ConfigurableEnvironment;
import ch.unisg.roster.roster.adapter.common.clients.TapasMqttClient;
import ch.unisg.roster.roster.adapter.in.messaging.mqtt.ExecutorEventMqttListener;
import ch.unisg.roster.roster.adapter.in.messaging.mqtt.ExecutorEventsMqttDispatcher;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication
@EnableMongoRepositories(basePackageClasses = RosterRepository.class)
public class RosterApplication {
static Logger logger = Logger.getLogger(RosterApplication.class.getName());
private static ConfigurableEnvironment ENVIRONMENT;
private static LoadRosterItemPort loadRosterItemPort;
public static void main(String[] args) {
SpringApplication rosterApp = new SpringApplication(RosterApplication.class);
ENVIRONMENT = rosterApp.run(args).getEnvironment();
bootstrapMarketplaceWithMqtt();
initialiseRoster();
}
/**
@ -42,4 +52,9 @@ public class RosterApplication {
}
}
private static void initialiseRoster(){
List<RosterItem> rosterItemList = loadRosterItemPort.loadAllRosterItems();
Roster.getInstance().initialiseRoster(rosterItemList);
}
}

View File

@ -1,32 +0,0 @@
package ch.unisg.roster.roster.adapter.in.web;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskUseCase;
import ch.unisg.roster.roster.domain.ExecutorInfo;
import ch.unisg.roster.roster.domain.Task;
@RestController
public class ApplyForTaskController {
private final ApplyForTaskUseCase applyForTaskUseCase;
public ApplyForTaskController(ApplyForTaskUseCase applyForTaskUseCase) {
this.applyForTaskUseCase = applyForTaskUseCase;
}
/**
* Checks if task is available for the requesting executor.
* @return a task or null if no task found
**/
@PostMapping(path = "/task/apply", consumes = {"application/json"})
public Task applyForTask(@RequestBody ExecutorInfo executorInfo) {
ApplyForTaskCommand command = new ApplyForTaskCommand(executorInfo.getExecutorType(),
executorInfo.getExecutorURI());
return applyForTaskUseCase.applyForTask(command);
}
}

View File

@ -0,0 +1,65 @@
package ch.unisg.roster.roster.adapter.in.web;
import ch.unisg.roster.roster.domain.Roster;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.json.JSONObject;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskUseCase;
import ch.unisg.roster.roster.domain.ExecutorInfo;
import ch.unisg.roster.roster.domain.Task;
import org.springframework.web.server.ResponseStatusException;
import javax.validation.ConstraintViolationException;
@RestController
public class ApplyForTaskWebController {
private final ApplyForTaskUseCase applyForTaskUseCase;
public ApplyForTaskWebController(ApplyForTaskUseCase applyForTaskUseCase) {
this.applyForTaskUseCase = applyForTaskUseCase;
}
// TODO fix return type
/**
* Checks if task is available for the requesting executor.
* @return a task or null if no task found
**/
@PostMapping(path = "/task/apply", consumes = {"application/json"})
public ResponseEntity<String> applyForTask (@RequestBody ExecutorInfo executorInfo) {
ApplyForTaskCommand command = new ApplyForTaskCommand(executorInfo.getExecutorType(),
executorInfo.getExecutorURI());
Task task = applyForTaskUseCase.applyForTask(command);
if (task == null) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
try {
String executorType = command.getTaskType().getValue().toString();
String executorURI = command.getExecutorURI().getValue().toString();
String jsonPayLoad = new JSONObject()
.put("executorType", executorType)
.put("executorURI", executorURI)
.toString();
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "application/json");
return new ResponseEntity<>(jsonPayLoad, responseHeaders, HttpStatus.CREATED);
} catch (ConstraintViolationException e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage());
}
}
}

View File

@ -0,0 +1,21 @@
package ch.unisg.roster.roster.adapter.out.persistence.mongodb;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection="roster")
public class MongoRosterDocument {
@Id
public String taskId;
public String taskType;
public String executorURI;
public MongoRosterDocument(String taskId, String taskType, String executorURI){
this.taskId = taskId;
this.taskType = taskType;
this.executorURI = executorURI;
}
}

View File

@ -0,0 +1,23 @@
package ch.unisg.roster.roster.adapter.out.persistence.mongodb;
import ch.unisg.common.valueobject.ExecutorURI;
import ch.unisg.roster.roster.domain.RosterItem;
import org.springframework.stereotype.Component;
@Component
public class RosterMapper {
RosterItem maptoDomainEntity(MongoRosterDocument rosterItem) {
return new RosterItem(rosterItem.taskId, rosterItem.taskType,
new ExecutorURI(rosterItem.executorURI));
}
MongoRosterDocument mapToMongoDocument(RosterItem rosterItem){
return new MongoRosterDocument(
rosterItem.getTaskID(),
rosterItem.getTaskType(),
rosterItem.getExecutorURI().getValue().toString());
}
}

View File

@ -0,0 +1,49 @@
package ch.unisg.roster.roster.adapter.out.persistence.mongodb;
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
import ch.unisg.roster.roster.application.port.in.DeleteRosterItem;
import ch.unisg.roster.roster.application.port.in.LoadRosterItemPort;
import ch.unisg.roster.roster.domain.RosterItem;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
@RequiredArgsConstructor
public class RosterPersistenceAdapter implements AddRosterItemPort, LoadRosterItemPort, DeleteRosterItem {
@Autowired
private final RosterRepository rosterRepository;
private final RosterMapper rosterMapper;
@Override
public void addRosterItem(RosterItem rosterItem){
MongoRosterDocument mongoRosterDocument = rosterMapper.mapToMongoDocument(rosterItem);
rosterRepository.save(mongoRosterDocument);
}
@Override
public RosterItem loadRosterItem(String taskId){
MongoRosterDocument mongoRosterDocument = rosterRepository.findByTaskId(taskId);
RosterItem rosterItem = rosterMapper.maptoDomainEntity(mongoRosterDocument);
return rosterItem;
}
@Override
public List<RosterItem> loadAllRosterItems(){
List<MongoRosterDocument> rosterList = rosterRepository.findAll();
List<RosterItem> rosterItemList = new ArrayList<>();
for(MongoRosterDocument rosterDocument : rosterList){
rosterItemList.add(rosterMapper.maptoDomainEntity(rosterDocument));
}
return rosterItemList;
}
@Override
public void deleteRosterItem(String taskId){
rosterRepository.deleteById(taskId);
}
}

View File

@ -0,0 +1,9 @@
package ch.unisg.roster.roster.adapter.out.persistence.mongodb;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface RosterRepository extends MongoRepository<MongoRosterDocument,String>{
public MongoRosterDocument findByTaskId(String taskId);
}

View File

@ -19,10 +19,10 @@ import ch.unisg.roster.roster.domain.event.NewTaskEvent;
@Primary
public class PublishNewTaskEventAdapter implements NewTaskEventPort {
@Value("${executor-robot.uri}")
@Value("${executor.robot.uri}")
private String server;
@Value("${executor-computation.uri}")
@Value("${executor.computation.uri}")
private String server2;
Logger logger = Logger.getLogger(PublishNewTaskEventAdapter.class.getName());

View File

@ -20,7 +20,7 @@ import ch.unisg.roster.roster.domain.event.TaskAssignedEvent;
@Primary
public class PublishTaskAssignedEventAdapter implements TaskAssignedEventPort {
@Value("${task-list.uri}")
@Value("${task.list.uri}")
private String server;
Logger logger = Logger.getLogger(PublishTaskAssignedEventAdapter.class.getName());

View File

@ -20,7 +20,7 @@ import ch.unisg.roster.roster.domain.event.TaskCompletedEvent;
@Primary
public class PublishTaskCompletedEventAdapter implements TaskCompletedEventPort {
@Value("${task-list.uri}")
@Value("${task.list.uri}")
private String server;
Logger logger = Logger.getLogger(PublishTaskCompletedEventAdapter.class.getName());

View File

@ -0,0 +1,9 @@
package ch.unisg.roster.roster.application.port.in;
import ch.unisg.roster.roster.domain.RosterItem;
public interface AddRosterItemPort {
void addRosterItem(RosterItem rosterItem);
}

View File

@ -0,0 +1,8 @@
package ch.unisg.roster.roster.application.port.in;
import ch.unisg.roster.roster.domain.RosterItem;
public interface DeleteRosterItem {
void deleteRosterItem(String taskId);
}

View File

@ -0,0 +1,12 @@
package ch.unisg.roster.roster.application.port.in;
import ch.unisg.roster.roster.domain.RosterItem;
import java.util.List;
public interface LoadRosterItemPort {
RosterItem loadRosterItem(String taskId);
List<RosterItem> loadAllRosterItems();
}

View File

@ -2,6 +2,8 @@ package ch.unisg.roster.roster.application.service;
import javax.transaction.Transactional;
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
import ch.unisg.roster.roster.domain.RosterItem;
import org.springframework.stereotype.Component;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
@ -18,6 +20,7 @@ import lombok.RequiredArgsConstructor;
public class ApplyForTaskService implements ApplyForTaskUseCase {
private final TaskAssignedEventPort taskAssignedEventPort;
private final AddRosterItemPort addRosterItemPort;
/**
* Checks if a task is available and assignes it to the executor. If task got assigned a task
@ -31,6 +34,7 @@ public class ApplyForTaskService implements ApplyForTaskUseCase {
if (task != null) {
taskAssignedEventPort.publishTaskAssignedEvent(new TaskAssignedEvent(task.getTaskID()));
addRosterItemPort.addRosterItem(new RosterItem(task.getTaskID(), task.getTaskType().getValue(), command.getExecutorURI()));
}
return task;

View File

@ -2,6 +2,7 @@ package ch.unisg.roster.roster.application.service;
import javax.transaction.Transactional;
import ch.unisg.roster.roster.application.port.in.DeleteRosterItem;
import org.springframework.stereotype.Component;
import ch.unisg.roster.roster.application.port.in.TaskCompletedCommand;
@ -17,6 +18,7 @@ import lombok.RequiredArgsConstructor;
public class TaskCompletedService implements TaskCompletedUseCase {
private final TaskCompletedEventPort taskCompletedEventPort;
private final DeleteRosterItem deleteRosterItem;
/**
* Completes the task in the roster and publishes a task completed event.
@ -26,6 +28,7 @@ public class TaskCompletedService implements TaskCompletedUseCase {
public void taskCompleted(TaskCompletedCommand command) {
Roster.getInstance().taskCompleted(command.getTaskID());
deleteRosterItem.deleteRosterItem(command.getTaskID());
taskCompletedEventPort.publishTaskCompleted(new TaskCompletedEvent(command.getTaskID(),
command.getTaskStatus(), command.getTaskResult()));

View File

@ -1,8 +1,6 @@
package ch.unisg.roster.roster.domain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -83,4 +81,18 @@ public class Roster {
return queues.get(taskType.getValue()).removeIf(task -> task.getTaskID().equalsIgnoreCase(taskID));
}
public void initialiseRoster(List<RosterItem> rosterItemList){
for(RosterItem rosterItem : rosterItemList){
rosterMap.put(rosterItem.getTaskID(), rosterItem);
}
}
public Collection<RosterItem> getRosterMap(){
return rosterMap.values();
}
public Collection<ArrayList<Task>> getAllTasksFromQueue(){
return queues.values();
}
}

View File

@ -20,4 +20,8 @@ public class RosterItem {
this.executorURI = executorURI;
}
public static RosterItem withIDTypeExecutorURI(String taskId, String taskType,
ExecutorURI executorURI){
return new RosterItem(taskId, taskType, executorURI);
}
}

View File

@ -1,5 +1,21 @@
server.port=8082
executor-robot.uri=http://127.0.0.1:8084
executor-computation.uri=http://127.0.0.1:8085
task-list.uri=http://127.0.0.1:8081
executor.robot.uri=http://127.0.0.1:8084
executor.computation.uri=http://127.0.0.1:8085
task.list.uri=http://127.0.0.1:8081
mqtt.broker.uri=tcp://localhost:1883
spring.data.mongodb.uri=mongodb://root:password@localhost:27017/
spring.data.mongodb.database=tapas-roster
spring.profiles.active=chaos-monkey
chaos.monkey.enabled=false
management.endpoint.chaosmonkey.enabled=true
management.endpoint.chaosmonkeyjmx.enabled=true
# include specific endpoints
management.endpoints.web.exposure.include=health,info,chaosmonkey
chaos.monkey.watcher.controller=true
chaos.monkey.watcher.restController=true
chaos.monkey.watcher.service=true
chaos.monkey.watcher.repository=true
chaos.monkey.watcher.component=true

View File

@ -0,0 +1,20 @@
package ch.unisg.roster;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import org.junit.jupiter.api.Test;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
public class DependencyRuleTests {
@Test
void testPackageDependencies() {
noClasses()
.that()
.resideInAPackage("ch.unisg.roster.roster.domain..")
.should()
.dependOnClassesThat()
.resideInAnyPackage("ch.unisg.roster.roster.application..")
.check(new ClassFileImporter()
.importPackages("ch.unisg.roster.roster.."));
}
}

View File

@ -1,13 +0,0 @@
package ch.unisg.roster;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class RosterApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -0,0 +1,82 @@
package ch.unisg.roster.roster;
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
import ch.unisg.roster.roster.domain.Roster;
import ch.unisg.roster.roster.domain.Task;
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
import org.json.JSONObject;
import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.*;
import static org.assertj.core.api.BDDAssertions.*;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class AddNewAssignmentToRosterServiceSystemTest {
@Autowired
private TestRestTemplate restTemplate;
@Autowired
private AddRosterItemPort addRosterItemPort;
@Test
void addNewAssignmentToRosterService() throws JSONException {
String rosterItemId = "TEST-ID";
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI);
System.out.println(response.getBody().toString());
JSONObject responseJson = new JSONObject(response.getBody().toString());
String respExecutorType = responseJson.getString("executorType");
String respExecutorURI = responseJson.getString("executorURI");
then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
then(respExecutorType).isEqualTo(executorType);
then(respExecutorURI).isEqualTo(executorURI);
then(Roster.getInstance().getRosterMap().size()).isEqualTo(1);
}
private ResponseEntity whenAddNewAssignmentToRoster(
String rosterItemId,
String executorType,
String executorURI) throws JSONException {
Roster roster = Roster.getInstance();
roster.getRosterMap().clear();
roster.addTaskToQueue(new Task(rosterItemId, new ExecutorType(executorType), executorURI));
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
String jsonPayLoad = new JSONObject()
.put("rosterItemId", rosterItemId)
.put("executorType", executorType)
.put("executorURI", executorURI)
.toString();
HttpEntity<String> request = new HttpEntity<>(jsonPayLoad, headers);
return restTemplate.exchange(
"/task/apply/",
HttpMethod.POST,
request,
Object.class
);
}
}

View File

@ -0,0 +1,68 @@
package ch.unisg.roster.roster.adapter.in.web;
import ch.unisg.common.valueobject.ExecutorURI;
import ch.unisg.roster.roster.adapter.out.persistence.mongodb.RosterRepository;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskUseCase;
import ch.unisg.roster.roster.domain.RosterItem;
import ch.unisg.roster.roster.domain.Task;
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
import org.json.JSONObject;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.web.servlet.MockMvc;
import static org.mockito.BDDMockito.then;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@WebMvcTest(controllers = ApplyForTaskWebController.class)
public class ApplyForTaskWebControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private ApplyForTaskUseCase applyForTaskUseCase;
@MockBean
RosterRepository rosterRepository;
@Test
void testApplyForTask() throws Exception{
String executorType = "TEST-TYPE";
String executorURI = "http://localhost:6969";
String taskId = "TEST-ID";
String jsonPayLoad = new JSONObject()
.put("executorType", executorType )
.put("executorURI",executorURI)
.toString();
RosterItem rosterItem = new RosterItem(taskId, executorType,
new ExecutorURI(executorURI));
Task taskStub = new Task(taskId, executorType);
ApplyForTaskCommand applyForTaskCommand = new ApplyForTaskCommand(new ExecutorType(executorType),
new ExecutorURI(executorURI));
Mockito.when(applyForTaskUseCase.applyForTask(applyForTaskCommand))
.thenReturn(taskStub);
mockMvc.perform(post("/task/apply/")
.contentType("application/json")
.content(jsonPayLoad))
.andExpect(status().is2xxSuccessful());
then(applyForTaskUseCase).should()
.applyForTask(new ApplyForTaskCommand(new ExecutorType(executorType), new ExecutorURI(executorURI)));
}
}

View File

@ -0,0 +1,68 @@
package ch.unisg.roster.roster.adapter.out.persistence.mongodb;
import ch.unisg.common.valueobject.ExecutorURI;
import ch.unisg.roster.roster.domain.RosterItem;
import ch.unisg.roster.roster.domain.Task;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataMongo;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureDataMongo
@Import({RosterPersistenceAdapter.class, RosterMapper.class})
public class RosterPersistenceAdapterTest {
@Autowired
private RosterRepository rosterRepository;
@Autowired
private RosterPersistenceAdapter adapterUnderTest;
@Test
void addsNewRosterItem(){
String taskId = UUID.randomUUID().toString();
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
RosterItem testRosterItem = new RosterItem(
taskId,
executorType,
new ExecutorURI(executorURI)
);
adapterUnderTest.addRosterItem(testRosterItem);
MongoRosterDocument retrievedDoc = rosterRepository.findByTaskId(taskId);
assertThat(retrievedDoc.taskId).isEqualTo(taskId);
assertThat(retrievedDoc.executorURI).isEqualTo(executorURI);
assertThat(retrievedDoc.taskType).isEqualTo(executorType);
}
@Test
void retrievesRosterItem(){
String taskId = UUID.randomUUID().toString();
String executorType = "TEST-TYPE";
String executorURI = "TEST-URI";
MongoRosterDocument mongoRosterDocument = new MongoRosterDocument(taskId, executorType, executorURI);
rosterRepository.insert(mongoRosterDocument);
RosterItem retrievedRosterItem = adapterUnderTest.loadRosterItem(taskId);
assertThat(retrievedRosterItem.getTaskID()).isEqualTo(taskId);
assertThat(retrievedRosterItem.getTaskType()).isEqualTo(executorType);
assertThat(retrievedRosterItem.getExecutorURI().getValue().toString()).isEqualTo(executorURI);
}
}

View File

@ -0,0 +1,76 @@
package ch.unisg.roster.roster.application.service;
import ch.unisg.common.valueobject.ExecutorURI;
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
import ch.unisg.roster.roster.application.port.in.DeleteRosterItem;
import ch.unisg.roster.roster.application.port.in.NewTaskCommand;
import ch.unisg.roster.roster.application.port.out.NewTaskEventPort;
import ch.unisg.roster.roster.application.port.out.TaskAssignedEventPort;
import ch.unisg.roster.roster.application.port.out.TaskCompletedEventPort;
import ch.unisg.roster.roster.domain.Roster;
import ch.unisg.roster.roster.domain.RosterItem;
import ch.unisg.roster.roster.domain.Task;
import ch.unisg.roster.roster.domain.event.NewTaskEvent;
import ch.unisg.roster.roster.domain.event.TaskAssignedEvent;
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.net.URI;
import java.util.Optional;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.BDDMockito.*;
public class AddNewAssignmentToRosterServiceTest {
//private final NewTaskEventPort newTaskEventPort = Mockito.mock(NewTaskEventPort.class);
private final TaskAssignedEventPort taskAssignedEventPort = Mockito.mock(TaskAssignedEventPort.class);
private final AddRosterItemPort addRosterItemPort = Mockito.mock(AddRosterItemPort.class);
//private final TaskCompletedEventPort taskCompletedEventPort = Mockito.mock(TaskCompletedEventPort.class)
//private final DeleteRosterItem deleteRosterItem = Mockito.mock(DeleteRosterItem.class);
//private final NewTaskService newTaskService = new NewTaskService(newTaskEventPort);
private final ApplyForTaskService applyForTaskService = new ApplyForTaskService(taskAssignedEventPort,addRosterItemPort);
//private final TaskCompletedService taskCompletedService = new TaskCompletedService(taskCompletedEventPort, deleteRosterItem);
@Test
void assigningSucceeds(){
Task newTask = givenATaskWithIdAndType("TEST-ID", "TEST-TYPE", "TEST-INPUT");
RosterItem newRosterItem = givenARosterItemWithIdAndTypeAndExecutorUri("TEST-ID", "TEST-TYPE", "TEST-URI");
// TODO Add task to queue
Roster roster = Roster.getInstance();
roster.addTaskToQueue(newTask);
ApplyForTaskCommand applyForTaskCommand = new ApplyForTaskCommand(newTask.getTaskType(), newRosterItem.getExecutorURI());
Task assignedTask = applyForTaskService.applyForTask(applyForTaskCommand);
assertThat(assignedTask).isNotNull();
then(taskAssignedEventPort).should(times(1))
.publishTaskAssignedEvent(any(TaskAssignedEvent.class));
then(addRosterItemPort).should(times(1));
}
private RosterItem givenARosterItemWithIdAndTypeAndExecutorUri(String taskId, String taskType,
String executorURI){
RosterItem rosterItem = Mockito.mock(RosterItem.class);
given(rosterItem.getTaskID()).willReturn(taskId);
given(rosterItem.getTaskType()).willReturn(taskType);
given(rosterItem.getExecutorURI()).willReturn(new ExecutorURI(executorURI));
return rosterItem;
}
private Task givenATaskWithIdAndType(String taskId, String taskType, String inputData) {
Task task = Mockito.mock(Task.class);
given(task.getTaskID()).willReturn(taskId);
given(task.getTaskType()).willReturn(new ExecutorType(taskType));
given(task.getInputData()).willReturn(inputData);
return task;
}
}

View File

@ -0,0 +1,52 @@
package ch.unisg.roster.roster.domain;
import ch.unisg.common.valueobject.ExecutorURI;
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.*;
public class RosterTest {
@Test
void addAssignmentToRosterMapTest(){
Roster roster = Roster.getInstance();
Collection<RosterItem> rosterMap = roster.getRosterMap();
rosterMap.clear();
Collection<ArrayList<Task>> queues = roster.getAllTasksFromQueue();
queues.clear();
roster.addTaskToQueue(new Task("TEST-ID", "TEST-TYPE"));
Task task = roster.assignTaskToExecutor(new ExecutorType("TEST-TYPE"), new ExecutorURI("TEST-URI"));
assertThat(rosterMap.size()).isEqualTo(1);
assertThat(rosterMap.iterator().next().getTaskID()).isEqualTo("TEST-ID");
assertThat(rosterMap.iterator().next().getTaskType()).isEqualTo("TEST-TYPE");
assertThat(rosterMap.iterator().next().getExecutorURI().getValue().toString()).isEqualTo("TEST-URI");
assertThat(task.getTaskType().getValue().toString()).isEqualTo("TEST-TYPE");
assertThat(task.getTaskID()).isEqualTo("TEST-ID");
boolean empty_queue = roster.deleteTask("TEST-ID", new ExecutorType("TEST-TYPE"));
// TODO test that the task was removed from the Queue similar to below --> I don't know if it actually gets deleted or not
//assertThat(empty_queue).isEqualTo(true);
//assertThat(queues.size()).isEqualTo(0);
}
@Test
void removeTaskFromQueue(){
Roster roster = Roster.getInstance();
Collection<ArrayList<Task>> queues = roster.getAllTasksFromQueue();
queues.clear();
roster.addTaskToQueue(new Task("TEST-ID", "TEST-TYPE"));
boolean test = roster.deleteTask("TEST-ID", new ExecutorType("TEST-TYPE"));
assertThat(test).isEqualTo(true);
assertThat(queues.size()).isEqualTo(1);
}
}

View File

@ -0,0 +1,2 @@
spring.data.mongodb.uri=mongodb://127.0.0.1:27017
spring.data.mongodb.database=tapas-roster

Some files were not shown because too many files have changed in this diff Show More