Add test for optional run ID in job meta
@@ -530,6 +530,28 @@ public class MarquezClientTest {
assertThat(job).isEqualTo(JOB);
}
+ @Test
+ public void testCreateJobWithRunId() throws Exception {
+ final URL url = buildUrlFor("/namespaces/%s/jobs/%s", NAMESPACE_NAME, JOB_NAME);
+
+ final JobMeta meta =
+ JobMeta.builder()
+ .type(JOB_TYPE)
+ .inputs(INPUTS)
+ .outputs(OUTPUTS)
+ .location(LOCATION)
+ .description(JOB_DESCRIPTION)
+ .context(JOB_CONTEXT)
+ .runId(newRunId())
+ .build();
+ final String metaAsJson = JsonGenerator.newJsonFor(meta);
+ final String jobAsJson = JsonGenerator.newJsonFor(JOB);
+ when(http.put(url, metaAsJson)).thenReturn(jobAsJson);
+
+ final Job job = client.createJob(NAMESPACE_NAME, JOB_NAME, meta);
+ assertThat(job).isEqualTo(JOB);
+ }
+
@Test
public void testGetJob() throws Exception {
final URL url = buildUrlFor("/namespaces/%s/jobs/%s", NAMESPACE_NAME, JOB_NAME);
