Skip to content

Commit

Permalink
chore: updated to use v2 configs (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsalaber authored Aug 22, 2024
1 parent e5d0ac1 commit ec42e30
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Test Harness

on:
pull_request:
branches: [ main ]
branches: [main]

jobs:
harness-tests:
Expand All @@ -14,4 +14,3 @@ jobs:
with:
sdks-to-test: ruby
sdk-github-sha: ${{github.event.pull_request.head.sha}}
github-token: ${{ secrets.TEST_HARNESS_GH_SECRET }}
3 changes: 2 additions & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
strategy:
matrix:
ruby-version: [ '3.1.0', '3.2.0', '3.3.0' ]

env:
DEVCYCLE_SERVER_SDK_KEY: ${{ secrets.DEVCYCLE_SERVER_SDK_KEY_UNIT_TESTS }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
WebMock.enable!
WebMock.disable_net_connect!

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

stub_request(:post, 'https://events.devcycle.com/v1/events/batch').
Expand Down
2 changes: 1 addition & 1 deletion examples/local/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
WebMock.disable_net_connect!

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

stub_request(:post, 'https://events.devcycle.com/v1/events/batch').
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConfigManager
).void }
def initialize(sdkKey, local_bucketing, wait_for_init)
@first_load = true
@config_version = "v1"
@config_version = "v2"
@local_bucketing = local_bucketing
@sdkKey = sdkKey
@sse_url = ""
Expand Down
2 changes: 1 addition & 1 deletion lib/devcycle-ruby-server-sdk/localbucketing/update_wasm.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
BUCKETING_LIB_VERSION="1.24.2"
BUCKETING_LIB_VERSION="1.25.3"
WAT_DOWNLOAD=0
rm bucketing-lib.release.wasm
wget "https://unpkg.com/@devcycle/bucketing-assembly-script@$BUCKETING_LIB_VERSION/build/bucketing-lib.release.wasm"
19 changes: 12 additions & 7 deletions spec/api/devcycle_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
# Please update as you see appropriate
describe 'DevCycle::Client' do
before(:all) do
sdk_key = ENV["DEVCYCLE_SERVER_SDK_KEY"]
if sdk_key.nil?
puts("SDK KEY NOT SET - SKIPPING INIT")
return
end
# run before each test
options = DevCycle::Options.new(enable_cloud_bucketing: true)
@api_instance = DevCycle::Client.new("dvc_server_token_hash", options)
@api_instance = DevCycle::Client.new(sdk_key, options)

@user = DevCycle::User.new({
user_id: 'test-user',
Expand Down Expand Up @@ -57,12 +62,12 @@
# @param user
# @param [Hash] opts the optional parameters
# @return [Variable]
describe 'get_variable_by_key activate-flag' do
describe 'get_variable_by_key ruby-example-tests' do
it 'should work' do
result = @api_instance.variable(@user, "activate-flag", false)
result = @api_instance.variable(@user, "ruby-example-tests-default", false)
expect(result.isDefaulted).to eq true

result = @api_instance.variable_value(@user, "activate-flag", true)
result = @api_instance.variable_value(@user, "ruby-example-tests-default", true)
expect(result).to eq true
end
end
Expand All @@ -75,11 +80,11 @@
# @return [Variable]
describe 'get_variable_by_key test' do
it 'should work' do
result = @api_instance.variable(@user, "test", false)
result = @api_instance.variable(@user, "ruby-example-tests", false)
expect(result.isDefaulted).to eq false
expect(result.value).to eq true

result = @api_instance.variable_value(@user, "test", true)
result = @api_instance.variable_value(@user, "ruby-example-tests", true)
expect(result).to eq true
end
end
Expand All @@ -93,7 +98,7 @@
it 'should work' do
result = @api_instance.all_variables(@user)

expect(result.length).to eq 5
expect(result.length >= 1).to eq true
end
end

Expand Down

0 comments on commit ec42e30

Please sign in to comment.