Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (30 sloc) 0.702 kb
8e87e384 »
2008-06-13 Supporting basic CRUD operations (minus Delete).
1 #!/usr/bin/env ruby -wKU
2
3 module RRDManager
4 def setup
5 save_config
6 modify_config_for_tests
7 create_a_new_database
8 end
9
10 def teardown
11 cleanup_rrd_files
12 restore_config
13 end
14
15 def save_config
16 @saved_config = RRDB.config.dup
17 end
18
19 def modify_config_for_tests
20 RRDB.config( :database_directory => File.dirname(__FILE__),
21 :round_robin_archives => "AVERAGE:0.5:1:24" )
22 end
23
24 def restore_config
25 RRDB.config.replace(@saved_config)
26 end
27
28 def create_a_new_database
29 @db = RRDB.new(rand(10_000))
30 end
31
32 def cleanup_rrd_files
33 Dir.glob("#{RRDB.config[:database_directory]}/*.rrd") do |rrd|
34 File.unlink(rrd)
35 end
36 end
37 end
Something went wrong with that request. Please try again.