Sha256: 5a54abdbb1d111efc42c0a0627dde136844f28eb5e182dd4db40daa0e316c9a1
Contents?: true
Size: 888 Bytes
Versions: 1
Compression:
Stored size: 888 Bytes
Contents
# -*- coding: utf-8 -*- require 'test/unit' require 'fluent/test' require 'fluent/plugin/out_onlineuser' require 'redis' class OnlineuserOutputTest < Test::Unit::TestCase CONFIG = %[ host localhost port 6379 db_number 0 ] @redis def setup Fluent::Test.setup @redis = Redis.new(:host => 'localhost', :port => 6379, :thread_safe => true, :db => 0) end def teardown @redis.quit end def create_driver(conf, tag='test') Fluent::Test::BufferedOutputTestDriver.new(Fluent::OnlineuserOutput, tag).configure(conf) end def test_event_counter d = create_driver CONFIG t = Time.now time = t.to_i d.emit({"name" => "test", "uid" => 1}, time) d.emit({"name" => "test", "uid" => 2}, time) d.emit({"name" => "test", "uid" => 3}, time) d.run assert_equal 3, @redis.zcard('counter:online_user:all') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-onlineuser-0.0.1 | test/plugin/test_out_onlineuser.rb |