diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9cda20bf9ae..298cf0f3bf5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -116,7 +116,8 @@ **/DataStreams* @DataDog/data-streams-monitoring # @DataDog/feature-flagging-and-experimentation-sdk -/products/feature-flagging/ @DataDog/feature-flagging-and-experimentation-sdk +/dd-smoke-tests/openfeature/ @DataDog/feature-flagging-and-experimentation-sdk +/products/feature-flagging/ @DataDog/feature-flagging-and-experimentation-sdk # @DataDog/profiling-java /dd-java-agent/agent-profiling/ @DataDog/profiling-java diff --git a/dd-smoke-tests/openfeature/build.gradle b/dd-smoke-tests/openfeature/build.gradle new file mode 100644 index 00000000000..6cf875acb5a --- /dev/null +++ b/dd-smoke-tests/openfeature/build.gradle @@ -0,0 +1,38 @@ +import org.springframework.boot.gradle.tasks.bundling.BootJar + +plugins { + id 'java' + id 'org.springframework.boot' version '2.7.15' + id 'io.spring.dependency-management' version '1.0.15.RELEASE' +} + +ext { + minJavaVersionForTests = JavaVersion.VERSION_11 +} + +apply from: "$rootDir/gradle/java.gradle" +apply from: "$rootDir/gradle/spring-boot-plugin.gradle" +description = 'Open Feature provider Smoke Tests.' + +tasks.named("compileJava", JavaCompile) { + configureCompiler(it, 11, JavaVersion.VERSION_11) +} + +dependencies { + implementation project(':products:feature-flagging:api') + implementation 'org.springframework.boot:spring-boot-starter-web' + + testImplementation project(':dd-smoke-tests') + testImplementation project(':products:feature-flagging:lib') +} + +tasks.withType(Test).configureEach { + dependsOn "bootJar" + def bootJarTask = tasks.named('bootJar', BootJar) + jvmArgumentProviders.add(new CommandLineArgumentProvider() { + @Override + Iterable asArguments() { + return bootJarTask.map { ["-Ddatadog.smoketest.springboot.shadowJar.path=${it.archiveFile.get()}"] }.get() + } + }) +} diff --git a/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/SpringbootApplication.java b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/SpringbootApplication.java new file mode 100644 index 00000000000..c80e4cc2aa5 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/SpringbootApplication.java @@ -0,0 +1,12 @@ +package datadog.smoketest.springboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringbootApplication { + + public static void main(final String[] args) { + SpringApplication.run(SpringbootApplication.class, args); + } +} diff --git a/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureConfiguration.java b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureConfiguration.java new file mode 100644 index 00000000000..f8a8ac51e45 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureConfiguration.java @@ -0,0 +1,18 @@ +package datadog.smoketest.springboot.openfeature; + +import datadog.trace.api.openfeature.Provider; +import dev.openfeature.sdk.Client; +import dev.openfeature.sdk.OpenFeatureAPI; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class OpenFeatureConfiguration { + + @Bean + public Client openFeatureClient() { + OpenFeatureAPI api = OpenFeatureAPI.getInstance(); + api.setProviderAndWait(new Provider()); + return api.getClient(); + } +} diff --git a/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureController.java b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureController.java new file mode 100644 index 00000000000..47b5e6b18ab --- /dev/null +++ b/dd-smoke-tests/openfeature/src/main/java/datadog/smoketest/springboot/openfeature/OpenFeatureController.java @@ -0,0 +1,160 @@ +package datadog.smoketest.springboot.openfeature; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + +import dev.openfeature.sdk.Client; +import dev.openfeature.sdk.EvaluationContext; +import dev.openfeature.sdk.FlagEvaluationDetails; +import dev.openfeature.sdk.MutableContext; +import dev.openfeature.sdk.Structure; +import dev.openfeature.sdk.Value; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/openfeature") +public class OpenFeatureController { + + private static final Logger LOGGER = LoggerFactory.getLogger(OpenFeatureController.class); + + private final Client client; + + public OpenFeatureController(final Client client) { + this.client = client; + } + + @PostMapping( + value = "/evaluate", + consumes = APPLICATION_JSON_VALUE, + produces = APPLICATION_JSON_VALUE) + public ResponseEntity evaluate(@RequestBody final EvaluateRequest request) { + try { + final EvaluationContext context = context(request); + FlagEvaluationDetails details; + switch (request.getVariationType()) { + case "BOOLEAN": + details = + client.getBooleanDetails( + request.getFlag(), (Boolean) request.getDefaultValue(), context); + break; + case "STRING": + details = + client.getStringDetails( + request.getFlag(), (String) request.getDefaultValue(), context); + break; + case "INTEGER": + final Number integerEval = (Number) request.getDefaultValue(); + details = client.getIntegerDetails(request.getFlag(), integerEval.intValue(), context); + break; + case "NUMERIC": + final Number doubleEval = (Number) request.getDefaultValue(); + details = client.getDoubleDetails(request.getFlag(), doubleEval.doubleValue(), context); + break; + case "JSON": + details = + client.getObjectDetails( + request.getFlag(), Value.objectToValue(request.getDefaultValue()), context); + break; + default: + throw new IllegalArgumentException( + "Unsupported variation type: " + request.getVariationType()); + } + + final Object value = details.getValue(); + final Map result = new HashMap<>(); + result.put("flagKey", details.getFlagKey()); + result.put("variant", details.getVariant()); + result.put("reason", details.getReason()); + result.put("value", value instanceof Value ? context.convertValue((Value) value) : value); + result.put("errorCode", details.getErrorCode()); + result.put("errorMessage", details.getErrorMessage()); + result.put("flagMetadata", details.getFlagMetadata().asUnmodifiableMap()); + return ResponseEntity.ok(result); + } catch (Throwable e) { + LOGGER.error("Error on resolution", e); + return ResponseEntity.internalServerError().body(e.getMessage()); + } + } + + private static EvaluationContext context(final EvaluateRequest request) { + final MutableContext context = new MutableContext(); + context.setTargetingKey(request.getTargetingKey()); + if (request.attributes != null) { + request.attributes.forEach( + (key, value) -> { + if (value instanceof Boolean) { + context.add(key, (Boolean) value); + } else if (value instanceof Integer) { + context.add(key, (Integer) value); + } else if (value instanceof Double) { + context.add(key, (Double) value); + } else if (value instanceof String) { + context.add(key, (String) value); + } else if (value instanceof Map) { + context.add(key, Value.objectToValue(value).asStructure()); + } else if (value instanceof List) { + context.add(key, Value.objectToValue(value).asList()); + } else { + context.add(key, (Structure) null); + } + }); + } + return context; + } + + public static class EvaluateRequest { + private String flag; + private String variationType; + private Object defaultValue; + private String targetingKey; + private Map attributes; + + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + public Object getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } + + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public String getTargetingKey() { + return targetingKey; + } + + public void setTargetingKey(String targetingKey) { + this.targetingKey = targetingKey; + } + + public String getVariationType() { + return variationType; + } + + public void setVariationType(String variationType) { + this.variationType = variationType; + } + } +} diff --git a/dd-smoke-tests/openfeature/src/test/groovy/datadog/smoketest/springboot/OpenFeatureProviderSmokeTest.groovy b/dd-smoke-tests/openfeature/src/test/groovy/datadog/smoketest/springboot/OpenFeatureProviderSmokeTest.groovy new file mode 100644 index 00000000000..b2e8539c2e8 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/groovy/datadog/smoketest/springboot/OpenFeatureProviderSmokeTest.groovy @@ -0,0 +1,163 @@ +package datadog.smoketest.springboot + +import datadog.remoteconfig.Capabilities +import datadog.remoteconfig.Product +import datadog.smoketest.AbstractServerSmokeTest +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import java.nio.file.Files +import java.nio.file.Paths +import okhttp3.MediaType +import okhttp3.Request +import okhttp3.RequestBody +import spock.lang.Shared +import spock.lang.Stepwise +import spock.util.concurrent.PollingConditions + +/** Due to the exposure cache it's important to run the tests in the specified order */ +@Stepwise +class OpenFeatureProviderSmokeTest extends AbstractServerSmokeTest { + + @Shared + private final rcPayload = new JsonSlurper().parse(fetchResource("config/flags-v1.json")).with { json -> + return JsonOutput.toJson(json.data.attributes) + } + + @Override + ProcessBuilder createProcessBuilder() { + setRemoteConfig("datadog/2/FFE_FLAGS/1/config", rcPayload) + + final springBootShadowJar = System.getProperty("datadog.smoketest.springboot.shadowJar.path") + final command = [javaPath()] + command.addAll(defaultJavaProperties) + command.add('-Ddd.trace.debug=true') + command.add('-Ddd.remote_config.enabled=true') + command.add("-Ddd.remote_config.url=http://localhost:${server.address.port}/v0.7/config".toString()) + command.addAll(['-jar', springBootShadowJar, "--server.port=${httpPort}".toString()]) + final builder = new ProcessBuilder(command).directory(new File(buildDirectory)) + builder.environment().put('DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED', 'true') + return builder + } + + @Override + Closure decodedEvpProxyMessageCallback() { + return { String path, byte[] body -> + if (!path.contains('api/v2/exposures')) { + return null + } + return new JsonSlurper().parse(body) + } + } + + void 'test remote config'() { + when: + final rcRequest = waitForRcClientRequest { req -> + decodeProducts(req).find { it == Product.FFE_FLAGS } != null + } + + then: + final capabilities = decodeCapabilities(rcRequest) + hasCapability(capabilities, Capabilities.CAPABILITY_FFE_FLAG_CONFIGURATION_RULES) + } + + void 'test open feature exposures'() { + setup: + setRemoteConfig("datadog/2/FFE_FLAGS/1/config", rcPayload) + final url = "http://localhost:${httpPort}/openfeature/evaluate" + final testCases = parseTestCases().findAll { + it.result.flagMetadata?.doLog + } + + when: + final responses = testCases.collect { + testCase -> + final request = new Request.Builder() + .url(url) + .post(RequestBody.create(MediaType.parse('application/json'), JsonOutput.toJson(testCase))) + .build() + client.newCall(request).execute() + } + + then: + responses.every { + it.code() == 200 + } + new PollingConditions(timeout: 10).eventually { + final requests = evpProxyMessages*.getV2() as List> + final events = requests*.exposures.flatten() + assert events.size() == testCases.size() + testCases.each { + testCase -> + assert events.find { + event -> + event.flag.key == testCase.flag && event.subject.id == testCase.targetingKey + } != null : "Unable to find exposure with flag=${testCase.flag} and targetingKey=${testCase.targetingKey}" + } + } + } + + void 'test open feature evaluation'() { + setup: + setRemoteConfig("datadog/2/FFE_FLAGS/1/config", rcPayload) + final url = "http://localhost:${httpPort}/openfeature/evaluate" + final request = new Request.Builder() + .url(url) + .post(RequestBody.create(MediaType.parse('application/json'), JsonOutput.toJson(testCase))) + .build() + + when: + final response = client.newCall(request).execute() + + then: + response.code() == 200 + final responseBody = new JsonSlurper().parse(response.body().byteStream()) + responseBody.value == testCase.result.value + responseBody.variant == testCase.result.variant + responseBody.flagMetadata?.allocationKey == testCase.result.flagMetadata?.allocationKey + + where: + testCase << parseTestCases() + } + + private static URL fetchResource(final String name) { + return Thread.currentThread().getContextClassLoader().getResource(name) + } + + private static List> parseTestCases() { + final folder = fetchResource('data') + final uri = folder.toURI() + final testsPath = Paths.get(uri) + final files = Files.list(testsPath) + .filter(path -> path.toString().endsWith('.json')) + final result = [] + final slurper = new JsonSlurper() + files.each { + path -> + final testCases = slurper.parse(path.toFile()) as List> + testCases.eachWithIndex { + testCase, index -> + testCase.fileName = path.fileName.toString() + testCase.index = index + } + result.addAll(testCases) + } + return result + } + + private static Set decodeProducts(final Map request) { + return request.client.products.collect { Product.valueOf(it) } + } + + private static long decodeCapabilities(final Map request) { + final clientCapabilities = request.client.capabilities as byte[] + long capabilities = 0l + for (int i = 0; i < clientCapabilities.length; i++) { + capabilities |= (clientCapabilities[i] & 0xFFL) << ((clientCapabilities.length - i - 1) * 8) + } + return capabilities + } + + private static boolean hasCapability(final long capabilities, final long test) { + return (capabilities & test) > 0 + } +} diff --git a/dd-smoke-tests/openfeature/src/test/resources/config/flags-v1.json b/dd-smoke-tests/openfeature/src/test/resources/config/flags-v1.json new file mode 100644 index 00000000000..8c7c1c29308 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/config/flags-v1.json @@ -0,0 +1,2898 @@ +{ + "data": { + "type": "universal-flag-configuration", + "id": "1", + "attributes": { + "createdAt": "2024-04-17T19:40:53.716Z", + "format": "SERVER", + "environment": { + "name": "Test" + }, + "flags": { + "empty_flag": { + "key": "empty_flag", + "enabled": true, + "variationType": "STRING", + "variations": {}, + "allocations": [] + }, + "disabled_flag": { + "key": "disabled_flag", + "enabled": false, + "variationType": "INTEGER", + "variations": {}, + "allocations": [] + }, + "no_allocations_flag": { + "key": "no_allocations_flag", + "enabled": true, + "variationType": "JSON", + "variations": { + "control": { + "key": "control", + "value": { "variant": "control" } + }, + "treatment": { + "key": "treatment", + "value": { "variant": "treatment" } + } + }, + "allocations": [] + }, + "numeric_flag": { + "key": "numeric_flag", + "enabled": true, + "variationType": "NUMERIC", + "variations": { + "e": { + "key": "e", + "value": 2.7182818 + }, + "pi": { + "key": "pi", + "value": 3.1415926 + } + }, + "allocations": [ + { + "key": "rollout", + "splits": [ + { + "variationKey": "pi", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "regex-flag": { + "key": "regex-flag", + "enabled": true, + "variationType": "STRING", + "variations": { + "partial-example": { + "key": "partial-example", + "value": "partial-example" + }, + "test": { + "key": "test", + "value": "test" + } + }, + "allocations": [ + { + "key": "partial-example", + "rules": [ + { + "conditions": [ + { + "attribute": "email", + "operator": "MATCHES", + "value": "@example\\.com" + } + ] + } + ], + "splits": [ + { + "variationKey": "partial-example", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "test", + "rules": [ + { + "conditions": [ + { + "attribute": "email", + "operator": "MATCHES", + "value": ".*@test\\.com" + } + ] + } + ], + "splits": [ + { + "variationKey": "test", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "numeric-one-of": { + "key": "numeric-one-of", + "enabled": true, + "variationType": "INTEGER", + "variations": { + "1": { + "key": "1", + "value": 1 + }, + "2": { + "key": "2", + "value": 2 + }, + "3": { + "key": "3", + "value": 3 + } + }, + "allocations": [ + { + "key": "1-for-1", + "rules": [ + { + "conditions": [ + { + "attribute": "number", + "operator": "ONE_OF", + "value": ["1"] + } + ] + } + ], + "splits": [ + { + "variationKey": "1", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "2-for-123456789", + "rules": [ + { + "conditions": [ + { + "attribute": "number", + "operator": "ONE_OF", + "value": ["123456789"] + } + ] + } + ], + "splits": [ + { + "variationKey": "2", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "3-for-not-2", + "rules": [ + { + "conditions": [ + { + "attribute": "number", + "operator": "NOT_ONE_OF", + "value": ["2"] + } + ] + } + ], + "splits": [ + { + "variationKey": "3", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "boolean-one-of-matches": { + "key": "boolean-one-of-matches", + "enabled": true, + "variationType": "INTEGER", + "variations": { + "1": { + "key": "1", + "value": 1 + }, + "2": { + "key": "2", + "value": 2 + }, + "3": { + "key": "3", + "value": 3 + }, + "4": { + "key": "4", + "value": 4 + }, + "5": { + "key": "5", + "value": 5 + } + }, + "allocations": [ + { + "key": "1-for-one-of", + "rules": [ + { + "conditions": [ + { + "attribute": "one_of_flag", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "1", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "2-for-matches", + "rules": [ + { + "conditions": [ + { + "attribute": "matches_flag", + "operator": "MATCHES", + "value": "true" + } + ] + } + ], + "splits": [ + { + "variationKey": "2", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "3-for-not-one-of", + "rules": [ + { + "conditions": [ + { + "attribute": "not_one_of_flag", + "operator": "NOT_ONE_OF", + "value": ["false"] + } + ] + } + ], + "splits": [ + { + "variationKey": "3", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "4-for-not-matches", + "rules": [ + { + "conditions": [ + { + "attribute": "not_matches_flag", + "operator": "NOT_MATCHES", + "value": "false" + } + ] + } + ], + "splits": [ + { + "variationKey": "4", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "5-for-matches-null", + "rules": [ + { + "conditions": [ + { + "attribute": "null_flag", + "operator": "ONE_OF", + "value": ["null"] + } + ] + } + ], + "splits": [ + { + "variationKey": "5", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "empty_string_flag": { + "key": "empty_string_flag", + "enabled": true, + "comment": "Testing the empty string as a variation value", + "variationType": "STRING", + "variations": { + "empty_string": { + "key": "empty_string", + "value": "" + }, + "non_empty": { + "key": "non_empty", + "value": "non_empty" + } + }, + "allocations": [ + { + "key": "allocation-empty", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "MATCHES", + "value": "US" + } + ] + } + ], + "splits": [ + { + "variationKey": "empty_string", + "shards": [ + { + "salt": "allocation-empty-shards", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "allocation-test", + "rules": [], + "splits": [ + { + "variationKey": "non_empty", + "shards": [ + { + "salt": "allocation-empty-shards", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + } + ] + }, + "kill-switch": { + "key": "kill-switch", + "enabled": true, + "variationType": "BOOLEAN", + "variations": { + "on": { + "key": "on", + "value": true + }, + "off": { + "key": "off", + "value": false + } + }, + "allocations": [ + { + "key": "on-for-NA", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "ONE_OF", + "value": ["US", "Canada", "Mexico"] + } + ] + } + ], + "splits": [ + { + "variationKey": "on", + "shards": [ + { + "salt": "some-salt", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "on-for-age-50+", + "rules": [ + { + "conditions": [ + { + "attribute": "age", + "operator": "GTE", + "value": 50 + } + ] + } + ], + "splits": [ + { + "variationKey": "on", + "shards": [ + { + "salt": "some-salt", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "off-for-all", + "rules": [], + "splits": [ + { + "variationKey": "off", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "comparator-operator-test": { + "key": "comparator-operator-test", + "enabled": true, + "variationType": "STRING", + "variations": { + "small": { + "key": "small", + "value": "small" + }, + "medium": { + "key": "medium", + "value": "medium" + }, + "large": { + "key": "large", + "value": "large" + } + }, + "allocations": [ + { + "key": "small-size", + "rules": [ + { + "conditions": [ + { + "attribute": "size", + "operator": "LT", + "value": 10 + } + ] + } + ], + "splits": [ + { + "variationKey": "small", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "medum-size", + "rules": [ + { + "conditions": [ + { + "attribute": "size", + "operator": "GTE", + "value": 10 + }, + { + "attribute": "size", + "operator": "LTE", + "value": 20 + } + ] + } + ], + "splits": [ + { + "variationKey": "medium", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "large-size", + "rules": [ + { + "conditions": [ + { + "attribute": "size", + "operator": "GT", + "value": 25 + } + ] + } + ], + "splits": [ + { + "variationKey": "large", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "start-and-end-date-test": { + "key": "start-and-end-date-test", + "enabled": true, + "variationType": "STRING", + "variations": { + "old": { + "key": "old", + "value": "old" + }, + "current": { + "key": "current", + "value": "current" + }, + "new": { + "key": "new", + "value": "new" + } + }, + "allocations": [ + { + "key": "old-versions", + "splits": [ + { + "variationKey": "old", + "shards": [] + } + ], + "endAt": "2002-10-31T09:00:00.594Z", + "doLog": true + }, + { + "key": "future-versions", + "splits": [ + { + "variationKey": "new", + "shards": [] + } + ], + "startAt": "2052-10-31T09:00:00.594Z", + "doLog": true + }, + { + "key": "current-versions", + "splits": [ + { + "variationKey": "current", + "shards": [] + } + ], + "startAt": "2022-10-31T09:00:00.594Z", + "endAt": "2050-10-31T09:00:00.594Z", + "doLog": true + } + ] + }, + "null-operator-test": { + "key": "null-operator-test", + "enabled": true, + "variationType": "STRING", + "variations": { + "old": { + "key": "old", + "value": "old" + }, + "new": { + "key": "new", + "value": "new" + } + }, + "allocations": [ + { + "key": "null-operator", + "rules": [ + { + "conditions": [ + { + "attribute": "size", + "operator": "IS_NULL", + "value": true + } + ] + }, + { + "conditions": [ + { + "attribute": "size", + "operator": "LT", + "value": 10 + } + ] + } + ], + "splits": [ + { + "variationKey": "old", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "not-null-operator", + "rules": [ + { + "conditions": [ + { + "attribute": "size", + "operator": "IS_NULL", + "value": false + } + ] + } + ], + "splits": [ + { + "variationKey": "new", + "shards": [] + } + ], + "doLog": true + } + ] + }, + "new-user-onboarding": { + "key": "new-user-onboarding", + "enabled": true, + "variationType": "STRING", + "variations": { + "control": { + "key": "control", + "value": "control" + }, + "red": { + "key": "red", + "value": "red" + }, + "blue": { + "key": "blue", + "value": "blue" + }, + "green": { + "key": "green", + "value": "green" + }, + "yellow": { + "key": "yellow", + "value": "yellow" + }, + "purple": { + "key": "purple", + "value": "purple" + } + }, + "allocations": [ + { + "key": "id rule", + "rules": [ + { + "conditions": [ + { + "attribute": "id", + "operator": "MATCHES", + "value": "zach" + } + ] + } + ], + "splits": [ + { + "variationKey": "purple", + "shards": [] + } + ], + "doLog": false + }, + { + "key": "internal users", + "rules": [ + { + "conditions": [ + { + "attribute": "email", + "operator": "MATCHES", + "value": "@mycompany.com" + } + ] + } + ], + "splits": [ + { + "variationKey": "green", + "shards": [] + } + ], + "doLog": false + }, + { + "key": "experiment", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "NOT_ONE_OF", + "value": ["US", "Canada", "Mexico"] + } + ] + } + ], + "splits": [ + { + "variationKey": "control", + "shards": [ + { + "salt": "traffic-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 6000 + } + ] + }, + { + "salt": "split-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 5000 + } + ] + } + ] + }, + { + "variationKey": "red", + "shards": [ + { + "salt": "traffic-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 6000 + } + ] + }, + { + "salt": "split-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 5000, + "end": 8000 + } + ] + } + ] + }, + { + "variationKey": "yellow", + "shards": [ + { + "salt": "traffic-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 6000 + } + ] + }, + { + "salt": "split-new-user-onboarding-experiment", + "totalShards": 10000, + "ranges": [ + { + "start": 8000, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "rollout", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "ONE_OF", + "value": ["US", "Canada", "Mexico"] + } + ] + } + ], + "splits": [ + { + "variationKey": "blue", + "shards": [ + { + "salt": "split-new-user-onboarding-rollout", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 8000 + } + ] + } + ], + "extraLogging": { + "allocationvalue_type": "rollout", + "owner": "hippo" + } + } + ], + "doLog": true + } + ] + }, + "integer-flag": { + "key": "integer-flag", + "enabled": true, + "variationType": "INTEGER", + "variations": { + "one": { + "key": "one", + "value": 1 + }, + "two": { + "key": "two", + "value": 2 + }, + "three": { + "key": "three", + "value": 3 + } + }, + "allocations": [ + { + "key": "targeted allocation", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "ONE_OF", + "value": ["US", "Canada", "Mexico"] + } + ] + }, + { + "conditions": [ + { + "attribute": "email", + "operator": "MATCHES", + "value": ".*@example.com" + } + ] + } + ], + "splits": [ + { + "variationKey": "three", + "shards": [ + { + "salt": "full-range-salt", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "50/50 split", + "rules": [], + "splits": [ + { + "variationKey": "one", + "shards": [ + { + "salt": "split-numeric-flag-some-allocation", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 5000 + } + ] + } + ] + }, + { + "variationKey": "two", + "shards": [ + { + "salt": "split-numeric-flag-some-allocation", + "totalShards": 10000, + "ranges": [ + { + "start": 5000, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + } + ] + }, + "json-config-flag": { + "key": "json-config-flag", + "enabled": true, + "variationType": "JSON", + "variations": { + "one": { + "key": "one", + "value": { "integer": 1, "string": "one", "float": 1.0 } + }, + "two": { + "key": "two", + "value": { "integer": 2, "string": "two", "float": 2.0 } + }, + "empty": { + "key": "empty", + "value": {} + } + }, + "allocations": [ + { + "key": "Optionally Force Empty", + "rules": [ + { + "conditions": [ + { + "attribute": "Force Empty", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "empty", + "shards": [ + { + "salt": "full-range-salt", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "50/50 split", + "rules": [], + "splits": [ + { + "variationKey": "one", + "shards": [ + { + "salt": "traffic-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + }, + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 5000 + } + ] + } + ] + }, + { + "variationKey": "two", + "shards": [ + { + "salt": "traffic-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + }, + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 5000, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + } + ] + }, + "special-characters": { + "key": "special-characters", + "enabled": true, + "variationType": "JSON", + "variations": { + "de": { + "key": "de", + "value": { "a": "kümmert", "b": "schön" } + }, + "ua": { + "key": "ua", + "value": { "a": "піклуватися", "b": "любов" } + }, + "zh": { + "key": "zh", + "value": { "a": "照顾", "b": "漂亮" } + }, + "emoji": { + "key": "emoji", + "value": { "a": "🤗", "b": "🌸" } + } + }, + "allocations": [ + { + "key": "allocation-test", + "splits": [ + { + "variationKey": "de", + "shards": [ + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 0, + "end": 2500 + } + ] + } + ] + }, + { + "variationKey": "ua", + "shards": [ + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 2500, + "end": 5000 + } + ] + } + ] + }, + { + "variationKey": "zh", + "shards": [ + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 5000, + "end": 7500 + } + ] + } + ] + }, + { + "variationKey": "emoji", + "shards": [ + { + "salt": "split-json-flag", + "totalShards": 10000, + "ranges": [ + { + "start": 7500, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "allocation-default", + "splits": [ + { + "variationKey": "de", + "shards": [] + } + ], + "doLog": false + } + ] + }, + "string_flag_with_special_characters": { + "key": "string_flag_with_special_characters", + "enabled": true, + "comment": "Testing the string with special characters and spaces", + "variationType": "STRING", + "variations": { + "string_with_spaces": { + "key": "string_with_spaces", + "value": " a b c d e f " + }, + "string_with_only_one_space": { + "key": "string_with_only_one_space", + "value": " " + }, + "string_with_only_multiple_spaces": { + "key": "string_with_only_multiple_spaces", + "value": " " + }, + "string_with_dots": { + "key": "string_with_dots", + "value": ".a.b.c.d.e.f." + }, + "string_with_only_one_dot": { + "key": "string_with_only_one_dot", + "value": "." + }, + "string_with_only_multiple_dots": { + "key": "string_with_only_multiple_dots", + "value": "......." + }, + "string_with_comas": { + "key": "string_with_comas", + "value": ",a,b,c,d,e,f," + }, + "string_with_only_one_coma": { + "key": "string_with_only_one_coma", + "value": "," + }, + "string_with_only_multiple_comas": { + "key": "string_with_only_multiple_comas", + "value": ",,,,,,," + }, + "string_with_colons": { + "key": "string_with_colons", + "value": ":a:b:c:d:e:f:" + }, + "string_with_only_one_colon": { + "key": "string_with_only_one_colon", + "value": ":" + }, + "string_with_only_multiple_colons": { + "key": "string_with_only_multiple_colons", + "value": ":::::::" + }, + "string_with_semicolons": { + "key": "string_with_semicolons", + "value": ";a;b;c;d;e;f;" + }, + "string_with_only_one_semicolon": { + "key": "string_with_only_one_semicolon", + "value": ";" + }, + "string_with_only_multiple_semicolons": { + "key": "string_with_only_multiple_semicolons", + "value": ";;;;;;;" + }, + "string_with_slashes": { + "key": "string_with_slashes", + "value": "/a/b/c/d/e/f/" + }, + "string_with_only_one_slash": { + "key": "string_with_only_one_slash", + "value": "/" + }, + "string_with_only_multiple_slashes": { + "key": "string_with_only_multiple_slashes", + "value": "///////" + }, + "string_with_dashes": { + "key": "string_with_dashes", + "value": "-a-b-c-d-e-f-" + }, + "string_with_only_one_dash": { + "key": "string_with_only_one_dash", + "value": "-" + }, + "string_with_only_multiple_dashes": { + "key": "string_with_only_multiple_dashes", + "value": "-------" + }, + "string_with_underscores": { + "key": "string_with_underscores", + "value": "_a_b_c_d_e_f_" + }, + "string_with_only_one_underscore": { + "key": "string_with_only_one_underscore", + "value": "_" + }, + "string_with_only_multiple_underscores": { + "key": "string_with_only_multiple_underscores", + "value": "_______" + }, + "string_with_plus_signs": { + "key": "string_with_plus_signs", + "value": "+a+b+c+d+e+f+" + }, + "string_with_only_one_plus_sign": { + "key": "string_with_only_one_plus_sign", + "value": "+" + }, + "string_with_only_multiple_plus_signs": { + "key": "string_with_only_multiple_plus_signs", + "value": "+++++++" + }, + "string_with_equal_signs": { + "key": "string_with_equal_signs", + "value": "=a=b=c=d=e=f=" + }, + "string_with_only_one_equal_sign": { + "key": "string_with_only_one_equal_sign", + "value": "=" + }, + "string_with_only_multiple_equal_signs": { + "key": "string_with_only_multiple_equal_signs", + "value": "=======" + }, + "string_with_dollar_signs": { + "key": "string_with_dollar_signs", + "value": "$a$b$c$d$e$f$" + }, + "string_with_only_one_dollar_sign": { + "key": "string_with_only_one_dollar_sign", + "value": "$" + }, + "string_with_only_multiple_dollar_signs": { + "key": "string_with_only_multiple_dollar_signs", + "value": "$$$$$$$" + }, + "string_with_at_signs": { + "key": "string_with_at_signs", + "value": "@a@b@c@d@e@f@" + }, + "string_with_only_one_at_sign": { + "key": "string_with_only_one_at_sign", + "value": "@" + }, + "string_with_only_multiple_at_signs": { + "key": "string_with_only_multiple_at_signs", + "value": "@@@@@@@" + }, + "string_with_amp_signs": { + "key": "string_with_amp_signs", + "value": "&a&b&c&d&e&f&" + }, + "string_with_only_one_amp_sign": { + "key": "string_with_only_one_amp_sign", + "value": "&" + }, + "string_with_only_multiple_amp_signs": { + "key": "string_with_only_multiple_amp_signs", + "value": "&&&&&&&" + }, + "string_with_hash_signs": { + "key": "string_with_hash_signs", + "value": "#a#b#c#d#e#f#" + }, + "string_with_only_one_hash_sign": { + "key": "string_with_only_one_hash_sign", + "value": "#" + }, + "string_with_only_multiple_hash_signs": { + "key": "string_with_only_multiple_hash_signs", + "value": "#######" + }, + "string_with_percentage_signs": { + "key": "string_with_percentage_signs", + "value": "%a%b%c%d%e%f%" + }, + "string_with_only_one_percentage_sign": { + "key": "string_with_only_one_percentage_sign", + "value": "%" + }, + "string_with_only_multiple_percentage_signs": { + "key": "string_with_only_multiple_percentage_signs", + "value": "%%%%%%%" + }, + "string_with_tilde_signs": { + "key": "string_with_tilde_signs", + "value": "~a~b~c~d~e~f~" + }, + "string_with_only_one_tilde_sign": { + "key": "string_with_only_one_tilde_sign", + "value": "~" + }, + "string_with_only_multiple_tilde_signs": { + "key": "string_with_only_multiple_tilde_signs", + "value": "~~~~~~~" + }, + "string_with_asterix_signs": { + "key": "string_with_asterix_signs", + "value": "*a*b*c*d*e*f*" + }, + "string_with_only_one_asterix_sign": { + "key": "string_with_only_one_asterix_sign", + "value": "*" + }, + "string_with_only_multiple_asterix_signs": { + "key": "string_with_only_multiple_asterix_signs", + "value": "*******" + }, + "string_with_single_quotes": { + "key": "string_with_single_quotes", + "value": "'a'b'c'd'e'f'" + }, + "string_with_only_one_single_quote": { + "key": "string_with_only_one_single_quote", + "value": "'" + }, + "string_with_only_multiple_single_quotes": { + "key": "string_with_only_multiple_single_quotes", + "value": "'''''''" + }, + "string_with_question_marks": { + "key": "string_with_question_marks", + "value": "?a?b?c?d?e?f?" + }, + "string_with_only_one_question_mark": { + "key": "string_with_only_one_question_mark", + "value": "?" + }, + "string_with_only_multiple_question_marks": { + "key": "string_with_only_multiple_question_marks", + "value": "???????" + }, + "string_with_exclamation_marks": { + "key": "string_with_exclamation_marks", + "value": "!a!b!c!d!e!f!" + }, + "string_with_only_one_exclamation_mark": { + "key": "string_with_only_one_exclamation_mark", + "value": "!" + }, + "string_with_only_multiple_exclamation_marks": { + "key": "string_with_only_multiple_exclamation_marks", + "value": "!!!!!!!" + }, + "string_with_opening_parentheses": { + "key": "string_with_opening_parentheses", + "value": "(a(b(c(d(e(f(" + }, + "string_with_only_one_opening_parenthese": { + "key": "string_with_only_one_opening_parenthese", + "value": "(" + }, + "string_with_only_multiple_opening_parentheses": { + "key": "string_with_only_multiple_opening_parentheses", + "value": "(((((((" + }, + "string_with_closing_parentheses": { + "key": "string_with_closing_parentheses", + "value": ")a)b)c)d)e)f)" + }, + "string_with_only_one_closing_parenthese": { + "key": "string_with_only_one_closing_parenthese", + "value": ")" + }, + "string_with_only_multiple_closing_parentheses": { + "key": "string_with_only_multiple_closing_parentheses", + "value": ")))))))" + } + }, + "allocations": [ + { + "key": "allocation-test-string_with_spaces", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_spaces", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_spaces", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_space", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_space", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_space", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_spaces", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_spaces", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_spaces", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_dots", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_dots", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_dots", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_dot", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_dot", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_dot", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_dots", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_dots", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_dots", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_comas", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_comas", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_comas", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_coma", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_coma", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_coma", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_comas", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_comas", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_comas", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_colons", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_colons", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_colons", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_colon", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_colon", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_colon", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_colons", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_colons", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_colons", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_semicolons", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_semicolons", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_semicolons", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_semicolon", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_semicolon", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_semicolon", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_semicolons", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_semicolons", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_semicolons", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_slashes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_slashes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_slashes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_slash", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_slash", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_slash", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_slashes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_slashes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_slashes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_dashes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_dashes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_dashes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_dash", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_dash", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_dash", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_dashes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_dashes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_dashes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_underscores", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_underscores", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_underscores", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_underscore", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_underscore", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_underscore", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_underscores", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_underscores", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_underscores", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_plus_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_plus_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_plus_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_plus_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_plus_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_plus_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_plus_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_plus_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_plus_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_equal_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_equal_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_equal_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_equal_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_equal_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_equal_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_equal_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_equal_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_equal_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_dollar_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_dollar_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_dollar_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_dollar_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_dollar_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_dollar_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_dollar_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_dollar_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_dollar_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_at_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_at_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_at_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_at_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_at_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_at_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_at_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_at_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_at_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_amp_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_amp_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_amp_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_amp_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_amp_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_amp_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_amp_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_amp_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_amp_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_hash_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_hash_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_hash_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_hash_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_hash_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_hash_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_hash_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_hash_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_hash_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_percentage_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_percentage_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_percentage_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_percentage_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_percentage_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_percentage_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_percentage_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_percentage_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_percentage_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_tilde_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_tilde_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_tilde_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_tilde_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_tilde_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_tilde_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_tilde_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_tilde_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_tilde_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_asterix_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_asterix_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_asterix_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_asterix_sign", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_asterix_sign", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_asterix_sign", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_asterix_signs", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_asterix_signs", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_asterix_signs", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_single_quotes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_single_quotes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_single_quotes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_single_quote", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_single_quote", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_single_quote", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_single_quotes", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_single_quotes", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_single_quotes", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_question_marks", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_question_marks", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_question_marks", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_question_mark", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_question_mark", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_question_mark", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_question_marks", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_question_marks", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_question_marks", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_exclamation_marks", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_exclamation_marks", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_exclamation_marks", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_exclamation_mark", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_exclamation_mark", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_exclamation_mark", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_exclamation_marks", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_exclamation_marks", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_exclamation_marks", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_opening_parentheses", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_opening_parentheses", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_opening_parentheses", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_opening_parenthese", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_opening_parenthese", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_opening_parenthese", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_opening_parentheses", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_opening_parentheses", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_opening_parentheses", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_closing_parentheses", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_closing_parentheses", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_closing_parentheses", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_one_closing_parenthese", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_one_closing_parenthese", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_one_closing_parenthese", + "shards": [] + } + ], + "doLog": true + }, + { + "key": "allocation-test-string_with_only_multiple_closing_parentheses", + "rules": [ + { + "conditions": [ + { + "attribute": "string_with_only_multiple_closing_parentheses", + "operator": "ONE_OF", + "value": ["true"] + } + ] + } + ], + "splits": [ + { + "variationKey": "string_with_only_multiple_closing_parentheses", + "shards": [] + } + ], + "doLog": true + } + ] + } + } + } + } +} diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-boolean-one-of-matches.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-boolean-one-of-matches.json new file mode 100644 index 00000000000..6bfbf0effad --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-boolean-one-of-matches.json @@ -0,0 +1,240 @@ +[ + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "alice", + "attributes": { + "one_of_flag": true + }, + "result": { + "value": 1, + "variant": "1", + "flagMetadata": { + "allocationKey": "1-for-one-of", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "bob", + "attributes": { + "one_of_flag": false + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "charlie", + "attributes": { + "one_of_flag": "True" + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "derek", + "attributes": { + "matches_flag": true + }, + "result": { + "value": 2, + "variant": "2", + "flagMetadata": { + "allocationKey": "2-for-matches", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "erica", + "attributes": { + "matches_flag": false + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "frank", + "attributes": { + "not_matches_flag": false + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "george", + "attributes": { + "not_matches_flag": true + }, + "result": { + "value": 4, + "variant": "4", + "flagMetadata": { + "allocationKey": "4-for-not-matches", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "haley", + "attributes": { + "not_matches_flag": "False" + }, + "result": { + "value": 4, + "variant": "4", + "flagMetadata": { + "allocationKey": "4-for-not-matches", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "ivy", + "attributes": { + "not_one_of_flag": true + }, + "result": { + "value": 3, + "variant": "3", + "flagMetadata": { + "allocationKey": "3-for-not-one-of", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "julia", + "attributes": { + "not_one_of_flag": false + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "kim", + "attributes": { + "not_one_of_flag": "False" + }, + "result": { + "value": 3, + "variant": "3", + "flagMetadata": { + "allocationKey": "3-for-not-one-of", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "lucas", + "attributes": { + "not_one_of_flag": "true" + }, + "result": { + "value": 3, + "variant": "3", + "flagMetadata": { + "allocationKey": "3-for-not-one-of", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "mike", + "attributes": { + "not_one_of_flag": "false" + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "nicole", + "attributes": { + "null_flag": "null" + }, + "result": { + "value": 5, + "variant": "5", + "flagMetadata": { + "allocationKey": "5-for-matches-null", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "owen", + "attributes": { + "null_flag": null + }, + "result": { + "value": 0 + } + }, + { + "flag": "boolean-one-of-matches", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "pete", + "attributes": {}, + "result": { + "value": 0 + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-comparator-operator-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-comparator-operator-flag.json new file mode 100644 index 00000000000..a5c8ef07cd4 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-comparator-operator-flag.json @@ -0,0 +1,82 @@ +[ + { + "flag": "comparator-operator-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "alice", + "attributes": { + "size": 5, + "country": "US" + }, + "result": { + "value": "small", + "variant": "small", + "flagMetadata": { + "allocationKey": "small-size", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "comparator-operator-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "bob", + "attributes": { + "size": 10, + "country": "Canada" + }, + "result": { + "value": "medium", + "variant": "medium", + "flagMetadata": { + "allocationKey": "medum-size", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "comparator-operator-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "charlie", + "attributes": { + "size": 25 + }, + "result": { + "value": "unknown" + } + }, + { + "flag": "comparator-operator-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "david", + "attributes": { + "size": 26 + }, + "result": { + "value": "large", + "variant": "large", + "flagMetadata": { + "allocationKey": "large-size", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "comparator-operator-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "elize", + "attributes": { + "country": "UK" + }, + "result": { + "value": "unknown" + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-disabled-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-disabled-flag.json new file mode 100644 index 00000000000..0da79189ade --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-disabled-flag.json @@ -0,0 +1,40 @@ +[ + { + "flag": "disabled_flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": 0 + } + }, + { + "flag": "disabled_flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": 0 + } + }, + { + "flag": "disabled_flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": 0 + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-empty-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-empty-flag.json new file mode 100644 index 00000000000..52100b1fe47 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-empty-flag.json @@ -0,0 +1,40 @@ +[ + { + "flag": "empty_flag", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": "default_value" + } + }, + { + "flag": "empty_flag", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": "default_value" + } + }, + { + "flag": "empty_flag", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": "default_value" + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-flag-with-empty-string.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-flag-with-empty-string.json new file mode 100644 index 00000000000..32a1c1febb7 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-flag-with-empty-string.json @@ -0,0 +1,36 @@ +[ + { + "flag": "empty_string_flag", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "alice", + "attributes": { + "country": "US" + }, + "result": { + "value": "", + "variant": "empty_string", + "flagMetadata": { + "allocationKey": "allocation-empty", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "empty_string_flag", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "bob", + "attributes": {}, + "result": { + "value": "non_empty", + "variant": "non_empty", + "flagMetadata": { + "allocationKey": "allocation-test", + "variationType": "string", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-integer-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-integer-flag.json new file mode 100644 index 00000000000..4a41d042f62 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-integer-flag.json @@ -0,0 +1,382 @@ +[ + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": 3, + "variant": "three", + "flagMetadata": { + "allocationKey": "targeted allocation", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": 3, + "variant": "three", + "flagMetadata": { + "allocationKey": "targeted allocation", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "debra", + "attributes": { + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": 3, + "variant": "three", + "flagMetadata": { + "allocationKey": "targeted allocation", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "1", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "2", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "3", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "4", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "5", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "6", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "7", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "8", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "9", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "10", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "11", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "12", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "13", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "14", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "15", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "16", + "attributes": {}, + "result": { + "value": 2, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "17", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "18", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "integer-flag", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "19", + "attributes": {}, + "result": { + "value": 1, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "number", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-kill-switch-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-kill-switch-flag.json new file mode 100644 index 00000000000..29e65ba5bb4 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-kill-switch-flag.json @@ -0,0 +1,434 @@ +[ + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "barbara", + "attributes": { + "email": "barbara@example.com", + "country": "canada" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "charlie", + "attributes": { + "age": 40 + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "debra", + "attributes": { + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "1", + "attributes": {}, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "2", + "attributes": { + "country": "Mexico" + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "3", + "attributes": { + "country": "UK", + "age": 50 + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-age-50+", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "4", + "attributes": { + "country": "Germany" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "5", + "attributes": { + "country": "Germany" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "6", + "attributes": { + "country": "Germany" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "7", + "attributes": { + "country": "US", + "age": 12 + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "8", + "attributes": { + "country": "Italy", + "age": 60 + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-age-50+", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "9", + "attributes": { + "email": "email@email.com" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "10", + "attributes": {}, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "11", + "attributes": {}, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "12", + "attributes": { + "country": "US" + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "13", + "attributes": { + "country": "Canada" + }, + "result": { + "value": true, + "variant": "on", + "flagMetadata": { + "allocationKey": "on-for-NA", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "14", + "attributes": {}, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "15", + "attributes": { + "country": "Denmark" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "16", + "attributes": { + "country": "Norway" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "17", + "attributes": { + "country": "UK" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "18", + "attributes": { + "country": "UK" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + }, + { + "flag": "kill-switch", + "variationType": "BOOLEAN", + "defaultValue": false, + "targetingKey": "19", + "attributes": { + "country": "UK" + }, + "result": { + "value": false, + "variant": "off", + "flagMetadata": { + "allocationKey": "off-for-all", + "variationType": "boolean", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-new-user-onboarding-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-new-user-onboarding-flag.json new file mode 100644 index 00000000000..3845597270e --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-new-user-onboarding-flag.json @@ -0,0 +1,420 @@ +[ + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": "green", + "variant": "green", + "flagMetadata": { + "allocationKey": "internal users", + "variationType": "string", + "doLog": false + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "debra", + "attributes": { + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "zach", + "attributes": { + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": "purple", + "variant": "purple", + "flagMetadata": { + "allocationKey": "id rule", + "variationType": "string", + "doLog": false + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "zach", + "attributes": { + "id": "override-id", + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "Zach", + "attributes": { + "email": "test@test.com", + "country": "Mexico", + "age": 25 + }, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "1", + "attributes": {}, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "2", + "attributes": { + "country": "Mexico" + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "3", + "attributes": { + "country": "UK", + "age": 33 + }, + "result": { + "value": "control", + "variant": "control", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "4", + "attributes": { + "country": "Germany" + }, + "result": { + "value": "red", + "variant": "red", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "5", + "attributes": { + "country": "Germany" + }, + "result": { + "value": "yellow", + "variant": "yellow", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "6", + "attributes": { + "country": "Germany" + }, + "result": { + "value": "yellow", + "variant": "yellow", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "7", + "attributes": { + "country": "US" + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "8", + "attributes": { + "country": "Italy" + }, + "result": { + "value": "red", + "variant": "red", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "9", + "attributes": { + "email": "email@email.com" + }, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "10", + "attributes": {}, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "11", + "attributes": {}, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "12", + "attributes": { + "country": "US" + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "13", + "attributes": { + "country": "Canada" + }, + "result": { + "value": "blue", + "variant": "blue", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "14", + "attributes": {}, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "15", + "attributes": { + "country": "Denmark" + }, + "result": { + "value": "yellow", + "variant": "yellow", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "16", + "attributes": { + "country": "Norway" + }, + "result": { + "value": "control", + "variant": "control", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "17", + "attributes": { + "country": "UK" + }, + "result": { + "value": "control", + "variant": "control", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "18", + "attributes": { + "country": "UK" + }, + "result": { + "value": "default" + } + }, + { + "flag": "new-user-onboarding", + "variationType": "STRING", + "defaultValue": "default", + "targetingKey": "19", + "attributes": { + "country": "UK" + }, + "result": { + "value": "red", + "variant": "red", + "flagMetadata": { + "allocationKey": "experiment", + "variationType": "string", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-no-allocations-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-no-allocations-flag.json new file mode 100644 index 00000000000..132c39db32a --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-no-allocations-flag.json @@ -0,0 +1,52 @@ +[ + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "hello": "world" + }, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": { + "hello": "world" + } + } + }, + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "hello": "world" + }, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": { + "hello": "world" + } + } + }, + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "hello": "world" + }, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": { + "hello": "world" + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-null-operator-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-null-operator-flag.json new file mode 100644 index 00000000000..dd5c687b893 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-null-operator-flag.json @@ -0,0 +1,94 @@ +[ + { + "flag": "null-operator-test", + "variationType": "STRING", + "defaultValue": "default-null", + "targetingKey": "alice", + "attributes": { + "size": 5, + "country": "US" + }, + "result": { + "value": "old", + "variant": "old", + "flagMetadata": { + "allocationKey": "null-operator", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "null-operator-test", + "variationType": "STRING", + "defaultValue": "default-null", + "targetingKey": "bob", + "attributes": { + "size": 10, + "country": "Canada" + }, + "result": { + "value": "new", + "variant": "new", + "flagMetadata": { + "allocationKey": "not-null-operator", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "null-operator-test", + "variationType": "STRING", + "defaultValue": "default-null", + "targetingKey": "charlie", + "attributes": { + "size": null + }, + "result": { + "value": "old", + "variant": "old", + "flagMetadata": { + "allocationKey": "null-operator", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "null-operator-test", + "variationType": "STRING", + "defaultValue": "default-null", + "targetingKey": "david", + "attributes": { + "size": 26 + }, + "result": { + "value": "new", + "variant": "new", + "flagMetadata": { + "allocationKey": "not-null-operator", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "null-operator-test", + "variationType": "STRING", + "defaultValue": "default-null", + "targetingKey": "elize", + "attributes": { + "country": "UK" + }, + "result": { + "value": "old", + "variant": "old", + "flagMetadata": { + "allocationKey": "null-operator", + "variationType": "string", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-flag.json new file mode 100644 index 00000000000..0e6ed8b1b3a --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-flag.json @@ -0,0 +1,58 @@ +[ + { + "flag": "numeric_flag", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": 3.1415926, + "variant": "pi", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric_flag", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": 3.1415926, + "variant": "pi", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric_flag", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": 3.1415926, + "variant": "pi", + "flagMetadata": { + "allocationKey": "rollout", + "variationType": "number", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-one-of.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-one-of.json new file mode 100644 index 00000000000..5ab68af5196 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-numeric-one-of.json @@ -0,0 +1,122 @@ +[ + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "alice", + "attributes": { + "number": 1 + }, + "result": { + "value": 1, + "variant": "1", + "flagMetadata": { + "allocationKey": "1-for-1", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "bob", + "attributes": { + "number": 2 + }, + "result": { + "value": 0 + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "charlie", + "attributes": { + "number": 3 + }, + "result": { + "value": 3, + "variant": "3", + "flagMetadata": { + "allocationKey": "3-for-not-2", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "derek", + "attributes": { + "number": 4 + }, + "result": { + "value": 3, + "variant": "3", + "flagMetadata": { + "allocationKey": "3-for-not-2", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "erica", + "attributes": { + "number": "1" + }, + "result": { + "value": 1, + "variant": "1", + "flagMetadata": { + "allocationKey": "1-for-1", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "frank", + "attributes": { + "number": 1 + }, + "result": { + "value": 1, + "variant": "1", + "flagMetadata": { + "allocationKey": "1-for-1", + "variationType": "number", + "doLog": true + } + } + }, + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "targetingKey": "george", + "attributes": { + "number": 123456789 + }, + "result": { + "value": 2, + "variant": "2", + "flagMetadata": { + "allocationKey": "2-for-123456789", + "variationType": "number", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-race-conditions.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-race-conditions.json new file mode 100644 index 00000000000..fa940c843b4 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-race-conditions.json @@ -0,0 +1,10 @@ +[ + { + "flag": "numeric-one-of", + "variationType": "INTEGER", + "defaultValue": 0, + "result": { + "value": 0 + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-regex-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-regex-flag.json new file mode 100644 index 00000000000..952a37aabcf --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-regex-flag.json @@ -0,0 +1,65 @@ +[ + { + "flag": "regex-flag", + "variationType": "STRING", + "defaultValue": "none", + "targetingKey": "alice", + "attributes": { + "version": "1.15.0", + "email": "alice@example.com" + }, + "result": { + "value": "partial-example", + "variant": "partial-example", + "flagMetadata": { + "allocationKey": "partial-example", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "regex-flag", + "variationType": "STRING", + "defaultValue": "none", + "targetingKey": "bob", + "attributes": { + "version": "0.20.1", + "email": "bob@test.com" + }, + "result": { + "value": "test", + "variant": "test", + "flagMetadata": { + "allocationKey": "test", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "regex-flag", + "variationType": "STRING", + "defaultValue": "none", + "targetingKey": "charlie", + "attributes": { + "version": "2.1.13" + }, + "result": { + "value": "none" + } + }, + { + "flag": "regex-flag", + "variationType": "STRING", + "defaultValue": "none", + "targetingKey": "derek", + "attributes": { + "version": "2.1.13", + "email": "derek@gmail.com" + }, + "result": { + "value": "none" + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-case-start-and-end-date-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-start-and-end-date-flag.json new file mode 100644 index 00000000000..caf805d1432 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-case-start-and-end-date-flag.json @@ -0,0 +1,58 @@ +[ + { + "flag": "start-and-end-date-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "alice", + "attributes": { + "version": "1.15.0", + "country": "US" + }, + "result": { + "value": "current", + "variant": "current", + "flagMetadata": { + "allocationKey": "current-versions", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "start-and-end-date-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "bob", + "attributes": { + "version": "0.20.1", + "country": "Canada" + }, + "result": { + "value": "current", + "variant": "current", + "flagMetadata": { + "allocationKey": "current-versions", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "start-and-end-date-test", + "variationType": "STRING", + "defaultValue": "unknown", + "targetingKey": "charlie", + "attributes": { + "version": "2.1.13" + }, + "result": { + "value": "current", + "variant": "current", + "flagMetadata": { + "allocationKey": "current-versions", + "variationType": "string", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-flag-that-does-not-exist.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-flag-that-does-not-exist.json new file mode 100644 index 00000000000..7499bba1c50 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-flag-that-does-not-exist.json @@ -0,0 +1,40 @@ +[ + { + "flag": "flag-that-does-not-exist", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": 0.0 + } + }, + { + "flag": "flag-that-does-not-exist", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": 0.0 + } + }, + { + "flag": "flag-that-does-not-exist", + "variationType": "NUMERIC", + "defaultValue": 0.0, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": 0.0 + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-json-config-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-json-config-flag.json new file mode 100644 index 00000000000..3d4478ff711 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-json-config-flag.json @@ -0,0 +1,96 @@ +[ + { + "flag": "json-config-flag", + "variationType": "JSON", + "defaultValue": { + "foo": "bar" + }, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": { + "integer": 1, + "string": "one", + "float": 1.0 + }, + "variant": "one", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "json-config-flag", + "variationType": "JSON", + "defaultValue": { + "foo": "bar" + }, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": { + "integer": 2, + "string": "two", + "float": 2.0 + }, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "json-config-flag", + "variationType": "JSON", + "defaultValue": { + "foo": "bar" + }, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": { + "integer": 2, + "string": "two", + "float": 2.0 + }, + "variant": "two", + "flagMetadata": { + "allocationKey": "50/50 split", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "json-config-flag", + "variationType": "JSON", + "defaultValue": { + "foo": "bar" + }, + "targetingKey": "diana", + "attributes": { + "Force Empty": true + }, + "result": { + "value": {}, + "variant": "empty", + "flagMetadata": { + "allocationKey": "Optionally Force Empty", + "variationType": "object", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-no-allocations-flag.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-no-allocations-flag.json new file mode 100644 index 00000000000..45867e5897c --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-no-allocations-flag.json @@ -0,0 +1,52 @@ +[ + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "message": "Hello, world!" + }, + "targetingKey": "alice", + "attributes": { + "email": "alice@mycompany.com", + "country": "US" + }, + "result": { + "value": { + "message": "Hello, world!" + } + } + }, + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "message": "Hello, world!" + }, + "targetingKey": "bob", + "attributes": { + "email": "bob@example.com", + "country": "Canada" + }, + "result": { + "value": { + "message": "Hello, world!" + } + } + }, + { + "flag": "no_allocations_flag", + "variationType": "JSON", + "defaultValue": { + "message": "Hello, world!" + }, + "targetingKey": "charlie", + "attributes": { + "age": 50 + }, + "result": { + "value": { + "message": "Hello, world!" + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-special-characters.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-special-characters.json new file mode 100644 index 00000000000..59ef5cbe87d --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-special-characters.json @@ -0,0 +1,78 @@ +[ + { + "flag": "special-characters", + "variationType": "JSON", + "defaultValue": {}, + "targetingKey": "ash", + "attributes": {}, + "result": { + "value": { + "a": "kümmert", + "b": "schön" + }, + "variant": "de", + "flagMetadata": { + "allocationKey": "allocation-test", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "special-characters", + "variationType": "JSON", + "defaultValue": {}, + "targetingKey": "ben", + "attributes": {}, + "result": { + "value": { + "a": "піклуватися", + "b": "любов" + }, + "variant": "ua", + "flagMetadata": { + "allocationKey": "allocation-test", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "special-characters", + "variationType": "JSON", + "defaultValue": {}, + "targetingKey": "cameron", + "attributes": {}, + "result": { + "value": { + "a": "照顾", + "b": "漂亮" + }, + "variant": "zh", + "flagMetadata": { + "allocationKey": "allocation-test", + "variationType": "object", + "doLog": true + } + } + }, + { + "flag": "special-characters", + "variationType": "JSON", + "defaultValue": {}, + "targetingKey": "darryl", + "attributes": {}, + "result": { + "value": { + "a": "🤗", + "b": "🌸" + }, + "variant": "emoji", + "flagMetadata": { + "allocationKey": "allocation-test", + "variationType": "object", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/openfeature/src/test/resources/data/test-string-with-special-characters.json b/dd-smoke-tests/openfeature/src/test/resources/data/test-string-with-special-characters.json new file mode 100644 index 00000000000..27d063122c0 --- /dev/null +++ b/dd-smoke-tests/openfeature/src/test/resources/data/test-string-with-special-characters.json @@ -0,0 +1,1190 @@ +[ + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_spaces", + "attributes": { + "string_with_spaces": true + }, + "result": { + "value": " a b c d e f ", + "variant": "string_with_spaces", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_spaces", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_space", + "attributes": { + "string_with_only_one_space": true + }, + "result": { + "value": " ", + "variant": "string_with_only_one_space", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_space", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_spaces", + "attributes": { + "string_with_only_multiple_spaces": true + }, + "result": { + "value": " ", + "variant": "string_with_only_multiple_spaces", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_spaces", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_dots", + "attributes": { + "string_with_dots": true + }, + "result": { + "value": ".a.b.c.d.e.f.", + "variant": "string_with_dots", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_dots", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_dot", + "attributes": { + "string_with_only_one_dot": true + }, + "result": { + "value": ".", + "variant": "string_with_only_one_dot", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_dot", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_dots", + "attributes": { + "string_with_only_multiple_dots": true + }, + "result": { + "value": ".......", + "variant": "string_with_only_multiple_dots", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_dots", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_comas", + "attributes": { + "string_with_comas": true + }, + "result": { + "value": ",a,b,c,d,e,f,", + "variant": "string_with_comas", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_comas", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_coma", + "attributes": { + "string_with_only_one_coma": true + }, + "result": { + "value": ",", + "variant": "string_with_only_one_coma", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_coma", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_comas", + "attributes": { + "string_with_only_multiple_comas": true + }, + "result": { + "value": ",,,,,,,", + "variant": "string_with_only_multiple_comas", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_comas", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_colons", + "attributes": { + "string_with_colons": true + }, + "result": { + "value": ":a:b:c:d:e:f:", + "variant": "string_with_colons", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_colons", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_colon", + "attributes": { + "string_with_only_one_colon": true + }, + "result": { + "value": ":", + "variant": "string_with_only_one_colon", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_colon", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_colons", + "attributes": { + "string_with_only_multiple_colons": true + }, + "result": { + "value": ":::::::", + "variant": "string_with_only_multiple_colons", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_colons", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_semicolons", + "attributes": { + "string_with_semicolons": true + }, + "result": { + "value": ";a;b;c;d;e;f;", + "variant": "string_with_semicolons", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_semicolons", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_semicolon", + "attributes": { + "string_with_only_one_semicolon": true + }, + "result": { + "value": ";", + "variant": "string_with_only_one_semicolon", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_semicolon", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_semicolons", + "attributes": { + "string_with_only_multiple_semicolons": true + }, + "result": { + "value": ";;;;;;;", + "variant": "string_with_only_multiple_semicolons", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_semicolons", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_slashes", + "attributes": { + "string_with_slashes": true + }, + "result": { + "value": "/a/b/c/d/e/f/", + "variant": "string_with_slashes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_slashes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_slash", + "attributes": { + "string_with_only_one_slash": true + }, + "result": { + "value": "/", + "variant": "string_with_only_one_slash", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_slash", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_slashes", + "attributes": { + "string_with_only_multiple_slashes": true + }, + "result": { + "value": "///////", + "variant": "string_with_only_multiple_slashes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_slashes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_dashes", + "attributes": { + "string_with_dashes": true + }, + "result": { + "value": "-a-b-c-d-e-f-", + "variant": "string_with_dashes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_dashes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_dash", + "attributes": { + "string_with_only_one_dash": true + }, + "result": { + "value": "-", + "variant": "string_with_only_one_dash", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_dash", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_dashes", + "attributes": { + "string_with_only_multiple_dashes": true + }, + "result": { + "value": "-------", + "variant": "string_with_only_multiple_dashes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_dashes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_underscores", + "attributes": { + "string_with_underscores": true + }, + "result": { + "value": "_a_b_c_d_e_f_", + "variant": "string_with_underscores", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_underscores", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_underscore", + "attributes": { + "string_with_only_one_underscore": true + }, + "result": { + "value": "_", + "variant": "string_with_only_one_underscore", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_underscore", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_underscores", + "attributes": { + "string_with_only_multiple_underscores": true + }, + "result": { + "value": "_______", + "variant": "string_with_only_multiple_underscores", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_underscores", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_plus_signs", + "attributes": { + "string_with_plus_signs": true + }, + "result": { + "value": "+a+b+c+d+e+f+", + "variant": "string_with_plus_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_plus_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_plus_sign", + "attributes": { + "string_with_only_one_plus_sign": true + }, + "result": { + "value": "+", + "variant": "string_with_only_one_plus_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_plus_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_plus_signs", + "attributes": { + "string_with_only_multiple_plus_signs": true + }, + "result": { + "value": "+++++++", + "variant": "string_with_only_multiple_plus_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_plus_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_equal_signs", + "attributes": { + "string_with_equal_signs": true + }, + "result": { + "value": "=a=b=c=d=e=f=", + "variant": "string_with_equal_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_equal_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_equal_sign", + "attributes": { + "string_with_only_one_equal_sign": true + }, + "result": { + "value": "=", + "variant": "string_with_only_one_equal_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_equal_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_equal_signs", + "attributes": { + "string_with_only_multiple_equal_signs": true + }, + "result": { + "value": "=======", + "variant": "string_with_only_multiple_equal_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_equal_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_dollar_signs", + "attributes": { + "string_with_dollar_signs": true + }, + "result": { + "value": "$a$b$c$d$e$f$", + "variant": "string_with_dollar_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_dollar_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_dollar_sign", + "attributes": { + "string_with_only_one_dollar_sign": true + }, + "result": { + "value": "$", + "variant": "string_with_only_one_dollar_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_dollar_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_dollar_signs", + "attributes": { + "string_with_only_multiple_dollar_signs": true + }, + "result": { + "value": "$$$$$$$", + "variant": "string_with_only_multiple_dollar_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_dollar_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_at_signs", + "attributes": { + "string_with_at_signs": true + }, + "result": { + "value": "@a@b@c@d@e@f@", + "variant": "string_with_at_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_at_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_at_sign", + "attributes": { + "string_with_only_one_at_sign": true + }, + "result": { + "value": "@", + "variant": "string_with_only_one_at_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_at_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_at_signs", + "attributes": { + "string_with_only_multiple_at_signs": true + }, + "result": { + "value": "@@@@@@@", + "variant": "string_with_only_multiple_at_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_at_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_amp_signs", + "attributes": { + "string_with_amp_signs": true + }, + "result": { + "value": "&a&b&c&d&e&f&", + "variant": "string_with_amp_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_amp_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_amp_sign", + "attributes": { + "string_with_only_one_amp_sign": true + }, + "result": { + "value": "&", + "variant": "string_with_only_one_amp_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_amp_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_amp_signs", + "attributes": { + "string_with_only_multiple_amp_signs": true + }, + "result": { + "value": "&&&&&&&", + "variant": "string_with_only_multiple_amp_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_amp_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_hash_signs", + "attributes": { + "string_with_hash_signs": true + }, + "result": { + "value": "#a#b#c#d#e#f#", + "variant": "string_with_hash_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_hash_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_hash_sign", + "attributes": { + "string_with_only_one_hash_sign": true + }, + "result": { + "value": "#", + "variant": "string_with_only_one_hash_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_hash_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_hash_signs", + "attributes": { + "string_with_only_multiple_hash_signs": true + }, + "result": { + "value": "#######", + "variant": "string_with_only_multiple_hash_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_hash_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_percentage_signs", + "attributes": { + "string_with_percentage_signs": true + }, + "result": { + "value": "%a%b%c%d%e%f%", + "variant": "string_with_percentage_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_percentage_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_percentage_sign", + "attributes": { + "string_with_only_one_percentage_sign": true + }, + "result": { + "value": "%", + "variant": "string_with_only_one_percentage_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_percentage_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_percentage_signs", + "attributes": { + "string_with_only_multiple_percentage_signs": true + }, + "result": { + "value": "%%%%%%%", + "variant": "string_with_only_multiple_percentage_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_percentage_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_tilde_signs", + "attributes": { + "string_with_tilde_signs": true + }, + "result": { + "value": "~a~b~c~d~e~f~", + "variant": "string_with_tilde_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_tilde_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_tilde_sign", + "attributes": { + "string_with_only_one_tilde_sign": true + }, + "result": { + "value": "~", + "variant": "string_with_only_one_tilde_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_tilde_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_tilde_signs", + "attributes": { + "string_with_only_multiple_tilde_signs": true + }, + "result": { + "value": "~~~~~~~", + "variant": "string_with_only_multiple_tilde_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_tilde_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_asterix_signs", + "attributes": { + "string_with_asterix_signs": true + }, + "result": { + "value": "*a*b*c*d*e*f*", + "variant": "string_with_asterix_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_asterix_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_asterix_sign", + "attributes": { + "string_with_only_one_asterix_sign": true + }, + "result": { + "value": "*", + "variant": "string_with_only_one_asterix_sign", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_asterix_sign", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_asterix_signs", + "attributes": { + "string_with_only_multiple_asterix_signs": true + }, + "result": { + "value": "*******", + "variant": "string_with_only_multiple_asterix_signs", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_asterix_signs", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_single_quotes", + "attributes": { + "string_with_single_quotes": true + }, + "result": { + "value": "'a'b'c'd'e'f'", + "variant": "string_with_single_quotes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_single_quotes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_single_quote", + "attributes": { + "string_with_only_one_single_quote": true + }, + "result": { + "value": "'", + "variant": "string_with_only_one_single_quote", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_single_quote", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_single_quotes", + "attributes": { + "string_with_only_multiple_single_quotes": true + }, + "result": { + "value": "'''''''", + "variant": "string_with_only_multiple_single_quotes", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_single_quotes", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_question_marks", + "attributes": { + "string_with_question_marks": true + }, + "result": { + "value": "?a?b?c?d?e?f?", + "variant": "string_with_question_marks", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_question_marks", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_question_mark", + "attributes": { + "string_with_only_one_question_mark": true + }, + "result": { + "value": "?", + "variant": "string_with_only_one_question_mark", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_question_mark", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_question_marks", + "attributes": { + "string_with_only_multiple_question_marks": true + }, + "result": { + "value": "???????", + "variant": "string_with_only_multiple_question_marks", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_question_marks", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_exclamation_marks", + "attributes": { + "string_with_exclamation_marks": true + }, + "result": { + "value": "!a!b!c!d!e!f!", + "variant": "string_with_exclamation_marks", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_exclamation_marks", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_exclamation_mark", + "attributes": { + "string_with_only_one_exclamation_mark": true + }, + "result": { + "value": "!", + "variant": "string_with_only_one_exclamation_mark", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_exclamation_mark", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_exclamation_marks", + "attributes": { + "string_with_only_multiple_exclamation_marks": true + }, + "result": { + "value": "!!!!!!!", + "variant": "string_with_only_multiple_exclamation_marks", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_exclamation_marks", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_opening_parentheses", + "attributes": { + "string_with_opening_parentheses": true + }, + "result": { + "value": "(a(b(c(d(e(f(", + "variant": "string_with_opening_parentheses", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_opening_parentheses", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_opening_parenthese", + "attributes": { + "string_with_only_one_opening_parenthese": true + }, + "result": { + "value": "(", + "variant": "string_with_only_one_opening_parenthese", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_opening_parenthese", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_opening_parentheses", + "attributes": { + "string_with_only_multiple_opening_parentheses": true + }, + "result": { + "value": "(((((((", + "variant": "string_with_only_multiple_opening_parentheses", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_opening_parentheses", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_closing_parentheses", + "attributes": { + "string_with_closing_parentheses": true + }, + "result": { + "value": ")a)b)c)d)e)f)", + "variant": "string_with_closing_parentheses", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_closing_parentheses", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_one_closing_parenthese", + "attributes": { + "string_with_only_one_closing_parenthese": true + }, + "result": { + "value": ")", + "variant": "string_with_only_one_closing_parenthese", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_one_closing_parenthese", + "variationType": "string", + "doLog": true + } + } + }, + { + "flag": "string_flag_with_special_characters", + "variationType": "STRING", + "defaultValue": "default_value", + "targetingKey": "string_with_only_multiple_closing_parentheses", + "attributes": { + "string_with_only_multiple_closing_parentheses": true + }, + "result": { + "value": ")))))))", + "variant": "string_with_only_multiple_closing_parentheses", + "flagMetadata": { + "allocationKey": "allocation-test-string_with_only_multiple_closing_parentheses", + "variationType": "string", + "doLog": true + } + } + } +] diff --git a/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy b/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy index 8bc5e2f5a33..0f01286e66f 100644 --- a/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy +++ b/dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy @@ -47,6 +47,15 @@ abstract class AbstractSmokeTest extends ProcessManager { @Shared private Throwable telemetryDecodingFailure = null + @Shared + private Closure decodeEvpMessage = decodedEvpProxyMessageCallback() + + @Shared + protected CopyOnWriteArrayList> evpProxyMessages = new CopyOnWriteArrayList() + + @Shared + private Throwable evpProxyMessageDecodingFailure = null + @Shared protected TestHttpServer.Headers lastTraceRequestHeaders = null @@ -70,7 +79,8 @@ abstract class AbstractSmokeTest extends ProcessManager { "endpoints": [ "/v0.4/traces", "/v0.5/traces", - "/telemetry/proxy/" + "/telemetry/proxy/", + "/evp_proxy/v2/" ], "client_drop_p0s": true, "span_meta_structs": true, @@ -165,6 +175,19 @@ abstract class AbstractSmokeTest extends ProcessManager { } response.status(202).send() } + prefix("/evp_proxy/v2/") { + try { + final path = request.path.toString() + final body = request.getBody() + final decoded = decodeEvpMessage?.call(path, body) + if (decoded) { + evpProxyMessages.add(new Tuple2<>(path, decoded)) + } + } catch (Throwable t) { + evpProxyMessageDecodingFailure = t + } + response.status(200).send() + } } } @@ -252,6 +275,10 @@ abstract class AbstractSmokeTest extends ProcessManager { if (traceDecodingFailure != null) { throw traceDecodingFailure } + evpProxyMessages.clear() + if (evpProxyMessageDecodingFailure) { + throw evpProxyMessageDecodingFailure + } } def setupSpec() { @@ -275,6 +302,10 @@ abstract class AbstractSmokeTest extends ProcessManager { null } + Closure decodedEvpProxyMessageCallback() { + null + } + void setRemoteConfig(String path, String jsonData) { def targets = """ { @@ -378,6 +409,21 @@ abstract class AbstractSmokeTest extends ProcessManager { return message } + Tuple2 waitForEvpProxyMessage(final Function, Boolean> predicate) { + waitForEvpProxyMessage(defaultPoll, predicate) + } + + Tuple2 waitForEvpProxyMessage(final PollingConditions poll, final Function, Boolean> predicate) { + def message = null + poll.eventually { + if (evpProxyMessageDecodingFailure != null) { + throw evpProxyMessageDecodingFailure + } + assert (message = evpProxyMessages.find { predicate.apply(it) }) != null + } + return message + } + List getTraces() { decodeTraces } diff --git a/settings.gradle.kts b/settings.gradle.kts index dcead141778..f53a7d27e02 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -188,6 +188,7 @@ include( ":dd-smoke-tests:lib-injection", ":dd-smoke-tests:log-injection", ":dd-smoke-tests:maven", + ":dd-smoke-tests:openfeature", ":dd-smoke-tests:opentracing", ":dd-smoke-tests:opentelemetry", ":dd-smoke-tests:osgi",