test/plugin/in_mongo_tail.rb in fluent-plugin-mongo-0.7.7 vs test/plugin/in_mongo_tail.rb in fluent-plugin-mongo-0.7.8
- old
+ new
@@ -27,9 +27,44 @@
assert_equal('log', d.instance.collection)
assert_equal('tag', d.instance.tag_key)
assert_equal('time', d.instance.time_key)
assert_equal('/tmp/fluent_mongo_last_id', d.instance.id_store_file)
end
+
+ def test_url_configration
+ config = %[
+ type mongo_tail
+ url mongodb://localhost:27017/test
+ collection log
+ tag_key tag
+ time_key time
+ id_store_file /tmp/fluent_mongo_last_id
+ ]
+
+ d = create_driver(config)
+ assert_equal("mongodb://localhost:27017/test", d.instance.url)
+ assert_nil(d.instance.database)
+ assert_equal('log', d.instance.collection)
+ assert_equal('tag', d.instance.tag_key)
+ assert_equal('time', d.instance.time_key)
+ assert_equal('/tmp/fluent_mongo_last_id', d.instance.id_store_file)
+ end
+
+ def test_url_and_database_can_not_exist
+ config = %[
+ type mongo_tail
+ url mongodb://localhost:27017/test
+ database test2
+ collection log
+ tag_key tag
+ time_key time
+ id_store_file /tmp/fluent_mongo_last_id
+ ]
+
+ assert_raises Fluent::ConfigError do
+ create_driver(config)
+ end
+ end
def test_emit
# TODO: write actual code
end
end