Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 39e0924

Browse files
Merge pull request #162 from zacharygoodwin/PROC-1479
PROC-1479: Add force logging field
2 parents e3b0c8e + 1a50cc4 commit 39e0924

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

proctor-common/src/main/java/com/indeed/proctor/common/model/ConsumableTestDefinition.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class ConsumableTestDefinition {
3636
private boolean evaluateForIncognitoUsers = false;
3737
private boolean enableUnitlessAllocations = false;
3838
private boolean containsUnitlessAllocation = false;
39+
private boolean forceLogging = false;
3940

4041
public ConsumableTestDefinition() {
4142
/* intentionally empty */
@@ -139,7 +140,8 @@ private ConsumableTestDefinition(
139140
@Nullable final TestDependency dependsOn,
140141
final boolean evaluateForIncognitoUsers,
141142
final boolean enableUnitlessAllocations,
142-
final boolean containsUnitlessAllocation) {
143+
final boolean containsUnitlessAllocation,
144+
final boolean forceLogging) {
143145
this.constants = constants;
144146
this.version = version;
145147
this.salt = salt;
@@ -154,6 +156,7 @@ private ConsumableTestDefinition(
154156
this.evaluateForIncognitoUsers = evaluateForIncognitoUsers;
155157
this.enableUnitlessAllocations = enableUnitlessAllocations;
156158
this.containsUnitlessAllocation = containsUnitlessAllocation;
159+
this.forceLogging = forceLogging;
157160
}
158161

159162
@Nonnull
@@ -287,6 +290,14 @@ public void setContainsUnitlessAllocation(final boolean containsUnitlessAllocati
287290
this.containsUnitlessAllocation = containsUnitlessAllocation;
288291
}
289292

293+
public boolean getForceLogging() {
294+
return forceLogging;
295+
}
296+
297+
public void setForceLogging(final boolean forceLogging) {
298+
this.forceLogging = forceLogging;
299+
}
300+
290301
@Nonnull
291302
public static ConsumableTestDefinition fromTestDefinition(@Nonnull final TestDefinition td) {
292303
final Map<String, Object> specialConstants = td.getSpecialConstants();
@@ -342,6 +353,7 @@ public static ConsumableTestDefinition fromTestDefinition(@Nonnull final TestDef
342353
td.getDependsOn(),
343354
td.getEvaluateForIncognitoUsers(),
344355
td.getEnableUnitlessAllocations(),
345-
containsUnitlessAllocation);
356+
containsUnitlessAllocation,
357+
td.getForceLogging());
346358
}
347359
}

proctor-common/src/main/java/com/indeed/proctor/common/model/TestDefinition.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class TestDefinition {
5555

5656
private boolean enableUnitlessAllocations;
5757

58+
private boolean forceLogging;
59+
5860
public TestDefinition() {
5961
/* intentionally empty */
6062
}
@@ -138,6 +140,7 @@ public TestDefinition(
138140
this.description = description;
139141
this.metaTags = metaTags;
140142
this.evaluateForIncognitoUsers = false;
143+
this.forceLogging = false;
141144
}
142145

143146
public TestDefinition(@Nonnull final TestDefinition other) {
@@ -159,6 +162,7 @@ private TestDefinition(@Nonnull final Builder builder) {
159162
dependsOn = builder.dependsOn;
160163
evaluateForIncognitoUsers = builder.evaluateForIncognitoUsers;
161164
enableUnitlessAllocations = builder.enableUnitlessAllocations;
165+
forceLogging = builder.forceLogging;
162166
}
163167

164168
public static Builder builder() {
@@ -324,6 +328,10 @@ public boolean getEnableUnitlessAllocations() {
324328
return enableUnitlessAllocations;
325329
}
326330

331+
public boolean getForceLogging() {
332+
return forceLogging;
333+
}
334+
327335
@Override
328336
public String toString() {
329337
return "TestDefinition{"
@@ -359,6 +367,8 @@ public String toString() {
359367
+ evaluateForIncognitoUsers
360368
+ ", enableUnitlessAllocations="
361369
+ enableUnitlessAllocations
370+
+ ", forceLogging="
371+
+ forceLogging
362372
+ '}';
363373
}
364374

@@ -392,7 +402,8 @@ public int hashCode() {
392402
metaTags,
393403
dependsOn,
394404
evaluateForIncognitoUsers,
395-
enableUnitlessAllocations);
405+
enableUnitlessAllocations,
406+
forceLogging);
396407
}
397408

398409
/**
@@ -424,7 +435,8 @@ && bucketListEqual(buckets, that.buckets)
424435
&& Objects.equals(metaTags, that.metaTags)
425436
&& Objects.equals(dependsOn, that.dependsOn)
426437
&& Objects.equals(evaluateForIncognitoUsers, that.evaluateForIncognitoUsers)
427-
&& Objects.equals(enableUnitlessAllocations, that.enableUnitlessAllocations);
438+
&& Objects.equals(enableUnitlessAllocations, that.enableUnitlessAllocations)
439+
&& Objects.equals(forceLogging, that.forceLogging);
428440
}
429441

430442
@VisibleForTesting
@@ -465,6 +477,7 @@ public static class Builder {
465477
private TestDependency dependsOn;
466478
private boolean evaluateForIncognitoUsers;
467479
private boolean enableUnitlessAllocations;
480+
private boolean forceLogging;
468481

469482
public Builder from(@Nonnull final TestDefinition other) {
470483
setVersion(other.version);
@@ -481,6 +494,7 @@ public Builder from(@Nonnull final TestDefinition other) {
481494
setDependsOn(other.dependsOn);
482495
setEvaluateForIncognitoUsers(other.evaluateForIncognitoUsers);
483496
setEnableUnitlessAllocations(other.enableUnitlessAllocations);
497+
setForceLogging(other.forceLogging);
484498
return this;
485499
}
486500

@@ -589,6 +603,11 @@ public Builder setEnableUnitlessAllocations(final boolean enableUnitlessAllocati
589603
return this;
590604
}
591605

606+
public Builder setForceLogging(final boolean forceLogging) {
607+
this.forceLogging = forceLogging;
608+
return this;
609+
}
610+
592611
public TestDefinition build() {
593612
return new TestDefinition(this);
594613
}

proctor-common/src/test/java/com/indeed/proctor/common/model/TestTestDefinition.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ public void testBuilder() {
274274
.setMetaTags(metatags)
275275
.setDependsOn(dependsOn)
276276
.setEvaluateForIncognitoUsers(incognito)
277+
.setForceLogging(true)
277278
.build();
278279

279280
final TestDefinition definition2 = TestDefinition.builder().from(definition1).build();
@@ -292,6 +293,7 @@ public void testBuilder() {
292293
assertThat(definition.getMetaTags()).isEqualTo(metatags);
293294
assertThat(definition.getDependsOn()).isEqualTo(dependsOn);
294295
assertThat(definition.getEvaluateForIncognitoUsers()).isEqualTo(incognito);
296+
assertThat(definition.getEvaluateForIncognitoUsers()).isEqualTo(true);
295297
}
296298
}
297299
}

0 commit comments

Comments
 (0)