rox-rollout 4.7.3 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +34 -13
- data/.editorconfig +12 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.rubocop.yml +17 -0
- data/Gemfile +2 -2
- data/README.md +32 -0
- data/Rakefile +12 -9
- data/bin/console +3 -4
- data/e2e-server/run_server.sh +12 -0
- data/e2e-server/server.rb +158 -0
- data/e2e/container.rb +11 -14
- data/e2e/custom_props.rb +9 -9
- data/e2e/rox_e2e_test.rb +17 -19
- data/e2e/test_vars.rb +3 -6
- data/example/local.rb +40 -0
- data/lib/rox/core/analytics.rb +18 -0
- data/lib/rox/core/client/buid.rb +8 -8
- data/lib/rox/core/client/device_properties.rb +7 -1
- data/lib/rox/core/client/dynamic_api.rb +53 -15
- data/lib/rox/core/client/internal_flags.rb +14 -2
- data/lib/rox/core/client/sdk_settings.rb +1 -1
- data/lib/rox/core/configuration/configuration.rb +1 -1
- data/lib/rox/core/configuration/configuration_fetched_args.rb +2 -2
- data/lib/rox/core/configuration/configuration_fetched_invoker.rb +8 -3
- data/lib/rox/core/configuration/configuration_parser.rb +38 -37
- data/lib/rox/core/configuration/fetcher_error.rb +1 -1
- data/lib/rox/core/configuration/fetcher_status.rb +1 -1
- data/lib/rox/core/configuration/models/experiment_model.rb +1 -1
- data/lib/rox/core/configuration/models/target_group_model.rb +1 -1
- data/lib/rox/core/consts/build.rb +2 -2
- data/lib/rox/core/consts/environment.rb +10 -8
- data/lib/rox/core/consts/property_type.rb +16 -17
- data/lib/rox/core/context/merged_context.rb +2 -1
- data/lib/rox/core/core.rb +88 -38
- data/lib/rox/core/entities/default_flag_values.rb +10 -0
- data/lib/rox/core/entities/flag.rb +22 -7
- data/lib/rox/core/entities/flag_setter.rb +6 -6
- data/lib/rox/core/entities/rox_double.rb +11 -0
- data/lib/rox/core/entities/rox_int.rb +11 -0
- data/lib/rox/core/entities/{variant.rb → rox_string.rb} +20 -13
- data/lib/rox/core/error_handling/exception_trigger.rb +10 -0
- data/lib/rox/core/error_handling/userspace_handler_exception.rb +12 -0
- data/lib/rox/core/error_handling/userspace_unhandled_error_invoker.rb +41 -0
- data/lib/rox/core/impression/impression_args.rb +2 -2
- data/lib/rox/core/impression/impression_invoker.rb +41 -7
- data/lib/rox/core/impression/models/experiment.rb +1 -1
- data/lib/rox/core/impression/models/reporting_value.rb +10 -2
- data/lib/rox/core/logging/logging.rb +3 -3
- data/lib/rox/core/logging/no_op_logger.rb +1 -1
- data/lib/rox/core/network/configuration_fetcher.rb +2 -2
- data/lib/rox/core/network/configuration_fetcher_roxy.rb +2 -2
- data/lib/rox/core/network/configuration_fetcher_self_managed.rb +30 -0
- data/lib/rox/core/network/configuration_source.rb +1 -1
- data/lib/rox/core/network/request.rb +1 -1
- data/lib/rox/core/network/request_configuration_builder.rb +5 -5
- data/lib/rox/core/network/request_data.rb +1 -1
- data/lib/rox/core/network/response.rb +6 -8
- data/lib/rox/core/network/state_sender.rb +61 -18
- data/lib/rox/core/notifications/notification_listener.rb +4 -4
- data/lib/rox/core/properties/custom_property.rb +1 -1
- data/lib/rox/core/properties/custom_property_type.rb +1 -1
- data/lib/rox/core/properties/device_property.rb +2 -2
- data/lib/rox/core/properties/property_factory.rb +132 -0
- data/lib/rox/core/register/registerer.rb +13 -12
- data/lib/rox/core/reporting/error_reporter.rb +14 -13
- data/lib/rox/core/repositories/experiment_repository.rb +2 -4
- data/lib/rox/core/repositories/flag_repository.rb +7 -7
- data/lib/rox/core/repositories/roxx/experiments_extensions.rb +8 -8
- data/lib/rox/core/repositories/roxx/properties_extensions.rb +32 -7
- data/lib/rox/core/repositories/target_group_repository.rb +2 -4
- data/lib/rox/core/roxx/evaluation_result.rb +2 -0
- data/lib/rox/core/roxx/node.rb +1 -1
- data/lib/rox/core/roxx/parser.rb +35 -21
- data/lib/rox/core/roxx/regular_expression_extensions.rb +6 -3
- data/lib/rox/core/roxx/string_tokenizer.rb +3 -1
- data/lib/rox/core/roxx/symbols.rb +1 -1
- data/lib/rox/core/roxx/token_type.rb +1 -1
- data/lib/rox/core/roxx/tokenized_expression.rb +16 -12
- data/lib/rox/core/roxx/value_compare_extensions.rb +49 -29
- data/lib/rox/core/security/signature_verifier.rb +3 -3
- data/lib/rox/core/security/signature_verifier_mock.rb +12 -0
- data/lib/rox/core/utils/type_utils.rb +1 -1
- data/lib/rox/server/client/server_properties.rb +1 -1
- data/lib/rox/server/flags/normalize_flag_type.rb +25 -0
- data/lib/rox/server/flags/rox_double.rb +8 -0
- data/lib/rox/server/flags/rox_flag.rb +1 -1
- data/lib/rox/server/flags/rox_int.rb +8 -0
- data/lib/rox/server/flags/rox_string.rb +8 -0
- data/lib/rox/server/flags/server_entities_provider.rb +14 -4
- data/lib/rox/server/logging/server_logger.rb +2 -2
- data/lib/rox/server/rox_options.rb +39 -8
- data/lib/rox/server/rox_server.rb +80 -59
- data/lib/rox/version.rb +1 -1
- data/rox.gemspec +11 -9
- metadata +66 -37
- data/CODEOWNERS +0 -1
- data/README_DEVELOP.md +0 -25
- data/_archive/.document +0 -5
- data/_archive/.rspec +0 -1
- data/_archive/Gemfile +0 -15
- data/_archive/README.md +0 -32
- data/_archive/README.rdoc +0 -19
- data/_archive/Rakefile +0 -50
- data/_archive/lib/expr_function_definition.rb +0 -52
- data/_archive/lib/function_definition.rb +0 -48
- data/_archive/lib/function_token.rb +0 -12
- data/_archive/lib/object_extends.rb +0 -12
- data/_archive/lib/ruby_interpreter.rb +0 -292
- data/_archive/lib/stack.rb +0 -48
- data/_archive/lib/string_extends.rb +0 -14
- data/_archive/spec/ruby_interpreter_spec.rb +0 -203
- data/_archive/spec/spec_helper.rb +0 -30
- data/_archive/spec/stack_spec.rb +0 -77
- data/lib/rox/server/flags/rox_variant.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26085340d144a78eaae9eb85e07374d912d1fd2e516fdb51f38e940028ca191b
|
4
|
+
data.tar.gz: 7bc2113d91aeab8e2778a1c0b71d3c1ebd340b902b8b4a48483d5e1a74f59d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5385b8da1f783e23b029834f7cb811c8f233ad962aa432447ea5766691610f6cdf63beca6d4d10bd43ee21b8bb2942bd56c78aa97134d6444886f4bbf22b31
|
7
|
+
data.tar.gz: ec71870af8f708fb7941a7455d130b672951f8119e793fb3590188b61fe61ea8fdff4823c9efb48f51beb2eab269bcabdffcc7f6bd488555da764d9b0eedc60a
|
data/.circleci/config.yml
CHANGED
@@ -1,14 +1,6 @@
|
|
1
|
-
version: 2
|
2
|
-
workflows:
|
3
|
-
version: 2
|
4
|
-
test:
|
5
|
-
jobs:
|
6
|
-
- test-2.6
|
7
|
-
- test-2.5
|
8
|
-
- test-2.4
|
9
|
-
- test-2.3
|
1
|
+
version: 2.1
|
10
2
|
jobs:
|
11
|
-
|
3
|
+
test_2-6: &test-template
|
12
4
|
docker:
|
13
5
|
- image: circleci/ruby:2.6.4
|
14
6
|
|
@@ -38,15 +30,44 @@ jobs:
|
|
38
30
|
command: |
|
39
31
|
bundle exec rake e2e
|
40
32
|
|
41
|
-
|
33
|
+
test_2-5:
|
42
34
|
<<: *test-template
|
43
35
|
docker:
|
44
36
|
- image: circleci/ruby:2.5.6
|
45
|
-
|
37
|
+
test_2-4:
|
46
38
|
<<: *test-template
|
47
39
|
docker:
|
48
40
|
- image: circleci/ruby:2.4.7
|
49
|
-
|
41
|
+
test_2-3:
|
50
42
|
<<: *test-template
|
51
43
|
docker:
|
52
44
|
- image: circleci/ruby:2.3.8
|
45
|
+
|
46
|
+
sdk-integration-test:
|
47
|
+
<<: *test-template
|
48
|
+
steps:
|
49
|
+
- run:
|
50
|
+
name: trigger sdk integration test workflow
|
51
|
+
command: >-
|
52
|
+
curl -X POST https://circleci.com/api/v2/project/gh/rollout/sdk-integration-tests/pipeline
|
53
|
+
--header 'Content-Type: application/json'
|
54
|
+
--header 'Accept: application/json'
|
55
|
+
--header 'x-attribution-login: rox-ruby'
|
56
|
+
--header 'x-attribution-actor-id: rox-ruby'
|
57
|
+
--header 'Circle-Token: '$CircleApiToken
|
58
|
+
--data '{"parameters": {"sdk_triggered_run": true, "repo_name": "'$CIRCLE_PROJECT_REPONAME'", "repo_owner": "'$CIRCLE_PROJECT_USERNAME'", "sha": "'$CIRCLE_SHA1'" }}'
|
59
|
+
|
60
|
+
workflows:
|
61
|
+
version: 2
|
62
|
+
test:
|
63
|
+
jobs:
|
64
|
+
- test_2-6
|
65
|
+
- test_2-5
|
66
|
+
- test_2-4
|
67
|
+
- test_2-3
|
68
|
+
- sdk-integration-test:
|
69
|
+
requires:
|
70
|
+
- test_2-6
|
71
|
+
- test_2-5
|
72
|
+
- test_2-4
|
73
|
+
- test_2-3
|
data/.editorconfig
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
strategy:
|
8
|
+
fail-fast: false
|
9
|
+
matrix:
|
10
|
+
os: [ubuntu-latest]
|
11
|
+
ruby: [2.4, 2.5, 2.6, 2.7, 3.0]
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
19
|
+
- run: bundle exec rake test
|
20
|
+
- run: bundle exec rake e2e
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
|
4
|
+
Metrics/BlockLength:
|
5
|
+
Exclude:
|
6
|
+
- test/**/*.rb
|
7
|
+
- e2e/**/*.rb
|
8
|
+
- e2e-server/**/*.rb
|
9
|
+
|
10
|
+
Metrics/ClassLength:
|
11
|
+
Exclude:
|
12
|
+
- test/**/*.rb
|
13
|
+
|
14
|
+
Style/FrozenStringLiteralComment:
|
15
|
+
Enabled: false
|
16
|
+
Style/IfUnlessModifier:
|
17
|
+
Enabled: false
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in rox.gemspec
|
6
6
|
gemspec
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# ROX SDK for Ruby
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rox-rollout.svg)](https://badge.fury.io/rb/rox-rollout)
|
4
|
+
|
5
|
+
Ruby supported versions: 2.3.x, 2.4.x, 2.5.x, 2.6.x
|
6
|
+
|
7
|
+
## Run tests
|
8
|
+
|
9
|
+
Unit tests (folder tests)
|
10
|
+
```bash
|
11
|
+
bundle exec rake test
|
12
|
+
```
|
13
|
+
|
14
|
+
E2E tests (folder e2e)
|
15
|
+
```bash
|
16
|
+
bundle exec rake e2e
|
17
|
+
```
|
18
|
+
|
19
|
+
## Run linter (rubocop)
|
20
|
+
|
21
|
+
```bash
|
22
|
+
bundle exec rake lint
|
23
|
+
```
|
24
|
+
|
25
|
+
## Publish new version
|
26
|
+
|
27
|
+
1. Increment version in ```lib/rox/version.rb```, open a PR and wait for CI to complete workflows
|
28
|
+
2. Merge to master, wait for CI to complete workflows
|
29
|
+
2. Generate the gem package: ```gem build rox.gemspec```
|
30
|
+
3. Install gem locally, and test with a sample project
|
31
|
+
4. Upload to RubyGems: ```gem push rox-rollout-VERSION.gem```
|
32
|
+
5. Celebrate! 🎉
|
data/Rakefile
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rubocop/rake_task'
|
3
4
|
|
4
5
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.test_files = FileList[
|
6
|
+
t.libs << 'test'
|
7
|
+
t.libs << 'lib'
|
8
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
9
|
end
|
9
10
|
|
10
11
|
Rake::TestTask.new(:e2e) do |t|
|
11
|
-
t.libs <<
|
12
|
-
t.libs <<
|
13
|
-
t.test_files = FileList[
|
12
|
+
t.libs << 'lib'
|
13
|
+
t.libs << 'e2e'
|
14
|
+
t.test_files = FileList['e2e/**/*_test.rb']
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
+
RuboCop::RakeTask.new(:lint)
|
18
|
+
|
19
|
+
task default: :test
|
data/bin/console
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require
|
4
|
-
require "rox"
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rox'
|
5
4
|
|
6
5
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
6
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +9,5 @@ require "rox"
|
|
10
9
|
# require "pry"
|
11
10
|
# Pry.start
|
12
11
|
|
13
|
-
require
|
12
|
+
require 'irb'
|
14
13
|
IRB.start(__FILE__)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/bash -x
|
2
|
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
3
|
+
cd -P "$DIR"
|
4
|
+
DIR=`pwd`
|
5
|
+
gem install sinatra
|
6
|
+
gem install sinatra-contrib
|
7
|
+
gem install json
|
8
|
+
nohup ruby ./server.rb $1 1>"$DIR"/log_"$1".out 2>&1 &
|
9
|
+
while true ; do
|
10
|
+
curl -p http://127.0.0.1:$1/status-check && exit
|
11
|
+
sleep 1
|
12
|
+
done
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'sinatra/namespace'
|
3
|
+
require 'json'
|
4
|
+
require 'rox/server/flags/rox_flag'
|
5
|
+
require 'rox/server/rox_server'
|
6
|
+
require 'rox/server/rox_options'
|
7
|
+
|
8
|
+
class Container
|
9
|
+
attr_accessor :first_flag
|
10
|
+
attr_reader :bool_default_false, :bool_default_true
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@bool_default_false = Rox::Server::RoxFlag.new(false)
|
14
|
+
@bool_default_true = Rox::Server::RoxFlag.new(true)
|
15
|
+
@first_flag = Rox::Server::RoxFlag.new(true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class ServerLogger
|
20
|
+
def initialize
|
21
|
+
@logger = Logger.new($stdout)
|
22
|
+
end
|
23
|
+
|
24
|
+
def debug(message, exception = nil)
|
25
|
+
if exception.nil?
|
26
|
+
@logger.debug(message)
|
27
|
+
else
|
28
|
+
@logger.debug("#{message}. Exception: #{exception}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def error(message, exception = nil)
|
33
|
+
if exception.nil?
|
34
|
+
@logger.error(message)
|
35
|
+
else
|
36
|
+
@logger.error("#{message}. Exception: #{exception}")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def warn(message, exception = nil)
|
41
|
+
if exception.nil?
|
42
|
+
@logger.warn(message)
|
43
|
+
else
|
44
|
+
@logger.warn("#{message}. Exception: #{exception}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
container = Container.new
|
50
|
+
set :port, ARGV[0]
|
51
|
+
|
52
|
+
namespace '/' do
|
53
|
+
before do
|
54
|
+
content_type 'application/json'
|
55
|
+
end
|
56
|
+
|
57
|
+
get 'status-check' do
|
58
|
+
[200, '']
|
59
|
+
end
|
60
|
+
|
61
|
+
get 'api/values/:id' do |id|
|
62
|
+
if container.first_flag.enabled?
|
63
|
+
[200, JSON.generate({ value: id })]
|
64
|
+
else
|
65
|
+
[200, 'Eladddddd']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
put 'api/values/:id' do
|
70
|
+
[200, '']
|
71
|
+
end
|
72
|
+
|
73
|
+
delete 'api/values/:id' do
|
74
|
+
[200, '']
|
75
|
+
end
|
76
|
+
|
77
|
+
post '' do
|
78
|
+
data = JSON.parse(request.body.read)
|
79
|
+
action = data['action']
|
80
|
+
payload = data['payload']
|
81
|
+
puts data
|
82
|
+
|
83
|
+
case action
|
84
|
+
when 'staticFlagIsEnabled'
|
85
|
+
flag = payload['flag']
|
86
|
+
result = container.send(flag.to_sym).enabled?(payload['context'])
|
87
|
+
[200, JSON.generate({ result: result })]
|
88
|
+
when 'registerStaticContainers'
|
89
|
+
Rox::Server::RoxServer.register(container)
|
90
|
+
[200, JSON.generate({ result: 'done' })]
|
91
|
+
when 'setCustomPropertyToThrow'
|
92
|
+
def raise_(ex)
|
93
|
+
raise ex
|
94
|
+
end
|
95
|
+
Rox::Server::RoxServer.set_custom_string_property(payload['key'], raise_(Exception('error')))
|
96
|
+
[200, JSON.generate({ result: 'done' })]
|
97
|
+
when 'setCustomStringProperty'
|
98
|
+
Rox::Server::RoxServer.set_custom_string_property(payload['key'], payload['value'])
|
99
|
+
[200, JSON.generate({ result: 'done' })]
|
100
|
+
when 'dynamicFlagValue'
|
101
|
+
if payload['context']
|
102
|
+
puts "There is a payload[context] => #{payload['context']}"
|
103
|
+
payload['context'].each do |context|
|
104
|
+
key = context[0]
|
105
|
+
value = context[1]
|
106
|
+
Rox::Server::RoxServer.set_custom_string_property(key, value) if value.instance_of? String
|
107
|
+
if value.instance_of? TrueClass
|
108
|
+
Rox::Server::RoxServer.set_custom_boolean_property(key, value)
|
109
|
+
elsif value.instance_of? FalseClass
|
110
|
+
Rox::Server::RoxServer.set_custom_boolean_property(key, value)
|
111
|
+
end
|
112
|
+
Rox::Server::RoxServer.set_custom_int_property(key, value) if value.instance_of? Integer
|
113
|
+
Rox::Server::RoxServer.set_custom_float_property(key, value) if value.instance_of? Float
|
114
|
+
end
|
115
|
+
end
|
116
|
+
result = Rox::Server::RoxServer.dynamic_api.value(payload['flag'], payload['defaultValue'], payload['context'],
|
117
|
+
[])
|
118
|
+
[200, JSON.generate({ result: result })]
|
119
|
+
when 'dynamicFlagIsEnabled'
|
120
|
+
payload['context']&.each do |context|
|
121
|
+
key = context[0]
|
122
|
+
value = context[1]
|
123
|
+
Rox::Server::RoxServer.set_custom_string_property(key, value) if value.instance_of? String
|
124
|
+
if value.instance_of? TrueClass
|
125
|
+
Rox::Server::RoxServer.set_custom_boolean_property(key, value)
|
126
|
+
elsif value.instance_of? FalseClass
|
127
|
+
Rox::Server::RoxServer.set_custom_boolean_property(key, value)
|
128
|
+
end
|
129
|
+
Rox::Server::RoxServer.set_custom_int_property(key, value) if value.instance_of? Integer
|
130
|
+
Rox::Server::RoxServer.set_custom_float_property(key, value) if value.instance_of? Float
|
131
|
+
end
|
132
|
+
result = Rox::Server::RoxServer.dynamic_api.enabled?(payload['flag'], payload['defaultValue'], payload['context'])
|
133
|
+
[200, JSON.generate({ result: result })]
|
134
|
+
when 'setupAndAwait'
|
135
|
+
env = 'stam'
|
136
|
+
if payload['options']
|
137
|
+
options = payload['options']
|
138
|
+
if options['configuration']
|
139
|
+
configuration = options['configuration']
|
140
|
+
env = configuration['env']
|
141
|
+
end
|
142
|
+
end
|
143
|
+
case env
|
144
|
+
when 'qa'
|
145
|
+
ENV['ROLLOUT_MODE'] = 'QA'
|
146
|
+
when 'localhost'
|
147
|
+
ENV['ROLLOUT_MODE'] = 'LOCAL'
|
148
|
+
end
|
149
|
+
options = Rox::Server::RoxOptions.new(logger: ServerLogger.new)
|
150
|
+
puts "options => #{options}"
|
151
|
+
Rox::Server::RoxServer.setup(payload['key'], options).value
|
152
|
+
[200, JSON.generate({ result: 'done' })]
|
153
|
+
when 'stop'
|
154
|
+
Thread.new { sleep 1; Process.kill 'INT', Process.pid }
|
155
|
+
halt 200, JSON.generate({ result: 'done' })
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
data/e2e/container.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
require 'rox/server/flags/rox_flag'
|
2
|
-
require 'rox/server/flags/
|
2
|
+
require 'rox/server/flags/rox_string'
|
3
3
|
|
4
4
|
module E2E
|
5
5
|
class Container
|
6
|
-
attr_accessor :simple_flag, :simple_flag_overwritten
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
attr_accessor :variant, :variant_overwritten
|
12
|
-
attr_accessor :flag_for_dependency, :flag_colors_for_dependency, :flag_dependent, :flag_color_dependent_with_context
|
6
|
+
attr_accessor :simple_flag, :simple_flag_overwritten, :flag_for_impression,
|
7
|
+
:flag_for_impression_with_experiment_and_context, :flag_custom_properties,
|
8
|
+
:flag_target_groups_all, :flag_target_groups_any, :flag_target_groups_none,
|
9
|
+
:variant_with_context, :variant, :variant_overwritten, :flag_for_dependency,
|
10
|
+
:flag_dependent, :flag_color_dependent_with_context
|
13
11
|
|
14
12
|
def initialize
|
15
13
|
@simple_flag = Rox::Server::RoxFlag.new(true)
|
@@ -24,15 +22,14 @@ module E2E
|
|
24
22
|
@flag_target_groups_any = Rox::Server::RoxFlag.new
|
25
23
|
@flag_target_groups_none = Rox::Server::RoxFlag.new
|
26
24
|
|
27
|
-
@variant_with_context = Rox::Server::
|
25
|
+
@variant_with_context = Rox::Server::RoxString.new('red', %w[red blue green])
|
28
26
|
|
29
|
-
@variant = Rox::Server::
|
30
|
-
@variant_overwritten = Rox::Server::
|
27
|
+
@variant = Rox::Server::RoxString.new('red', %w[red blue green])
|
28
|
+
@variant_overwritten = Rox::Server::RoxString.new('red', %w[red blue green])
|
31
29
|
|
32
30
|
@flag_for_dependency = Rox::Server::RoxFlag.new(false)
|
33
|
-
@flag_colors_for_dependency = Rox::Server::RoxVariant.new('White', ['White', 'Blue', 'Green', 'Yellow'])
|
34
31
|
@flag_dependent = Rox::Server::RoxFlag.new(false)
|
35
|
-
@flag_color_dependent_with_context = Rox::Server::
|
32
|
+
@flag_color_dependent_with_context = Rox::Server::RoxString.new('White', %w[White Blue Green Yellow])
|
36
33
|
end
|
37
34
|
end
|
38
|
-
end
|
35
|
+
end
|
data/e2e/custom_props.rb
CHANGED
@@ -2,31 +2,31 @@ module E2E
|
|
2
2
|
class CustomProps
|
3
3
|
def self.create_custom_props
|
4
4
|
Rox::Server::RoxServer.set_custom_string_property('string_prop1', 'Hello')
|
5
|
-
Rox::Server::RoxServer.set_custom_string_property('string_prop2') do |
|
5
|
+
Rox::Server::RoxServer.set_custom_string_property('string_prop2') do |_context|
|
6
6
|
TestVars.is_computed_string_prop_called = true
|
7
7
|
'World'
|
8
8
|
end
|
9
9
|
|
10
10
|
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop1', true)
|
11
|
-
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop2') do |
|
11
|
+
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop2') do |_context|
|
12
12
|
TestVars.is_computed_boolean_prop_called = true
|
13
13
|
false
|
14
14
|
end
|
15
15
|
|
16
16
|
Rox::Server::RoxServer.set_custom_int_property('int_prop1', 6)
|
17
|
-
Rox::Server::RoxServer.set_custom_int_property('int_prop2') do |
|
17
|
+
Rox::Server::RoxServer.set_custom_int_property('int_prop2') do |_context|
|
18
18
|
TestVars.is_computed_int_prop_called = true
|
19
19
|
28
|
20
20
|
end
|
21
21
|
|
22
22
|
Rox::Server::RoxServer.set_custom_float_property('float_prop1', 3.14)
|
23
|
-
Rox::Server::RoxServer.set_custom_float_property('float_prop2') do |
|
23
|
+
Rox::Server::RoxServer.set_custom_float_property('float_prop2') do |_context|
|
24
24
|
TestVars.is_computed_float_prop_called = true
|
25
25
|
1.618
|
26
26
|
end
|
27
27
|
|
28
28
|
Rox::Server::RoxServer.set_custom_semver_property('smvr_prop1', '9.11.2001')
|
29
|
-
Rox::Server::RoxServer.set_custom_semver_property('smvr_prop2') do |
|
29
|
+
Rox::Server::RoxServer.set_custom_semver_property('smvr_prop2') do |_context|
|
30
30
|
TestVars.is_computed_semver_prop_called = true
|
31
31
|
'20.7.1969'
|
32
32
|
end
|
@@ -35,15 +35,15 @@ module E2E
|
|
35
35
|
context['isDuckAndCover']
|
36
36
|
end
|
37
37
|
|
38
|
-
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_operand1') do |
|
38
|
+
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_operand1') do |_context|
|
39
39
|
TestVars.target_group1
|
40
40
|
end
|
41
41
|
|
42
|
-
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_operand2') do |
|
42
|
+
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_operand2') do |_context|
|
43
43
|
TestVars.target_group2
|
44
44
|
end
|
45
45
|
|
46
|
-
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_for_dependency') do |
|
46
|
+
Rox::Server::RoxServer.set_custom_boolean_property('bool_prop_target_group_for_dependency') do |_context|
|
47
47
|
TestVars.is_prop_for_target_group_for_dependency
|
48
48
|
end
|
49
49
|
|
@@ -52,4 +52,4 @@ module E2E
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
end
|
55
|
+
end
|