root/bin/test_client @ a1df93fe
5e97edd9 | Marc Dequènes (Duck) | #!/usr/bin/ruby -Ku
|
|
#--
|
|||
# CyborgHood, a distributed system management software.
|
|||
4888ca24 | Marc Dequènes (Duck) | # Copyright (c) 2009-2011 Marc Dequènes (Duck) <Duck@DuckCorp.org>
|
|
5e97edd9 | Marc Dequènes (Duck) | #
|
|
# This program is free software: you can redistribute it and/or modify
|
|||
# it under the terms of the GNU General Public License as published by
|
|||
# the Free Software Foundation, either version 3 of the License, or
|
|||
# (at your option) any later version.
|
|||
#
|
|||
# This program is distributed in the hope that it will be useful,
|
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
# GNU General Public License for more details.
|
|||
#
|
|||
# You should have received a copy of the GNU General Public License
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#++
|
|||
# to allow in-place run for test
|
|||
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
|||
a445b722 | Marc Dequènes (Duck) | require 'cyborghood'
|
|
5e97edd9 | Marc Dequènes (Duck) | ||
module CyborgHood
|
|||
a445b722 | Marc Dequènes (Duck) | module TestClientLand
|
|
c2f9dd87 | Marc Dequènes (Duck) | add_translations 'testclient'
|
|
5e97edd9 | Marc Dequènes (Duck) | ||
f8eacaad | Marc Dequènes (Duck) | class TestClientClient < Cyborg
|
|
e75cca5b | Marc Dequènes (Duck) | # load config before modules are included
|
|
Config.load
|
|||
c2f9dd87 | Marc Dequènes (Duck) | inject_deferred_translations
|
|
5e97edd9 | Marc Dequènes (Duck) | include BotNet
|
|
def start_work
|
|||
4d9f2962 | Marc Dequènes (Duck) | task "compare stuff" do
|
|
a089227c | Marc Dequènes (Duck) | #ask "MapMaker", :info1, "/_cyborg_"
|
|
#ask "Librarian", :info2, "/_cyborg_"
|
|||
#ask "Librarian", :library, "/Records"
|
|||
#ask "Librarian", :persons, "/Records/Persons"
|
|||
ee2c32c3 | Marc Dequènes (Duck) | #ask "Librarian", :dns_domains, "/Records/DnsDomains"
|
|
a089227c | Marc Dequènes (Duck) | #ask "Librarian", :gorou, "/Records/Persons/gorou"
|
|
#ask "Librarian", :guihome_net, "/Records/DnsDomains/guihome.net"
|
|||
#ask "Librarian", :person_search, "/Records/Persons/?", {:uid => "g*"}
|
|||
ee2c32c3 | Marc Dequènes (Duck) | #ask "Librarian", :person_search_null, "/Records/Persons/?"
|
|
849a61fb | Marc Dequènes (Duck) | #ask "MapMaker", :zones, "/Zones"
|
|
9dfb2047 | Marc Dequènes (Duck) | #ask "MapMaker", :wanted_failure, "/prout"
|
|
849a61fb | Marc Dequènes (Duck) | #ask "MapMaker", :dns, "/Services/DNS"
|
|
#ask "MapMaker", :dnssec, "/Services/DNSSEC"
|
|||
#ask "MapMaker", :zone_mp, "/Zones/milkypond.org"
|
|||
#ask "MapMaker", :dns_check, "/Services/DNS/check_config"
|
|||
66a02240 | Marc Dequènes (Duck) | #ask "MapMaker", :search, "/Zones/?"
|
|
a089227c | Marc Dequènes (Duck) | #ask "MapMaker", :search_master, "/Zones/?", {:is_master => true}
|
|
ee2c32c3 | Marc Dequènes (Duck) | #ask "MapMaker", :search_slave, "/Zones/?", {:is_master => false}
|
|
66a02240 | Marc Dequènes (Duck) | #know? "MapMaker", :k1, "/Zones"
|
|
#know? "MapMaker", :k2, "/prout"
|
|||
258a439a | Marc Dequènes (Duck) | set_user "guihome"
|
|
51546fe5 | Marc Dequènes (Duck) | set_preferred_locales "fr"
|
|
9f407d69 | Marc Dequènes (Duck) | #ask "Clerk", :dns_info, "/Commands/DNS/INFO"
|
|
20533c4d | Marc Dequènes (Duck) | ask "Clerk", :super_batch, "/Batch", {
|
|
:commands => [
|
|||
["DNS", "INFOZZZ"],
|
|||
["DNS", "INFO"]
|
|||
],
|
|||
:references => {},
|
|||
:options => {:stop_on_error => false}
|
|||
}
|
|||
4d9f2962 | Marc Dequènes (Duck) | on_error do
|
|
puts "PLOUF"
|
|||
pp errors
|
|||
pp results
|
|||
a089227c | Marc Dequènes (Duck) | stop_bot :quickly
|
|
4d9f2962 | Marc Dequènes (Duck) | end
|
|
on_success do
|
|||
puts "OK"
|
|||
pp errors
|
|||
pp results
|
|||
a089227c | Marc Dequènes (Duck) | #puts "Tadam: " + (results[:info1][:api_version] == results[:info2][:api_version] ? "same" : "different")
|
|
#set_preferred_locales "fr;q=1,en-us,en"
|
|||
f6fd4b56 | Marc Dequènes (Duck) | meet "waiter", :zzz
|
|
STDOUT.flush
|
|||
on_success do
|
|||
puts "OK compare stuff"
|
|||
end
|
|||
5da1960c | Marc Dequènes (Duck) | on_error do
|
|
a089227c | Marc Dequènes (Duck) | stop_bot :quickly
|
|
5da1960c | Marc Dequènes (Duck) | end
|
|
7466fc08 | Marc Dequènes (Duck) | end
|
|
f6fd4b56 | Marc Dequènes (Duck) | end
|
|
task "waiter" do
|
|||
meet "compare stuff", :zzz
|
|||
on_success do
|
|||
puts "OK waiter"
|
|||
848944dc | Marc Dequènes (Duck) | stop_bot :when_finished
|
|
4d9f2962 | Marc Dequènes (Duck) | end
|
|
end
|
|||
5e97edd9 | Marc Dequènes (Duck) | end
|
|
end
|
|||
end
|
|||
end
|
|||
a445b722 | Marc Dequènes (Duck) | bot = CyborgHood::TestClientLand::TestClientClient.new
|
|
5e97edd9 | Marc Dequènes (Duck) | ||
trap('INT') do
|
|||
a089227c | Marc Dequènes (Duck) | bot.stop(:quickly)
|
|
5e97edd9 | Marc Dequènes (Duck) | end
|
|
trap('TERM') do
|
|||
a089227c | Marc Dequènes (Duck) | bot.stop(:quickly)
|
|
5e97edd9 | Marc Dequènes (Duck) | end
|
|
bot.run
|