Skip to content

Commit 828d501

Browse files
jkebingerclaude
andauthored
Update integration test data repository to ReforgeHQ (#2)
* Update integration test data repository to ReforgeHQ - Change submodule URL from prefab-cloud/prefab-cloud-integration-test-data - to ReforgeHQ/integration-test-data - Use SSH URL for better access control 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Update submodule version * Add support for reforge.current-time alongside prefab.current-time Adds reforge.current-time as an alternative to prefab.current-time for criterion evaluation in ConfigRuleEvaluator. Both keys now return the current system timestamp in milliseconds when used in configuration rules. Changes: - Add REFORGE_CURRENT_TIME_KEY constant for "reforge.current-time" - Update getPropFromContext() to check both prefab and reforge current-time keys - Add comprehensive test case validating both positive and negative scenarios This maintains backward compatibility while supporting the new reforge branding. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Support reforge_api_url in integration test client overrides Replace prefab_api_url with reforge_api_url in IntegrationTestClientOverrides to support the updated test data format. This fixes parsing errors in integration tests that were using the new field name. - Update IntegrationTestClientOverrides to accept reforge_api_url instead of prefab_api_url - Update BaseIntegrationTestCaseDescriptor to use getReforgeApiUrl() - Update integration test data submodule to latest version 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d69bd25 commit 828d501

File tree

6 files changed

+48
-9
lines changed

6 files changed

+48
-9
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = https://github.com/prefab-cloud/prefab-cloud.git
44
[submodule "integration-test-data"]
55
path = sdk/src/test/resources/shared-integration-test-data
6-
url = https://github.com/prefab-cloud/prefab-cloud-integration-test-data.git
6+
url = git@github.com:ReforgeHQ/integration-test-data.git

sdk/src/main/java/com/reforge/sdk/internal/ConfigRuleEvaluator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
public class ConfigRuleEvaluator {
3232

3333
public static final String CURRENT_TIME_KEY = "prefab.current-time";
34+
public static final String REFORGE_CURRENT_TIME_KEY = "reforge.current-time";
3435
private static final Logger LOG = LoggerFactory.getLogger(ConfigRuleEvaluator.class);
3536

3637
private final ConfigStore configStore;
@@ -241,7 +242,7 @@ private Optional<Prefab.ConfigValue> prop(
241242
}
242243
}
243244
//TODO: move this current time injection into a ContextResolver class?
244-
if (CURRENT_TIME_KEY.equals(key)) {
245+
if (CURRENT_TIME_KEY.equals(key) || REFORGE_CURRENT_TIME_KEY.equals(key)) {
245246
return Optional.of(
246247
Prefab.ConfigValue.newBuilder().setInt(System.currentTimeMillis()).build()
247248
);

sdk/src/test/java/com/reforge/sdk/integration/BaseIntegrationTestCaseDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private Sdk buildClient(IntegrationTestClientOverrides clientOverrides) {
9393
.getInitTimeoutSeconds()
9494
.ifPresent(options::setInitializationTimeoutSec);
9595
clientOverrides
96-
.getPrefabApiUrl()
96+
.getReforgeApiUrl()
9797
.ifPresent(host -> options.setApiHosts(List.of(host)));
9898
clientOverrides.getOnInitFailure().ifPresent(options::setOnInitializationFailure);
9999
clientOverrides.getContextUploadMode().ifPresent(options::setContextUploadMode);

sdk/src/test/java/com/reforge/sdk/integration/IntegrationTestClientOverrides.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class IntegrationTestClientOverrides {
1010
private final Optional<String> namespace;
1111
private final Optional<Integer> onNoDefault;
1212
private final Optional<Integer> initTimeoutSeconds;
13-
private final Optional<String> prefabApiUrl;
13+
private final Optional<String> reforgeApiUrl;
1414
private final Optional<Options.OnInitializationFailure> onInitFailure;
1515
private final Optional<String> aggregator;
1616
private final Optional<Options.CollectContextMode> contextUploadMode;
@@ -20,15 +20,15 @@ public IntegrationTestClientOverrides(
2020
@JsonProperty("namespace") Optional<String> namespace,
2121
@JsonProperty("on_no_default") Optional<Integer> onNoDefault,
2222
@JsonProperty("initialization_timeout_sec") Optional<Integer> initTimeoutSeconds,
23-
@JsonProperty("prefab_api_url") Optional<String> prefabApiUrl,
23+
@JsonProperty("reforge_api_url") Optional<String> reforgeApiUrl,
2424
@JsonProperty("on_init_failure") Optional<String> onInitFailure,
2525
@JsonProperty("aggregator") Optional<String> aggregator,
2626
@JsonProperty("context_upload_mode") Optional<String> contextUploadMode
2727
) {
2828
this.namespace = namespace;
2929
this.onNoDefault = onNoDefault;
3030
this.initTimeoutSeconds = initTimeoutSeconds;
31-
this.prefabApiUrl = prefabApiUrl;
31+
this.reforgeApiUrl = reforgeApiUrl;
3232
this.onInitFailure =
3333
onInitFailure.map(text -> {
3434
if (":return".equals(text)) {
@@ -83,8 +83,8 @@ public Optional<Integer> getInitTimeoutSeconds() {
8383
return initTimeoutSeconds;
8484
}
8585

86-
public Optional<String> getPrefabApiUrl() {
87-
return prefabApiUrl;
86+
public Optional<String> getReforgeApiUrl() {
87+
return reforgeApiUrl;
8888
}
8989

9090
public Optional<Options.OnInitializationFailure> getOnInitFailure() {

sdk/src/test/java/com/reforge/sdk/internal/ConfigRuleEvaluatorTest.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,44 @@ public void testTimeAfterRange() {
579579
assertThat(eval.isMatch()).isFalse();
580580
}
581581

582+
@Test
583+
public void testReforgeCurrentTimeKey() {
584+
// Test that reforge.current-time works the same as prefab.current-time
585+
final Prefab.Criterion reforgeTimeCriterion = Prefab.Criterion
586+
.newBuilder()
587+
.setPropertyName(ConfigRuleEvaluator.REFORGE_CURRENT_TIME_KEY)
588+
.setValueToMatch(
589+
Prefab.ConfigValue.newBuilder().setIntRange(Prefab.IntRange.newBuilder().build())
590+
)
591+
.setOperator(Prefab.Criterion.CriterionOperator.IN_INT_RANGE)
592+
.build();
593+
final EvaluatedCriterion reforgeEval = evaluator
594+
.evaluateCriterionMatch(reforgeTimeCriterion, LookupContext.EMPTY)
595+
.stream()
596+
.findFirst()
597+
.get();
598+
assertThat(reforgeEval.isMatch()).isTrue();
599+
600+
// Also test that we can use it with a specific time range that should not match current time
601+
long pastTime = System.currentTimeMillis() - 60000; // 1 minute ago
602+
final Prefab.Criterion pastRangeCriterion = Prefab.Criterion
603+
.newBuilder()
604+
.setPropertyName(ConfigRuleEvaluator.REFORGE_CURRENT_TIME_KEY)
605+
.setValueToMatch(
606+
Prefab.ConfigValue
607+
.newBuilder()
608+
.setIntRange(Prefab.IntRange.newBuilder().setStart(0).setEnd(pastTime).build())
609+
)
610+
.setOperator(Prefab.Criterion.CriterionOperator.IN_INT_RANGE)
611+
.build();
612+
final EvaluatedCriterion pastEval = evaluator
613+
.evaluateCriterionMatch(pastRangeCriterion, LookupContext.EMPTY)
614+
.stream()
615+
.findFirst()
616+
.get();
617+
assertThat(pastEval.isMatch()).isFalse();
618+
}
619+
582620
public static Stream<Arguments> comparisonArguments() {
583621
return Stream.of(
584622
Arguments.of(

0 commit comments

Comments
 (0)