From 0288082cd54a40295f33259bc82d95e09a8a40ee Mon Sep 17 00:00:00 2001 From: rahimiankeanu Date: Fri, 26 Nov 2021 22:16:23 +0100 Subject: [PATCH 1/7] Testing ExecutorPool version 1 --- ...dNewExecutorToExecutorPoolServiceTest.java | 64 +++++++++++++++++ ...ddNewExecutorToExecutorPoolSystemTest.java | 70 +++++++++++++++++++ ...ecutorToExecutorPoolWebControllerTest.java | 69 ++++++++++++++++++ .../ExecutorPoolApplicationTests.java | 13 ---- .../unisg/executorpool/ExecutorPoolTest.java | 56 +++++++++++++++ 5 files changed, 259 insertions(+), 13 deletions(-) create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java delete mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java new file mode 100644 index 0000000..27f447b --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java @@ -0,0 +1,64 @@ +package ch.unisg.executorpool; + +import static org.mockito.Mockito.times; + +import java.net.URI; +import java.util.Optional; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.BDDMockito.then; + +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.ExecutorClass; +import ch.unisg.executorpool.domain.ExecutorPool; + +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"), + Optional.of(new ExecutorClass.ExecutorUri(URI.create("example.org")))); + + ExecutorPool executorPool = givenAnEmptyExecutorPool(ExecutorPool.getExecutorPool()); + + AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(newExecutor.getExecutorTaskType(), + Optional.ofNullable(newExecutor.getExecutorUri())); + + ExecutorClass addedExecutor = addNewExecutorToExecutorPoolService.addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand); + + assertThat(addedExecutor).isNotNull(); + assertThat(executorPool.getListOfExecutors().getValue()).hasSize(1); + + then(newExecutorAddedEventPort).should(times(1)).publishNewExecutorAddedEvent(any(NewExecutorAddedEvent.class)); + + } + + + private ExecutorPool givenAnEmptyExecutorPool(ExecutorPool executorPool) { + executorPool.getListOfExecutors().getValue().clear(); + return executorPool; + } + + private ExecutorClass givenAnExecutorWithTypeAndUri(ExecutorClass.ExecutorTaskType executorTaskType, + Optional executorUri) { + + ExecutorClass executor = Mockito.mock(ExecutorClass.class); + given(ExecutorClass.getExecutorTaskType()).willReturn(executorTaskType); + given(ExecutorClass.getExecutorUri()).willReturn(executorUri); + return executor; + } + + + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java new file mode 100644 index 0000000..1eba971 --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java @@ -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.mockito.BDDMockito.then; + +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 respExecutorId = responseJson.getString("executorId"); + String respExecutorTaskType = responseJson.getString("executorTaskType"); + + then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); + then(respExecutorId).isNotEmpty(); + 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 request = new HttpEntity<>(jsonPayLoad,headers); + + return restTemplate.exchange("/executorpool/", HttpMethod.POST, request, Object.class); + + } + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java new file mode 100644 index 0000000..cc28edb --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java @@ -0,0 +1,69 @@ +package ch.unisg.executorpool; + +import java.util.Optional; + +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 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 net.minidev.json.JSONObject; + + +@WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class) +public class AddNewExecutorToExecutorPoolWebControllerTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private AddNewExecutorToExecutorPoolUseCase addNewExecutorToExecutorPoolUseCase; + + @MockBean + ExecutorRepository executorRepository; + + @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 ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))); + + Mockito.when(addNewExecutorToExecutorPoolUseCase + .addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand)) + .thenReturn(executorStub); + + mockMvc.perform(post("/executorpool/") + .contentType(ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE) + .content(jsonPayLoad)) + .andExpect(status().isCreated()); + + then(addNewExecutorToExecutorPoolUseCase).should() + .addNewExecutorToExecutorPool(eq(new AddNewExecutorToExecutorPoolCommand( + new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))))); + + + } + + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java deleted file mode 100644 index 77e1032..0000000 --- a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java +++ /dev/null @@ -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() { - } - -} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java new file mode 100644 index 0000000..d94fd6a --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java @@ -0,0 +1,56 @@ +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(); + ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type")); + + ExecutorClass retrievedExecutor = executorPool.getExecutorByUri(newExecutor.getExecutorUri()).get(); + + assertThat(retrievedExecutor).isEqualTo(newExecutor); + } + + @Test + void retrieveExecutorFailure() { + ExecutorPool executorPool = ExecutorPool.getExecutorPool(); + executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type")); + + ExecutorUri fakeUri = new ExecutorUri(java.net.URI.create("fake-Uri")); + + Optional retrievedExecutor = executorPool.getExecutorByUri(fakeUri); + + assertThat(retrievedExecutor.isPresent()).isFalse(); + } + + + + +} -- 2.45.1 From e1cd5774f14bb1dff3876c798c5e44976d6f5293 Mon Sep 17 00:00:00 2001 From: rahimiankeanu Date: Sat, 27 Nov 2021 12:53:30 +0100 Subject: [PATCH 2/7] ExecutorPoolTest code should be fine. But half of tests failed --- .../executorpool/domain/ExecutorClass.java | 2 +- ...dNewExecutorToExecutorPoolServiceTest.java | 19 ++++++++++--------- ...ddNewExecutorToExecutorPoolSystemTest.java | 2 +- ...ecutorToExecutorPoolWebControllerTest.java | 8 +++++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java b/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java index 5da6fe7..021b58b 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java @@ -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); } diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java index 27f447b..3f6f70e 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java @@ -3,19 +3,20 @@ package ch.unisg.executorpool; import static org.mockito.Mockito.times; import java.net.URI; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import static org.mockito.BDDMockito.*; import static org.assertj.core.api.Assertions.*; -import static org.mockito.BDDMockito.then; 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 { @@ -28,19 +29,19 @@ public class AddNewExecutorToExecutorPoolServiceTest { void addingSucceeds() { ExecutorClass newExecutor = givenAnExecutorWithTypeAndUri(new ExecutorClass.ExecutorTaskType("test-type"), - Optional.of(new ExecutorClass.ExecutorUri(URI.create("example.org")))); + new ExecutorClass.ExecutorUri(URI.create("example.org"))); ExecutorPool executorPool = givenAnEmptyExecutorPool(ExecutorPool.getExecutorPool()); - AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(newExecutor.getExecutorTaskType(), - Optional.ofNullable(newExecutor.getExecutorUri())); + 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)).publishNewExecutorAddedEvent(any(NewExecutorAddedEvent.class)); + then(newExecutorAddedEventPort).should(times(1)).publishExecutorAddedEvent(any(ExecutorAddedEvent.class)); } @@ -51,11 +52,11 @@ public class AddNewExecutorToExecutorPoolServiceTest { } private ExecutorClass givenAnExecutorWithTypeAndUri(ExecutorClass.ExecutorTaskType executorTaskType, - Optional executorUri) { + ExecutorUri executorUri) { ExecutorClass executor = Mockito.mock(ExecutorClass.class); - given(ExecutorClass.getExecutorTaskType()).willReturn(executorTaskType); - given(ExecutorClass.getExecutorUri()).willReturn(executorUri); + given(executor.getExecutorTaskType()).willReturn(executorTaskType); + given(executor.getExecutorUri()).willReturn(executorUri); return executor; } diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java index 1eba971..05b6099 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java @@ -11,7 +11,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -//import static org.mockito.BDDMockito.then; +import static org.assertj.core.api.BDDAssertions.*; import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation; import ch.unisg.executorpool.application.port.out.AddExecutorPort; diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java index cc28edb..4d6417d 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java @@ -11,6 +11,8 @@ 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; @@ -20,7 +22,7 @@ import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolUse import ch.unisg.executorpool.domain.ExecutorClass; import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType; import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri; -import net.minidev.json.JSONObject; +import org.json.JSONObject; @WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class) @@ -47,7 +49,7 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { new ExecutorClass.ExecutorTaskType(executorTaskType)); AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand( - new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))); + new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType)); Mockito.when(addNewExecutorToExecutorPoolUseCase .addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand)) @@ -60,7 +62,7 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { then(addNewExecutorToExecutorPoolUseCase).should() .addNewExecutorToExecutorPool(eq(new AddNewExecutorToExecutorPoolCommand( - new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))))); + new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType)))); } -- 2.45.1 From d1fe47db6f2b1d2e77b27c257f4df2df0efad886 Mon Sep 17 00:00:00 2001 From: reynisson Date: Sun, 28 Nov 2021 17:13:14 +0100 Subject: [PATCH 3/7] Retrieve task from memory to be able to check task results. Temp fix until we start updating tasks in DB --- .../application/service/RetrieveTaskFromTaskListService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java index 39026f5..696514b 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/tasks/application/service/RetrieveTaskFromTaskListService.java @@ -28,6 +28,6 @@ public class RetrieveTaskFromTaskListService implements RetrieveTaskFromTaskList Optional taskFromRepo = Optional.ofNullable(loadTaskFromRepositoryPort.loadTask(query.getTaskId(), taskList.getTaskListName())); - return taskFromRepo; + return task; } } -- 2.45.1 From e03fc296ee2cf4acde931cd5f202f7552becb4c3 Mon Sep 17 00:00:00 2001 From: rahimiankeanu Date: Fri, 26 Nov 2021 22:16:23 +0100 Subject: [PATCH 4/7] Testing ExecutorPool version 1 --- ...dNewExecutorToExecutorPoolServiceTest.java | 64 +++++++++++++++++ ...ddNewExecutorToExecutorPoolSystemTest.java | 70 +++++++++++++++++++ ...ecutorToExecutorPoolWebControllerTest.java | 69 ++++++++++++++++++ .../ExecutorPoolApplicationTests.java | 13 ---- .../unisg/executorpool/ExecutorPoolTest.java | 56 +++++++++++++++ 5 files changed, 259 insertions(+), 13 deletions(-) create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java delete mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java create mode 100644 executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java new file mode 100644 index 0000000..27f447b --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java @@ -0,0 +1,64 @@ +package ch.unisg.executorpool; + +import static org.mockito.Mockito.times; + +import java.net.URI; +import java.util.Optional; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.BDDMockito.then; + +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.ExecutorClass; +import ch.unisg.executorpool.domain.ExecutorPool; + +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"), + Optional.of(new ExecutorClass.ExecutorUri(URI.create("example.org")))); + + ExecutorPool executorPool = givenAnEmptyExecutorPool(ExecutorPool.getExecutorPool()); + + AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(newExecutor.getExecutorTaskType(), + Optional.ofNullable(newExecutor.getExecutorUri())); + + ExecutorClass addedExecutor = addNewExecutorToExecutorPoolService.addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand); + + assertThat(addedExecutor).isNotNull(); + assertThat(executorPool.getListOfExecutors().getValue()).hasSize(1); + + then(newExecutorAddedEventPort).should(times(1)).publishNewExecutorAddedEvent(any(NewExecutorAddedEvent.class)); + + } + + + private ExecutorPool givenAnEmptyExecutorPool(ExecutorPool executorPool) { + executorPool.getListOfExecutors().getValue().clear(); + return executorPool; + } + + private ExecutorClass givenAnExecutorWithTypeAndUri(ExecutorClass.ExecutorTaskType executorTaskType, + Optional executorUri) { + + ExecutorClass executor = Mockito.mock(ExecutorClass.class); + given(ExecutorClass.getExecutorTaskType()).willReturn(executorTaskType); + given(ExecutorClass.getExecutorUri()).willReturn(executorUri); + return executor; + } + + + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java new file mode 100644 index 0000000..1eba971 --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java @@ -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.mockito.BDDMockito.then; + +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 respExecutorId = responseJson.getString("executorId"); + String respExecutorTaskType = responseJson.getString("executorTaskType"); + + then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); + then(respExecutorId).isNotEmpty(); + 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 request = new HttpEntity<>(jsonPayLoad,headers); + + return restTemplate.exchange("/executorpool/", HttpMethod.POST, request, Object.class); + + } + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java new file mode 100644 index 0000000..cc28edb --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java @@ -0,0 +1,69 @@ +package ch.unisg.executorpool; + +import java.util.Optional; + +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 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 net.minidev.json.JSONObject; + + +@WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class) +public class AddNewExecutorToExecutorPoolWebControllerTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private AddNewExecutorToExecutorPoolUseCase addNewExecutorToExecutorPoolUseCase; + + @MockBean + ExecutorRepository executorRepository; + + @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 ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))); + + Mockito.when(addNewExecutorToExecutorPoolUseCase + .addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand)) + .thenReturn(executorStub); + + mockMvc.perform(post("/executorpool/") + .contentType(ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE) + .content(jsonPayLoad)) + .andExpect(status().isCreated()); + + then(addNewExecutorToExecutorPoolUseCase).should() + .addNewExecutorToExecutorPool(eq(new AddNewExecutorToExecutorPoolCommand( + new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))))); + + + } + + +} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java deleted file mode 100644 index 77e1032..0000000 --- a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolApplicationTests.java +++ /dev/null @@ -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() { - } - -} diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java new file mode 100644 index 0000000..d94fd6a --- /dev/null +++ b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java @@ -0,0 +1,56 @@ +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(); + ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type")); + + ExecutorClass retrievedExecutor = executorPool.getExecutorByUri(newExecutor.getExecutorUri()).get(); + + assertThat(retrievedExecutor).isEqualTo(newExecutor); + } + + @Test + void retrieveExecutorFailure() { + ExecutorPool executorPool = ExecutorPool.getExecutorPool(); + executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type")); + + ExecutorUri fakeUri = new ExecutorUri(java.net.URI.create("fake-Uri")); + + Optional retrievedExecutor = executorPool.getExecutorByUri(fakeUri); + + assertThat(retrievedExecutor.isPresent()).isFalse(); + } + + + + +} -- 2.45.1 From 3c8171af8e05057d834512c4791997c567a15007 Mon Sep 17 00:00:00 2001 From: rahimiankeanu Date: Sat, 27 Nov 2021 12:53:30 +0100 Subject: [PATCH 5/7] ExecutorPoolTest code should be fine. But half of tests failed --- .../executorpool/domain/ExecutorClass.java | 2 +- ...dNewExecutorToExecutorPoolServiceTest.java | 19 ++++++++++--------- ...ddNewExecutorToExecutorPoolSystemTest.java | 2 +- ...ecutorToExecutorPoolWebControllerTest.java | 8 +++++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java b/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java index 5da6fe7..021b58b 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/domain/ExecutorClass.java @@ -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); } diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java index 27f447b..3f6f70e 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolServiceTest.java @@ -3,19 +3,20 @@ package ch.unisg.executorpool; import static org.mockito.Mockito.times; import java.net.URI; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import static org.mockito.BDDMockito.*; import static org.assertj.core.api.Assertions.*; -import static org.mockito.BDDMockito.then; 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 { @@ -28,19 +29,19 @@ public class AddNewExecutorToExecutorPoolServiceTest { void addingSucceeds() { ExecutorClass newExecutor = givenAnExecutorWithTypeAndUri(new ExecutorClass.ExecutorTaskType("test-type"), - Optional.of(new ExecutorClass.ExecutorUri(URI.create("example.org")))); + new ExecutorClass.ExecutorUri(URI.create("example.org"))); ExecutorPool executorPool = givenAnEmptyExecutorPool(ExecutorPool.getExecutorPool()); - AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand(newExecutor.getExecutorTaskType(), - Optional.ofNullable(newExecutor.getExecutorUri())); + 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)).publishNewExecutorAddedEvent(any(NewExecutorAddedEvent.class)); + then(newExecutorAddedEventPort).should(times(1)).publishExecutorAddedEvent(any(ExecutorAddedEvent.class)); } @@ -51,11 +52,11 @@ public class AddNewExecutorToExecutorPoolServiceTest { } private ExecutorClass givenAnExecutorWithTypeAndUri(ExecutorClass.ExecutorTaskType executorTaskType, - Optional executorUri) { + ExecutorUri executorUri) { ExecutorClass executor = Mockito.mock(ExecutorClass.class); - given(ExecutorClass.getExecutorTaskType()).willReturn(executorTaskType); - given(ExecutorClass.getExecutorUri()).willReturn(executorUri); + given(executor.getExecutorTaskType()).willReturn(executorTaskType); + given(executor.getExecutorUri()).willReturn(executorUri); return executor; } diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java index 1eba971..05b6099 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java @@ -11,7 +11,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -//import static org.mockito.BDDMockito.then; +import static org.assertj.core.api.BDDAssertions.*; import ch.unisg.executorpool.adapter.common.formats.ExecutorJsonRepresentation; import ch.unisg.executorpool.application.port.out.AddExecutorPort; diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java index cc28edb..4d6417d 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java @@ -11,6 +11,8 @@ 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; @@ -20,7 +22,7 @@ import ch.unisg.executorpool.application.port.in.AddNewExecutorToExecutorPoolUse import ch.unisg.executorpool.domain.ExecutorClass; import ch.unisg.executorpool.domain.ExecutorClass.ExecutorTaskType; import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri; -import net.minidev.json.JSONObject; +import org.json.JSONObject; @WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class) @@ -47,7 +49,7 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { new ExecutorClass.ExecutorTaskType(executorTaskType)); AddNewExecutorToExecutorPoolCommand addNewExecutorToExecutorPoolCommand = new AddNewExecutorToExecutorPoolCommand( - new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))); + new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType)); Mockito.when(addNewExecutorToExecutorPoolUseCase .addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand)) @@ -60,7 +62,7 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { then(addNewExecutorToExecutorPoolUseCase).should() .addNewExecutorToExecutorPool(eq(new AddNewExecutorToExecutorPoolCommand( - new ExecutorTaskType(executorTaskType), Optional.of(new ExecutorUri(java.net.URI.create(executorUri)))))); + new ExecutorUri(java.net.URI.create(executorUri)), new ExecutorTaskType(executorTaskType)))); } -- 2.45.1 From c0412f6eba02ac46ea38aed7fee741012c631381 Mon Sep 17 00:00:00 2001 From: reynisson Date: Sun, 28 Nov 2021 17:43:50 +0100 Subject: [PATCH 6/7] Fixed executor-pool tests that were failing --- .../AddNewExecutorToExecutorPoolSystemTest.java | 14 +++++++------- ...ExecutorToExecutorPoolWebControllerTest.java | 8 ++++++-- .../ch/unisg/executorpool/ExecutorPoolTest.java | 17 ++++++++++------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java index 05b6099..5c39427 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolSystemTest.java @@ -23,7 +23,7 @@ import ch.unisg.executorpool.domain.ExecutorClass.ExecutorUri; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class AddNewExecutorToExecutorPoolSystemTest { - + @Autowired private TestRestTemplate restTemplate; @@ -39,17 +39,17 @@ public class AddNewExecutorToExecutorPoolSystemTest { ResponseEntity response = whenAddNewExecutorToEmptyPool(executorTaskType, executorUri); JSONObject responseJson = new JSONObject(response.getBody().toString()); - String respExecutorId = responseJson.getString("executorId"); + String respExecutorUri = responseJson.getString("executorUri"); String respExecutorTaskType = responseJson.getString("executorTaskType"); then(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); - then(respExecutorId).isNotEmpty(); + then(respExecutorUri).isEqualTo(executorUri.getValue().toString()); then(respExecutorTaskType).isEqualTo(executorTaskType.getValue()); then(ExecutorPool.getExecutorPool().getListOfExecutors().getValue()).hasSize(1); - } + } - private ResponseEntity whenAddNewExecutorToEmptyPool(ExecutorTaskType executorTaskType, + private ResponseEntity whenAddNewExecutorToEmptyPool(ExecutorTaskType executorTaskType, ExecutorUri executorUri) throws JSONException { ExecutorPool.getExecutorPool().getListOfExecutors().getValue().clear(); @@ -63,8 +63,8 @@ public class AddNewExecutorToExecutorPoolSystemTest { HttpEntity request = new HttpEntity<>(jsonPayLoad,headers); - return restTemplate.exchange("/executorpool/", HttpMethod.POST, request, Object.class); - + return restTemplate.exchange("/executor-pool/AddExecutor", HttpMethod.POST, request, Object.class); + } } diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java index 4d6417d..40b7307 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/AddNewExecutorToExecutorPoolWebControllerTest.java @@ -2,6 +2,7 @@ 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; @@ -27,7 +28,7 @@ import org.json.JSONObject; @WebMvcTest(controllers = AddNewExecutorToExecutorPoolWebController.class) public class AddNewExecutorToExecutorPoolWebControllerTest { - + @Autowired private MockMvc mockMvc; @@ -37,6 +38,9 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { @MockBean ExecutorRepository executorRepository; + @MockBean + LoadExecutorPort loadExecutorPort; + @Test void testAddNewExecutorToExecutorPool() throws Exception { @@ -55,7 +59,7 @@ public class AddNewExecutorToExecutorPoolWebControllerTest { .addNewExecutorToExecutorPool(addNewExecutorToExecutorPoolCommand)) .thenReturn(executorStub); - mockMvc.perform(post("/executorpool/") + mockMvc.perform(post("/executor-pool/AddExecutor") .contentType(ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE) .content(jsonPayLoad)) .andExpect(status().isCreated()); diff --git a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java index d94fd6a..a9df873 100644 --- a/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java +++ b/executor-pool/src/test/java/ch/unisg/executorpool/ExecutorPoolTest.java @@ -20,7 +20,7 @@ public class ExecutorPoolTest { void addNewExecutorToExecutorPoolSuccess() { ExecutorPool executorPool = ExecutorPool.getExecutorPool(); executorPool.getListOfExecutors().getValue().clear(); - ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , + ExecutorClass newExecutor = executorPool.addNewExecutor(new ExecutorUri(java.net.URI.create("example.com")) , new ExecutorTaskType("test-type")); assertThat(newExecutor.getExecutorTaskType().getValue()).isEqualTo("test-type"); @@ -31,26 +31,29 @@ public class ExecutorPoolTest { @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")); - ExecutorClass retrievedExecutor = executorPool.getExecutorByUri(newExecutor.getExecutorUri()).get(); + var retrievedExecutors = executorPool.getAllExecutorsByType(newExecutor.getExecutorTaskType()); - assertThat(retrievedExecutor).isEqualTo(newExecutor); + 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")); - ExecutorUri fakeUri = new ExecutorUri(java.net.URI.create("fake-Uri")); + var fakeType = new ExecutorTaskType("fake-type"); - Optional retrievedExecutor = executorPool.getExecutorByUri(fakeUri); + var retrievedExecutor = executorPool.getAllExecutorsByType(fakeType); - assertThat(retrievedExecutor.isPresent()).isFalse(); + assertThat(retrievedExecutor.size()).isEqualTo(0); } - + } -- 2.45.1 From 453cd37217dde79a1c882e5904d0325086766824 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 28 Nov 2021 18:20:36 +0100 Subject: [PATCH 7/7] chaos monkey tests --- .deployment/docker-compose.yml | 14 +- .../executor-computation/chaostoolkit.log | 266 +++++ .../executor-computation/disable.json | 24 + .../executor-computation/exception.json | 54 + .../executor-computation/journal.json | 113 +++ .../executor-computation/kill-restart.json | 45 + .../executor-computation/latency.json | 45 + .experiments/executor-computation/memory.json | 49 + .experiments/readme.md | 14 + .experiments/roster/chaostoolkit.log | 135 +++ .experiments/roster/disable.json | 24 + .experiments/roster/exception.json | 54 + .experiments/roster/journal.json | 113 +++ .experiments/roster/kill-restart.json | 45 + .experiments/roster/latency.json | 45 + .experiments/roster/memory.json | 49 + .experiments/tapas-tasks/chaostoolkit.log | 936 ++++++++++++++++++ .experiments/tapas-tasks/disable.json | 24 + .experiments/tapas-tasks/exception.json | 54 + .experiments/tapas-tasks/journal.json | 62 ++ .experiments/tapas-tasks/kill-restart.json | 45 + .experiments/tapas-tasks/latency.json | 45 + .experiments/tapas-tasks/memory.json | 49 + docker-compose-local.yml | 60 -- docker-compose.yaml | 129 +-- executor-base/pom.xml | 15 + .../web/ExecutionFinishedEventAdapter.java | 4 +- .../adapter/out/web/GetAssignmentAdapter.java | 4 +- .../out/web/NotifyExecutorPoolAdapter.java | 4 +- .../src/main/resources/application.properties | 12 + executor-computation/Dockerfile | 25 +- executor-computation/pom.xml | 15 + .../ExecutorcomputationApplication.java | 10 + .../src/main/resources/application.properties | 13 + executor-pool/Dockerfile | 8 +- .../executorpool/ExecutorPoolApplication.java | 10 + executor-robot/Dockerfile | 25 +- .../ExecutorrobotApplication.java | 10 + roster/Dockerfile | 25 +- roster/pom.xml | 16 + .../ch/unisg/roster/RosterApplication.java | 7 + .../out/web/PublishNewTaskEventAdapter.java | 4 +- .../web/PublishTaskAssignedEventAdapter.java | 2 +- .../web/PublishTaskCompletedEventAdapter.java | 2 +- .../src/main/resources/application.properties | 19 +- tapas-tasks/Dockerfile | 7 +- .../tapastasks/TapasTasksApplication.java | 2 - .../src/main/resources/application.properties | 23 +- 48 files changed, 2567 insertions(+), 188 deletions(-) create mode 100644 .experiments/executor-computation/chaostoolkit.log create mode 100644 .experiments/executor-computation/disable.json create mode 100644 .experiments/executor-computation/exception.json create mode 100644 .experiments/executor-computation/journal.json create mode 100644 .experiments/executor-computation/kill-restart.json create mode 100644 .experiments/executor-computation/latency.json create mode 100644 .experiments/executor-computation/memory.json create mode 100644 .experiments/readme.md create mode 100644 .experiments/roster/chaostoolkit.log create mode 100644 .experiments/roster/disable.json create mode 100644 .experiments/roster/exception.json create mode 100644 .experiments/roster/journal.json create mode 100644 .experiments/roster/kill-restart.json create mode 100644 .experiments/roster/latency.json create mode 100644 .experiments/roster/memory.json create mode 100644 .experiments/tapas-tasks/chaostoolkit.log create mode 100644 .experiments/tapas-tasks/disable.json create mode 100644 .experiments/tapas-tasks/exception.json create mode 100644 .experiments/tapas-tasks/journal.json create mode 100644 .experiments/tapas-tasks/kill-restart.json create mode 100644 .experiments/tapas-tasks/latency.json create mode 100644 .experiments/tapas-tasks/memory.json delete mode 100644 docker-compose-local.yml diff --git a/.deployment/docker-compose.yml b/.deployment/docker-compose.yml index 77a651c..ebe2b67 100644 --- a/.deployment/docker-compose.yml +++ b/.deployment/docker-compose.yml @@ -85,9 +85,9 @@ services: 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: @@ -130,8 +130,8 @@ services: 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`)" @@ -151,8 +151,8 @@ services: 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`)" diff --git a/.experiments/executor-computation/chaostoolkit.log b/.experiments/executor-computation/chaostoolkit.log new file mode 100644 index 0000000..58b69b8 --- /dev/null +++ b/.experiments/executor-computation/chaostoolkit.log @@ -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: : 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(': 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(': 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(': 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(': 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: : 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(': 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(': 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(': 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(': 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 diff --git a/.experiments/executor-computation/disable.json b/.experiments/executor-computation/disable.json new file mode 100644 index 0000000..62034df --- /dev/null +++ b/.experiments/executor-computation/disable.json @@ -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" + } + ] +} diff --git a/.experiments/executor-computation/exception.json b/.experiments/executor-computation/exception.json new file mode 100644 index 0000000..837dc38 --- /dev/null +++ b/.experiments/executor-computation/exception.json @@ -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": [] +} diff --git a/.experiments/executor-computation/journal.json b/.experiments/executor-computation/journal.json new file mode 100644 index 0000000..d2e34fe --- /dev/null +++ b/.experiments/executor-computation/journal.json @@ -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 +} \ No newline at end of file diff --git a/.experiments/executor-computation/kill-restart.json b/.experiments/executor-computation/kill-restart.json new file mode 100644 index 0000000..a2788a6 --- /dev/null +++ b/.experiments/executor-computation/kill-restart.json @@ -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": [] +} diff --git a/.experiments/executor-computation/latency.json b/.experiments/executor-computation/latency.json new file mode 100644 index 0000000..269bf1e --- /dev/null +++ b/.experiments/executor-computation/latency.json @@ -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": [] +} diff --git a/.experiments/executor-computation/memory.json b/.experiments/executor-computation/memory.json new file mode 100644 index 0000000..265675e --- /dev/null +++ b/.experiments/executor-computation/memory.json @@ -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": [] +} diff --git a/.experiments/readme.md b/.experiments/readme.md new file mode 100644 index 0000000..aecb0d6 --- /dev/null +++ b/.experiments/readme.md @@ -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 diff --git a/.experiments/roster/chaostoolkit.log b/.experiments/roster/chaostoolkit.log new file mode 100644 index 0000000..b2ad093 --- /dev/null +++ b/.experiments/roster/chaostoolkit.log @@ -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 diff --git a/.experiments/roster/disable.json b/.experiments/roster/disable.json new file mode 100644 index 0000000..0079712 --- /dev/null +++ b/.experiments/roster/disable.json @@ -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" + } + ] +} diff --git a/.experiments/roster/exception.json b/.experiments/roster/exception.json new file mode 100644 index 0000000..4f81e1c --- /dev/null +++ b/.experiments/roster/exception.json @@ -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": [] +} diff --git a/.experiments/roster/journal.json b/.experiments/roster/journal.json new file mode 100644 index 0000000..360012d --- /dev/null +++ b/.experiments/roster/journal.json @@ -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 +} \ No newline at end of file diff --git a/.experiments/roster/kill-restart.json b/.experiments/roster/kill-restart.json new file mode 100644 index 0000000..26be1ba --- /dev/null +++ b/.experiments/roster/kill-restart.json @@ -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": [] +} diff --git a/.experiments/roster/latency.json b/.experiments/roster/latency.json new file mode 100644 index 0000000..d755109 --- /dev/null +++ b/.experiments/roster/latency.json @@ -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": [] +} diff --git a/.experiments/roster/memory.json b/.experiments/roster/memory.json new file mode 100644 index 0000000..216c26b --- /dev/null +++ b/.experiments/roster/memory.json @@ -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": [] +} diff --git a/.experiments/tapas-tasks/chaostoolkit.log b/.experiments/tapas-tasks/chaostoolkit.log new file mode 100644 index 0000000..496062e --- /dev/null +++ b/.experiments/tapas-tasks/chaostoolkit.log @@ -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: : 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(': 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(': 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(': 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(': 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: : 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(': 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(': 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(': 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(': 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: : 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(': 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(': 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(': 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(': 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 diff --git a/.experiments/tapas-tasks/disable.json b/.experiments/tapas-tasks/disable.json new file mode 100644 index 0000000..2eafa32 --- /dev/null +++ b/.experiments/tapas-tasks/disable.json @@ -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" + } + ] +} diff --git a/.experiments/tapas-tasks/exception.json b/.experiments/tapas-tasks/exception.json new file mode 100644 index 0000000..8302ebe --- /dev/null +++ b/.experiments/tapas-tasks/exception.json @@ -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": [] +} diff --git a/.experiments/tapas-tasks/journal.json b/.experiments/tapas-tasks/journal.json new file mode 100644 index 0000000..abfb4b6 --- /dev/null +++ b/.experiments/tapas-tasks/journal.json @@ -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 +} \ No newline at end of file diff --git a/.experiments/tapas-tasks/kill-restart.json b/.experiments/tapas-tasks/kill-restart.json new file mode 100644 index 0000000..3145cb6 --- /dev/null +++ b/.experiments/tapas-tasks/kill-restart.json @@ -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": [] +} diff --git a/.experiments/tapas-tasks/latency.json b/.experiments/tapas-tasks/latency.json new file mode 100644 index 0000000..dc80c2f --- /dev/null +++ b/.experiments/tapas-tasks/latency.json @@ -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": [] +} diff --git a/.experiments/tapas-tasks/memory.json b/.experiments/tapas-tasks/memory.json new file mode 100644 index 0000000..813e302 --- /dev/null +++ b/.experiments/tapas-tasks/memory.json @@ -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": [] +} diff --git a/docker-compose-local.yml b/docker-compose-local.yml deleted file mode 100644 index 1ddfc24..0000000 --- a/docker-compose-local.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Dockerfile/Docker-Compose file based on an initial version authored by Alexander Lontke (ASSE, Fall Semester 2021) - -version: "3.7" - -services: - app: - build: - context: ./app - dockerfile: Dockerfile - # Use environment variables instead of application.properties - environment: - - KEY=VALUE - ports: #Just needed when testing from outside the docker network - - "8080:8080" - networks: - - tapas-network - - tapas-tasks: - build: - context: ./tapas-tasks - dockerfile: Dockerfile - # Use environment variables instead of application.properties - environment: - - KEY=VALUE - ports: #Just needed when testing from outside - - "8081:8081" - networks: - - tapas-network - - tapas-auction-house: - build: - context: ./tapas-auction-house - dockerfile: Dockerfile - # Use environment variables instead of application.properties - environment: - - KEY=VALUE - ports: #Just needed when testing from outside - - "8082:8082" - networks: - - tapas-network - - mongodb: - image: mongo - container_name: mongodb - restart: unless-stopped - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: 8nP7s0a # Can not be changed again later on - volumes: - - database:/data/db - networks: - - tapas-network - -#Volume for mongodb. One per server. -volumes: - database: - -networks: - tapas-network: - driver: bridge diff --git a/docker-compose.yaml b/docker-compose.yaml index 0612f50..c53981f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,65 +1,5 @@ version: "3.6" services: - # tapas-tasks: - # container_name: tapas-tasks - # build: - # context: "./tapas-tasks" - # dockerfile: "Dockerfile" - # target: development - # ports: - # - "8081:8081" - # - "5005:5005" - # volumes: - # - ./tapas-tasks/src:/opt/app/src - # - ./tapas-tasks/target:/opt/app/target - # assignment: - # container_name: assignment - # build: - # context: "./assignment" - # dockerfile: "Dockerfile" - # target: development - # ports: - # - "8082:8082" - # - "5006:5005" - # volumes: - # - ./assignment/src:/opt/app/src - # - ./assignment/target:/opt/app/target - # executor-pool: - # container_name: executor-pool - # build: - # context: "./executor-pool" - # dockerfile: "Dockerfile" - # target: development - # ports: - # - "8083:8083" - # - "5007:5005" - # volumes: - # - ./executor-pool/src:/opt/app/src - # - ./executor-pool/target:/opt/app/target - # executor1: - # container_name: executor1 - # 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" - # target: development - # ports: - # - "8085:8085" - # - "5009:5005" - # volumes: - # - ./executor2/src:/opt/app/src - # - ./executor2/target:/opt/app/target tapas-db: image: mongo restart: unless-stopped @@ -75,3 +15,72 @@ services: restart: unless-stopped ports: - "1883:1883" + tapas-tasks: + container_name: tapas-tasks + build: + context: "./tapas-tasks" + dockerfile: "Dockerfile" + target: development + ports: + - "8081:8081" + - "5005:5005" + depends_on: + - tapas-db + # - hivemq + volumes: + - ./tapas-tasks/src:/opt/app/src + - ./tapas-tasks/target:/opt/app/target + roster: + container_name: roster + build: + context: "." + dockerfile: "./roster/Dockerfile" + target: development + depends_on: + - tapas-db + # - hivemq + ports: + - "8082:8082" + - "5006:5005" + volumes: + - ./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 + executor-computation: + container_name: executor-computation + build: + 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: + - ./executor-robot/src:/opt/app/src + - ./executor-robot/target:/opt/app/target diff --git a/executor-base/pom.xml b/executor-base/pom.xml index 4ea8d2a..19dd365 100644 --- a/executor-base/pom.xml +++ b/executor-base/pom.xml @@ -66,6 +66,21 @@ common 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + chaos-monkey-spring-boot + 2.5.4 + + + + org.springframework.boot + spring-boot-test + diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java index 4321f72..f683b81 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java @@ -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()); diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java index 9d8013b..4df08dd 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java @@ -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()); diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java index bb38e66..4663d72 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/NotifyExecutorPoolAdapter.java @@ -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()); diff --git a/executor-base/src/main/resources/application.properties b/executor-base/src/main/resources/application.properties index 5056e10..fa1e940 100644 --- a/executor-base/src/main/resources/application.properties +++ b/executor-base/src/main/resources/application.properties @@ -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 diff --git a/executor-computation/Dockerfile b/executor-computation/Dockerfile index db90fb6..2186f3e 100644 --- a/executor-computation/Dockerfile +++ b/executor-computation/Dockerfile @@ -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"] diff --git a/executor-computation/pom.xml b/executor-computation/pom.xml index c319081..8692c3e 100644 --- a/executor-computation/pom.xml +++ b/executor-computation/pom.xml @@ -52,6 +52,21 @@ json 20210307 + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + chaos-monkey-spring-boot + 2.5.4 + + + + org.springframework.boot + spring-boot-test + diff --git a/executor-computation/src/main/java/ch/unisg/executorcomputation/ExecutorcomputationApplication.java b/executor-computation/src/main/java/ch/unisg/executorcomputation/ExecutorcomputationApplication.java index 81975ba..fe25430 100644 --- a/executor-computation/src/main/java/ch/unisg/executorcomputation/ExecutorcomputationApplication.java +++ b/executor-computation/src/main/java/ch/unisg/executorcomputation/ExecutorcomputationApplication.java @@ -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(); } diff --git a/executor-computation/src/main/resources/application.properties b/executor-computation/src/main/resources/application.properties index cd2d02b..c65664e 100644 --- a/executor-computation/src/main/resources/application.properties +++ b/executor-computation/src/main/resources/application.properties @@ -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 + diff --git a/executor-pool/Dockerfile b/executor-pool/Dockerfile index db90fb6..3590f11 100644 --- a/executor-pool/Dockerfile +++ b/executor-pool/Dockerfile @@ -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"] diff --git a/executor-pool/src/main/java/ch/unisg/executorpool/ExecutorPoolApplication.java b/executor-pool/src/main/java/ch/unisg/executorpool/ExecutorPoolApplication.java index 89847bb..c9137a0 100644 --- a/executor-pool/src/main/java/ch/unisg/executorpool/ExecutorPoolApplication.java +++ b/executor-pool/src/main/java/ch/unisg/executorpool/ExecutorPoolApplication.java @@ -1,5 +1,7 @@ package ch.unisg.executorpool; +import java.util.concurrent.TimeUnit; + import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +21,14 @@ public class ExecutorPoolApplication { 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); } diff --git a/executor-robot/Dockerfile b/executor-robot/Dockerfile index db90fb6..2186f3e 100644 --- a/executor-robot/Dockerfile +++ b/executor-robot/Dockerfile @@ -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"] diff --git a/executor-robot/src/main/java/ch/unisg/executorrobot/ExecutorrobotApplication.java b/executor-robot/src/main/java/ch/unisg/executorrobot/ExecutorrobotApplication.java index fcee5ee..79a204f 100644 --- a/executor-robot/src/main/java/ch/unisg/executorrobot/ExecutorrobotApplication.java +++ b/executor-robot/src/main/java/ch/unisg/executorrobot/ExecutorrobotApplication.java @@ -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(); } diff --git a/roster/Dockerfile b/roster/Dockerfile index db90fb6..fab5287 100644 --- a/roster/Dockerfile +++ b/roster/Dockerfile @@ -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"] + + + diff --git a/roster/pom.xml b/roster/pom.xml index 0f5c39e..8514b7b 100644 --- a/roster/pom.xml +++ b/roster/pom.xml @@ -85,6 +85,22 @@ + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + chaos-monkey-spring-boot + 2.5.4 + + + + org.springframework.boot + spring-boot-test + + + diff --git a/roster/src/main/java/ch/unisg/roster/RosterApplication.java b/roster/src/main/java/ch/unisg/roster/RosterApplication.java index e21a679..7eaa13a 100644 --- a/roster/src/main/java/ch/unisg/roster/RosterApplication.java +++ b/roster/src/main/java/ch/unisg/roster/RosterApplication.java @@ -1,6 +1,7 @@ package ch.unisg.roster; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; @@ -34,6 +35,12 @@ public class RosterApplication { public static void main(String[] args) { + try { + TimeUnit.SECONDS.sleep(10); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } SpringApplication rosterApp = new SpringApplication(RosterApplication.class); ENVIRONMENT = rosterApp.run(args).getEnvironment(); bootstrapMarketplaceWithMqtt(); diff --git a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishNewTaskEventAdapter.java b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishNewTaskEventAdapter.java index c16961f..3349522 100644 --- a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishNewTaskEventAdapter.java +++ b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishNewTaskEventAdapter.java @@ -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()); diff --git a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskAssignedEventAdapter.java b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskAssignedEventAdapter.java index 105d464..d83c9c2 100644 --- a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskAssignedEventAdapter.java +++ b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskAssignedEventAdapter.java @@ -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()); diff --git a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskCompletedEventAdapter.java b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskCompletedEventAdapter.java index 50d72ae..8ea95ec 100644 --- a/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskCompletedEventAdapter.java +++ b/roster/src/main/java/ch/unisg/roster/roster/adapter/out/web/PublishTaskCompletedEventAdapter.java @@ -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()); diff --git a/roster/src/main/resources/application.properties b/roster/src/main/resources/application.properties index d90d1c3..ea6544a 100644 --- a/roster/src/main/resources/application.properties +++ b/roster/src/main/resources/application.properties @@ -1,8 +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 diff --git a/tapas-tasks/Dockerfile b/tapas-tasks/Dockerfile index db90fb6..ffea3e9 100644 --- a/tapas-tasks/Dockerfile +++ b/tapas-tasks/Dockerfile @@ -2,7 +2,8 @@ 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 COPY .mvn/ .mvn COPY mvnw pom.xml mvnw.cmd ./ @@ -10,9 +11,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"] diff --git a/tapas-tasks/src/main/java/ch/unisg/tapastasks/TapasTasksApplication.java b/tapas-tasks/src/main/java/ch/unisg/tapastasks/TapasTasksApplication.java index 78a6145..1df34a9 100644 --- a/tapas-tasks/src/main/java/ch/unisg/tapastasks/TapasTasksApplication.java +++ b/tapas-tasks/src/main/java/ch/unisg/tapastasks/TapasTasksApplication.java @@ -13,8 +13,6 @@ public class TapasTasksApplication { SpringApplication tapasTasksApp = new SpringApplication(TapasTasksApplication.class); tapasTasksApp.run(args); - - } } diff --git a/tapas-tasks/src/main/resources/application.properties b/tapas-tasks/src/main/resources/application.properties index 69f84ad..2a86652 100644 --- a/tapas-tasks/src/main/resources/application.properties +++ b/tapas-tasks/src/main/resources/application.properties @@ -6,7 +6,7 @@ baseuri=https://tapas-tasks.86-119-34-23.nip.io/ roster.uri=http://127.0.0.1:8082 spring.profiles.active=chaos-monkey -chaos.monkey.enabled=true +chaos.monkey.enabled=false management.endpoint.chaosmonkey.enabled=true management.endpoint.chaosmonkeyjmx.enabled=true # include specific endpoints @@ -16,24 +16,3 @@ chaos.monkey.watcher.restController=true chaos.monkey.watcher.service=true chaos.monkey.watcher.repository=true chaos.monkey.watcher.component=true - -#Chaos Monkey configs taken from here: https://www.baeldung.com/spring-boot-chaos-monkey - -#Latency Assault -#chaos.monkey.assaults.latencyActive=true -#chaos.monkey.assaults.latencyRangeStart=3000 -#chaos.monkey.assaults.latencyRangeEnd=15000 - -#Exception Assault -#chaos.monkey.assaults.latencyActive=false -#chaos.monkey.assaults.exceptionsActive=true -#chaos.monkey.assaults.killApplicationActive=false - -#AppKiller Assault -#chaos.monkey.assaults.latencyActive=false -#chaos.monkey.assaults.exceptionsActive=false -#chaos.monkey.assaults.killApplicationActive=true - -#Chaos Monkey assaults via REST to endpoint /actuator/chaosmonkey/assaults/ -#https://softwarehut.com/blog/tech/chaos-monkey -#https://codecentric.github.io/chaos-monkey-spring-boot/latest/ -- 2.45.1