|
225 | 225 |
|
226 | 226 | SplitIoClient::Api::Splits::PROXY_CHECK_INTERVAL_SECONDS = 1 |
227 | 227 | sleep 1 |
228 | | - parsed_splits = splits_api.since(-1, -1) |
| 228 | + parsed_splits = splits_api.since(1457726098069, -1) |
229 | 229 | expect(splits_api.clear_storage).to eq(true) |
230 | 230 | expect(parsed_splits[:ff][:d].length()).to eq(2) |
231 | 231 | expect(parsed_splits[:rbs][:d].length()).to eq(1) |
232 | 232 | expect(splits_api.instance_variable_get(:@spec_version)).to eq(SplitIoClient::Spec::FeatureFlags::SPEC_VERSION) |
| 233 | + expect(splits_api.instance_variable_get(:@old_spec_since)).to eq(1457726098069) |
| 234 | + end |
| 235 | + |
| 236 | + it 'check using old_spec_since variable' do |
| 237 | + old_spec_splits2 = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../../test_data/rule_based_segments/split_old_spec2.json'))) |
| 238 | + |
| 239 | + stub_request(:get, 'https://proxy-server/api/splitChanges?s=1.3&since=-1&rbSince=-1') |
| 240 | + .to_return({status: 400, body: ''}, {status: 400, body: ''}) |
| 241 | + stub_request(:get, 'https://proxy-server/api/splitChanges?s=1.1&since=-1') |
| 242 | + .to_return(status: 200, body: old_spec_splits) |
| 243 | + stub_request(:get, 'https://proxy-server/api/splitChanges?s=1.1&since=1457726098069') |
| 244 | + .to_return(status: 200, body: old_spec_splits2) |
| 245 | + |
| 246 | + parsed_splits = splits_api.since(-1, -1) |
| 247 | + expect(parsed_splits[:ff][:d].length()).to eq(6) |
| 248 | + expect(splits_api.instance_variable_get(:@spec_version)).to eq(SplitIoClient::Api::Splits::SPEC_1_1) |
| 249 | + |
| 250 | + SplitIoClient::Api::Splits::PROXY_CHECK_INTERVAL_SECONDS = 1 |
| 251 | + sleep 1 |
| 252 | + parsed_splits = splits_api.since(1457726098069, -1) |
| 253 | + SplitIoClient::Api::Splits::PROXY_CHECK_INTERVAL_SECONDS = 100000 |
| 254 | + |
| 255 | + sleep 1 |
| 256 | + expect(splits_api.instance_variable_get(:@spec_version)).to eq(SplitIoClient::Api::Splits::SPEC_1_1) |
| 257 | + expect(splits_api.instance_variable_get(:@old_spec_since)).to eq(nil) |
| 258 | + expect(parsed_splits[:ff][:d].length()).to eq(1) |
| 259 | + expect(log.string).to include 'Switching to new Feature flag spec 1.3 and fetching.' |
233 | 260 | end |
234 | 261 | end |
235 | 262 | end |
0 commit comments