Added quick 'n' dirty script for generation of
configs with various combinations of defaultaction/recipent-specyfic action pairsmaster
parent
24f8ca354f
commit
c3429b6308
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/ruby
|
||||
#Simple script that generates kuvert's config
|
||||
#files with different possbile combinations of defaultaction
|
||||
#and recipent specyfic actions and run kuvert againt them
|
||||
|
||||
require 'parseconfig'
|
||||
require 'fileutils'
|
||||
|
||||
config=ParseConfig.new('config_gen.rc')
|
||||
template_config=config['template_config'] #File with template config that we will base on
|
||||
testing_config=config['testing_config'] #File with config that we will be testing
|
||||
kuvert_launch_cmd=config['kuvert_launch_cmd'] #Command to launch kuvert
|
||||
kuvert_stop_cmd=config['kuvert_stop_cmd'] #Command to stop kuvert
|
||||
mail_dir=config['mail_dir'] #Directory where we will put test mail
|
||||
log_file=config['log_file'] #File with kuvert logs
|
||||
from=config['from'] #We are sending mails as who?
|
||||
|
||||
recipent0=config['recipent0'] #Recipent that we have key for
|
||||
recipent1=config['recipent1'] #Recipent that we don't have key for
|
||||
|
||||
actions=['none','signonly','fallback','encrypt'] #Array with all possible acions that we want to test
|
||||
iterations=0 #Number of iterations
|
||||
|
||||
actions.each do |defaultaction|
|
||||
actions.each do |recipentaction|
|
||||
FileUtils.cp(template_config,testing_config)
|
||||
conf=File.open(testing_config,'a')
|
||||
conf.puts("defaultaction #{defaultaction}")
|
||||
conf.puts(" #{recipent0} #{recipentaction}")
|
||||
conf.fsync
|
||||
conf.close
|
||||
|
||||
mail=File.open("#{mail_dir}/#{iterations}",'w')
|
||||
mail.puts("From: #{from}")
|
||||
mail.puts("To: #{recipent0}, #{recipent1}")
|
||||
mail.puts("Subject: Kuvert test default: #{defaultaction} ; recipent: #{recipentaction} #{iterations}")
|
||||
mail.puts("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
|
||||
mail.fsync
|
||||
mail.close
|
||||
|
||||
puts "Staring kuvert"
|
||||
puts "defaultaction #{defaultaction}"
|
||||
puts "#{recipent0} #{recipentaction}"
|
||||
puts "Iteration #{iterations}"
|
||||
#Start kuvert
|
||||
fork do
|
||||
system(kuvert_launch_cmd)
|
||||
end
|
||||
|
||||
#Ugly busy waiting loop
|
||||
while ((`tail -n 1 #{log_file}` =~ /.*done handling file \d*.*/)==nil) do
|
||||
sleep 2
|
||||
puts "Waiting until kuvert finish his job"
|
||||
end
|
||||
|
||||
#Stop kuvert
|
||||
#system(kuvert_stop_cmd)
|
||||
pid=spawn(kuvert_stop_cmd)
|
||||
Process.wait(pid)
|
||||
sleep 5
|
||||
iterations+=1
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
template_config='config/kuvert.conf_template'
|
||||
testing_config='config/kuvert.conf'
|
||||
kuvert_launch_cmd='sh start'
|
||||
kuvert_stop_cmd='docker stop kuvert'
|
||||
mail_dir='queue'
|
||||
log_file='logs/log'
|
||||
from=''
|
||||
recipent0=''
|
||||
recipent1=''
|
||||
|
Loading…
Reference in New Issue