Sha256: d4a577a3087543ccd56891e34615c7dba64681ac4c3ef6e0191f739a5c4028a4
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
require_relative './spec_helper' require 'norikra/stats' require 'norikra/server' require 'tmpdir' describe Norikra::Stats do describe '#to_hash' do it 'returns internal stats as hash with symbolized keys' do args = { targets: [], queries: [], } s = Norikra::Stats.new(args) expect(s.to_hash).to eql(args) end end describe '.load' do it 'can restore stats data from #dump -ed json' do Dir.mktmpdir do |dir| File.open("#{dir}/stats.json", 'w') do |file| args = { targets: [ { name: 'test1', fields: { id: { name: 'id', type: 'int', optional: false}, data: { name: 'data', type: 'string', optional: true } } }, ], queries: [ { name: 'testq2', expression: 'select count(*) from test1.win:time(5 sec)' }, { name: 'testq1', expression: 'select count(*) from test1.win:time(10 sec)' }, ], } s1 = Norikra::Stats.new(args) expect(s1.to_hash).to eql(args) s1.dump(file.path) s2 = Norikra::Stats.load(file.path) expect(s2.to_hash).to eql(s1.to_hash) expect(s2.to_hash).to eql(args) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
norikra-0.1.7-java | spec/stats_spec.rb |
norikra-0.1.6-java | spec/stats_spec.rb |
norikra-0.1.5-java | spec/stats_spec.rb |