Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Improve the validation rules in the integration tests (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbak authored Nov 19, 2021
1 parent f19eb9c commit 1452c3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.RuleChain;

import static com.netflix.titus.api.jobmanager.model.job.JobFunctions.appendJobDescriptorAttribute;
import static com.netflix.titus.master.integration.v3.scenario.JobAsserts.podWithEfsMounts;
import static com.netflix.titus.master.integration.v3.scenario.JobAsserts.podWithResources;
import static com.netflix.titus.testkit.embedded.cell.EmbeddedTitusCells.basicKubeCell;
Expand Down Expand Up @@ -81,13 +80,12 @@ public void tearDown() throws Exception {
*/
@Test(timeout = 30_000)
public void testSubmitSimpleBatchJobWhichEndsOk() {
JobDescriptor<BatchJobExt> tmpJob =
appendJobDescriptorAttribute(ONE_TASK_BATCH_JOB, JobAttributes.JOB_ATTRIBUTES_CREATED_BY, "embeddedFederationClient");
tmpJob = appendJobDescriptorAttribute(tmpJob, JobAttributes.JOB_ATTRIBUTE_ROUTING_CELL, "embeddedCell");
final JobDescriptor<BatchJobExt> expectedJob = tmpJob;

jobsScenarioBuilder.schedule(ONE_TASK_BATCH_JOB, jobScenarioBuilder -> jobScenarioBuilder
.inStrippedJob(job -> assertThat(job.getJobDescriptor()).isEqualTo(expectedJob))
.inJob(job -> {
assertThat(job.getJobDescriptor().getAttributes().containsKey(JobAttributes.JOB_ATTRIBUTE_ROUTING_CELL));
assertThat(job.getJobDescriptor().getAttributes().containsKey(JobAttributes.JOB_ATTRIBUTES_CREATED_BY));
})
.inStrippedJob(job -> assertThat(job.getJobDescriptor()).isEqualTo(ONE_TASK_BATCH_JOB))
.template(ScenarioTemplates.startTasksInNewJob())
.assertEachPod(
podWithResources(ONE_TASK_BATCH_JOB.getContainer().getContainerResources(), jobConfiguration.getMinDiskSizeMB()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.google.common.collect.Multimaps;
import com.google.protobuf.Empty;
import com.google.protobuf.UInt32Value;
import com.netflix.titus.api.jobmanager.JobAttributes;
import com.netflix.titus.api.jobmanager.model.job.Capacity;
import com.netflix.titus.api.jobmanager.model.job.Job;
import com.netflix.titus.api.jobmanager.model.job.JobDescriptor;
Expand Down Expand Up @@ -551,7 +552,9 @@ public JobScenarioBuilder inStrippedJob(Consumer<Job<?>> consumer) {
// Remove diagnostic data added by the job replicator.
Map<String, String> filteredAttributes = new HashMap<>();
job.getJobDescriptor().getAttributes().forEach((key, value) -> {
if (!key.startsWith("event.propagation")) {
if (!key.startsWith("event.propagation")
&& !key.equals(JobAttributes.JOB_ATTRIBUTES_CREATED_BY)
&& !key.equals(JobAttributes.JOB_ATTRIBUTE_ROUTING_CELL)) {
filteredAttributes.put(key, value);
}
});
Expand Down

0 comments on commit 1452c3b

Please sign in to comment.