aboutsummaryrefslogtreecommitdiffstats
path: root/configserver-flags
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2019-10-22 00:28:22 +0200
committerHåkon Hallingstad <hakon@verizonmedia.com>2019-10-22 00:28:22 +0200
commitc29b374c582c8b112a6e95150e5d4a460dc30464 (patch)
treea9ec0e5bb3a388d6c30199bd3b89b07b1bcb716e /configserver-flags
parentfef3449937c173ef8128b6085829e0bbe3f97ce4 (diff)
Support flag conditions based on Vespa release
Supports a "relational" condition with a new dimension "vespa-version", that can be satisfied with e.g. "predicate": ">= 7.120.5" as long as the condition is evaluated in a JVM that has a Vtag at least high as 7.120.5. The typical use-case for this condition would be: The developer has used the flag to test and verify the feature is ready to roll out globally. The developer can now roll the feature with the next release, and ORCHESTRATED, halting if anything goes wrong like any normal rollout. This also allows one-shot tests of a feature flag in integration tests: Just enable it for an upcoming version with predicate "== 7.x.y".
Diffstat (limited to 'configserver-flags')
-rw-r--r--configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/db/FlagsDbImplTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/db/FlagsDbImplTest.java b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/db/FlagsDbImplTest.java
index 7460e42c866..e366c012a9e 100644
--- a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/db/FlagsDbImplTest.java
+++ b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/db/FlagsDbImplTest.java
@@ -8,12 +8,15 @@ import com.yahoo.vespa.flags.JsonNodeRawFlag;
import com.yahoo.vespa.flags.json.Condition;
import com.yahoo.vespa.flags.json.FlagData;
import com.yahoo.vespa.flags.json.Rule;
+import com.yahoo.vespa.flags.json.WhitelistCondition;
import org.junit.Test;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
@@ -29,7 +32,8 @@ public class FlagsDbImplTest {
MockCurator curator = new MockCurator();
FlagsDbImpl db = new FlagsDbImpl(curator);
- Condition condition1 = new Condition(Condition.Type.WHITELIST, FetchVector.Dimension.HOSTNAME, "host1");
+ var params = new Condition.CreateParams(FetchVector.Dimension.HOSTNAME, List.of("host1"), Optional.empty());
+ Condition condition1 = new WhitelistCondition(params);
Rule rule1 = new Rule(Optional.of(JsonNodeRawFlag.fromJson("13")), condition1);
FlagId flagId = new FlagId("id");
FlagData data = new FlagData(flagId, new FetchVector().with(FetchVector.Dimension.ZONE_ID, "zone-a"), rule1);