-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(canary): Fix Canary Indefinitely Retrying (#776)
If you were to supply a config with no metrics, orca would loop indefinitely as it waited for non existent stages to finish (#776)
- Loading branch information
1 parent
44346d1
commit f2a3302
Showing
3 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
kayenta-web/src/test/java/com/netflix/kayenta/controllers/CanaryControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.netflix.kayenta.controllers; | ||
|
||
import static org.hamcrest.core.StringContains.containsString; | ||
import static org.mockito.Mockito.when; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; | ||
|
||
import com.netflix.kayenta.canary.CanaryConfig; | ||
import com.netflix.kayenta.storage.ObjectType; | ||
import org.junit.Test; | ||
|
||
public class CanaryControllerTest extends BaseControllerTest { | ||
|
||
private static final String CONFIG_ID = "canary_config_12345"; | ||
|
||
@Test | ||
public void initiateCanary_failsIfNoMetricsSpecified() throws Exception { | ||
CanaryConfig response = CanaryConfig.builder().application("test-app").build(); | ||
when(storageService.loadObject(CONFIGS_ACCOUNT, ObjectType.CANARY_CONFIG, CONFIG_ID)) | ||
.thenReturn(response); | ||
|
||
this.mockMvc | ||
.perform( | ||
post("/canary/{configId}?application=test-app", CONFIG_ID) | ||
.contentType("application/json") | ||
.content( | ||
"{\"scopes\":{\"default\":{\"controlScope\":{\"scope\":\"testapp-baseline\",\"location\":\"us-east-1\",\"start\":\"2020-07-27T19:17:36Z\",\"end\":\"2020-07-27T19:21:36Z\",\"step\":60,\"extendedScopeParams\":{\"type\":\"cluster\",\"environment\":\"prod\",\"dataset\":\"regional\",\"deployment\":\"main\"}},\"experimentScope\":{\"scope\":\"testapp-canary\",\"location\":\"us-east-1\",\"start\":\"2020-07-27T19:17:36Z\",\"end\":\"2020-07-27T19:21:36Z\",\"step\":60,\"extendedScopeParams\":{\"type\":\"cluster\",\"environment\":\"prod\",\"dataset\":\"regional\",\"deployment\":\"main\"}}}},\"thresholds\":{\"pass\":95.0,\"marginal\":75.0}}")) | ||
.andDo(print()) | ||
.andExpect(status().is4xxClientError()) | ||
.andExpect(content().contentType("application/json")) | ||
.andExpect(jsonPath("$.message").value(containsString("at least one metric"))); | ||
} | ||
} |