Commit d8b62d08 authored by Mayank Saggar [Microsoft]'s avatar Mayank Saggar [Microsoft] Committed by Vineeth Guna [Microsoft]
Browse files

MR suggested changes

parent a508a416
Pipeline #17864 failed with stages
in 7 minutes and 1 second
......@@ -23,18 +23,16 @@ public class CreateWorkflowTestsBuilder {
public static final String WORKFLOW_CONCURRENT_TASK_RUN_FIELD = "concurrentTaskRun";
public static final String WORKFLOW_ACTIVE_FIELD = "active";
public static String getValidCreateWorkflowRequest(String dagName) throws Exception{
public static String getValidCreateWorkflowRequest(String dagName, String dagTemplateName) throws Exception{
String workflowName = getUniqueWorkflowName(dagName);
String dagTemplateName = dagName + ".py";
Map<String, String> dagTemplateContext = new HashMap<>();
dagTemplateContext.put("dagId", workflowName);
String dagContent = TestResourceProvider.getDAGFileContent(dagTemplateName, dagTemplateContext);
return new Gson().toJson(buildCreateWorkflowRequest(workflowName, dagContent));
}
public static String getInvalidCreateWorkflowRequest(String dagName) throws Exception{
public static String getInvalidCreateWorkflowRequest(String dagName, String dagTemplateName) throws Exception{
String workflowName = getUniqueWorkflowName(dagName);
String dagTemplateName = dagName + ".py";
Map<String, String> dagTemplateContext = new HashMap<>();
dagTemplateContext.put("dagId", workflowName);
String dagContent = TestResourceProvider.getDAGFileContent(dagTemplateName, dagTemplateContext);
......
......@@ -22,6 +22,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
public static final String CREATE_WORKFLOW_INVALID_REQUEST_MESSAGE = "Invalid JSON input: Unrecognized field";
public static final String WORKFLOW_NAME_CONFLICT_MESSAGE = "Resource with specified id or name already exists.";
public static final String TEST_WORKFLOW_FILE_NAME = "test_simple_python_dag.py" ;
@Test
public void should_returnSuccess_when_givenValidRequest() throws Exception{
......@@ -61,7 +62,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
@Test
public void should_returnBadRequest_when_givenInvalidRequest() throws Exception{
String createWorkflowRequestBody = getInvalidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG);
String createWorkflowRequestBody = getInvalidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG, TEST_WORKFLOW_FILE_NAME);
ClientResponse response = client.send(
HttpMethod.POST,
......@@ -80,7 +81,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
@Test
public void should_returnWorkflowExists_when_givenDuplicateRequest() throws Exception{
String createWorkflowRequestBody = getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG);
String createWorkflowRequestBody = getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG, TEST_WORKFLOW_FILE_NAME);
ClientResponse response = client.send(
HttpMethod.POST,
......@@ -112,7 +113,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
ClientResponse response = client.send(
HttpMethod.POST,
CREATE_WORKFLOW_URL,
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG),
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG, TEST_WORKFLOW_FILE_NAME),
headers,
null
);
......@@ -125,7 +126,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
ClientResponse response = client.send(
HttpMethod.POST,
CREATE_WORKFLOW_URL,
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG),
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG, TEST_WORKFLOW_FILE_NAME),
headers,
client.getNoDataAccessToken()
);
......@@ -138,7 +139,7 @@ public abstract class PostCreateWorkflowIntegrationTests extends TestBase {
ClientResponse response = client.send(
HttpMethod.POST,
CREATE_WORKFLOW_URL,
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG),
getValidCreateWorkflowRequest(TEST_SIMPLE_PYTHON_DAG, TEST_WORKFLOW_FILE_NAME),
HTTPClient.overrideHeader(headers, INVALID_PARTITION),
client.getAccessToken()
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment