Skip to content

Commit ec42e30

Browse files
authored
chore: updated to use v2 configs (#110)
1 parent e5d0ac1 commit ec42e30

File tree

8 files changed

+19
-14
lines changed

8 files changed

+19
-14
lines changed

.github/workflows/test-harness.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Run Test Harness
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
harness-tests:
@@ -14,4 +14,3 @@ jobs:
1414
with:
1515
sdks-to-test: ruby
1616
sdk-github-sha: ${{github.event.pull_request.head.sha}}
17-
github-token: ${{ secrets.TEST_HARNESS_GH_SECRET }}

.github/workflows/unit-tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
strategy:
1717
matrix:
1818
ruby-version: [ '3.1.0', '3.2.0', '3.3.0' ]
19-
19+
env:
20+
DEVCYCLE_SERVER_SDK_KEY: ${{ secrets.DEVCYCLE_SERVER_SDK_KEY_UNIT_TESTS }}
2021
steps:
2122
- uses: actions/checkout@v4
2223
- name: Set up Ruby

benchmark/benchmark.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
WebMock.enable!
88
WebMock.disable_net_connect!
99

10-
stub_request(:get, 'https://config-cdn.devcycle.com/config/v1/server/dvc_server_token_hash.json').
10+
stub_request(:get, 'https://config-cdn.devcycle.com/config/v2/server/dvc_server_token_hash.json').
1111
to_return(headers: { 'Etag': 'test' }, body: File.new('../examples/local/local-bucketing-example/test_data/large_config.json'), status: 200)
1212

1313
stub_request(:post, 'https://events.devcycle.com/v1/events/batch').

examples/local/config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
WebMock.disable_net_connect!
2828

2929
config_path = File.expand_path('../test_data/large_config.json', __dir__)
30-
stub_request(:get, "https://config-cdn.devcycle.com/config/v1/server/#{ENV['DEVCYCLE_SERVER_SDK_KEY']}.json").
30+
stub_request(:get, "https://config-cdn.devcycle.com/config/v2/server/#{ENV['DEVCYCLE_SERVER_SDK_KEY']}.json").
3131
to_return(headers: { 'Etag': 'test' }, body: File.new(config_path).read, status: 200)
3232

3333
stub_request(:post, 'https://events.devcycle.com/v1/events/batch').
Binary file not shown.

lib/devcycle-ruby-server-sdk/localbucketing/config_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ConfigManager
1717
).void }
1818
def initialize(sdkKey, local_bucketing, wait_for_init)
1919
@first_load = true
20-
@config_version = "v1"
20+
@config_version = "v2"
2121
@local_bucketing = local_bucketing
2222
@sdkKey = sdkKey
2323
@sse_url = ""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
BUCKETING_LIB_VERSION="1.24.2"
2+
BUCKETING_LIB_VERSION="1.25.3"
33
WAT_DOWNLOAD=0
44
rm bucketing-lib.release.wasm
55
wget "https://unpkg.com/@devcycle/bucketing-assembly-script@$BUCKETING_LIB_VERSION/build/bucketing-lib.release.wasm"

spec/api/devcycle_api_spec.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
# Please update as you see appropriate
1919
describe 'DevCycle::Client' do
2020
before(:all) do
21+
sdk_key = ENV["DEVCYCLE_SERVER_SDK_KEY"]
22+
if sdk_key.nil?
23+
puts("SDK KEY NOT SET - SKIPPING INIT")
24+
return
25+
end
2126
# run before each test
2227
options = DevCycle::Options.new(enable_cloud_bucketing: true)
23-
@api_instance = DevCycle::Client.new("dvc_server_token_hash", options)
28+
@api_instance = DevCycle::Client.new(sdk_key, options)
2429

2530
@user = DevCycle::User.new({
2631
user_id: 'test-user',
@@ -57,12 +62,12 @@
5762
# @param user
5863
# @param [Hash] opts the optional parameters
5964
# @return [Variable]
60-
describe 'get_variable_by_key activate-flag' do
65+
describe 'get_variable_by_key ruby-example-tests' do
6166
it 'should work' do
62-
result = @api_instance.variable(@user, "activate-flag", false)
67+
result = @api_instance.variable(@user, "ruby-example-tests-default", false)
6368
expect(result.isDefaulted).to eq true
6469

65-
result = @api_instance.variable_value(@user, "activate-flag", true)
70+
result = @api_instance.variable_value(@user, "ruby-example-tests-default", true)
6671
expect(result).to eq true
6772
end
6873
end
@@ -75,11 +80,11 @@
7580
# @return [Variable]
7681
describe 'get_variable_by_key test' do
7782
it 'should work' do
78-
result = @api_instance.variable(@user, "test", false)
83+
result = @api_instance.variable(@user, "ruby-example-tests", false)
7984
expect(result.isDefaulted).to eq false
8085
expect(result.value).to eq true
8186

82-
result = @api_instance.variable_value(@user, "test", true)
87+
result = @api_instance.variable_value(@user, "ruby-example-tests", true)
8388
expect(result).to eq true
8489
end
8590
end
@@ -93,7 +98,7 @@
9398
it 'should work' do
9499
result = @api_instance.all_variables(@user)
95100

96-
expect(result.length).to eq 5
101+
expect(result.length >= 1).to eq true
97102
end
98103
end
99104

0 commit comments

Comments
 (0)