summaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2012-02-09 16:24:22 -0800
committerRuss Allbery <rra@stanford.edu>2012-02-09 16:24:22 -0800
commit9d7bb40f5b5a2ec77b2e6e0c88a2be9ed29958fb (patch)
tree95eb4a7a72feace42670fbedabe220c5e5fdc3e8 /ruby
parent22b6e5fcf5a423377368bf45b0d8de27656b0cc0 (diff)
Update test suite for new test configuration, tmp directory
Update the TAP support library to use config/principal and config/keytab rather than files under data. Update most of the tests to also use config/tmp to handle temporary files for running tests. Change-Id: I014cdf5e15e1d1bbeabfaa7feb60e1b97bb29c2b
Diffstat (limited to 'ruby')
-rw-r--r--ruby/test_remctl.rb.in41
1 files changed, 23 insertions, 18 deletions
diff --git a/ruby/test_remctl.rb.in b/ruby/test_remctl.rb.in
index f6eb635..333c133 100644
--- a/ruby/test_remctl.rb.in
+++ b/ruby/test_remctl.rb.in
@@ -12,32 +12,37 @@ require 'remctl'
module Helpers
def configured?
- return File.exists? 'data/test.principal'
+ return File.exists? 'config/principal'
end
def get_principal
- IO.readlines('data/test.principal').each do |line|
+ IO.readlines('config/principal').each do |line|
return line.chomp
end
end
def start_remctld
- FileUtils.rm 'data/pid', :force => true
+ begin
+ FileUtils.mkdir 'tmp'
+ rescue Errno::EEXIST
+ nil
+ end
+ FileUtils.rm 'tmp/pid', :force => true
@principal = get_principal
fork do
- $stdout.reopen('data/test.output', 'w')
- $stderr.reopen('data/test.output', 'w')
+ $stdout.reopen('tmp/output', 'w')
+ $stderr.reopen('tmp/output', 'w')
FileUtils.cd '@abs_top_srcdir@/tests'
exec('@abs_top_builddir@/server/remctld', 'remctld', '-m',
'-p', '14373', '-s', @principal, '-f', 'data/conf-simple',
- '-P', '@abs_top_builddir@/tests/data/pid', '-d', '-S', '-F',
- '-k', '@abs_top_builddir@/tests/data/test.keytab')
+ '-P', '@abs_top_builddir@/tests/tmp/pid', '-d', '-S', '-F',
+ '-k', '@abs_top_builddir@/tests/config/keytab')
end
- unless File.exists? 'data/pid' then sleep 1 end
+ unless File.exists? 'tmp/pid' then sleep 1 end
end
def stop_remctld
- IO.readlines('data/pid').each do |pid|
+ IO.readlines('tmp/pid').each do |pid|
pid.chomp!
Process.kill('TERM', pid.to_i)
Process.waitpid(pid.to_i)
@@ -46,17 +51,17 @@ module Helpers
end
def run_kinit
- ENV['KRB5CCNAME'] = 'data/test.cache'
- commands = ['kinit --no-afslog -k -t data/test.keytab ' + @principal,
- 'kinit -k -t data/test.keytab ' + @principal,
- 'kinit -t data/test.keytab ' + @principal,
- 'kinit -k -K data/test.keytab ' + @principal]
+ ENV['KRB5CCNAME'] = 'tmp/krb5cc_test'
+ commands = ['kinit --no-afslog -k -t config/keytab ' + @principal,
+ 'kinit -k -t config/keytab ' + @principal,
+ 'kinit -t config/keytab ' + @principal,
+ 'kinit -k -K config/keytab ' + @principal]
commands.each do |command|
if system(command + ' >/dev/null </dev/null')
return true
end
end
- unless File.exists? 'data/pid' then sleep 1 end
+ unless File.exists? 'tmp/pid' then sleep 1 end
stop_remctld
return false
end
@@ -72,8 +77,8 @@ module Helpers
def teardown
if configured?
stop_remctld
- FileUtils.rm 'data/test.output'
- FileUtils.rm 'data/test.cache', :force => true
+ FileUtils.rm 'tmp/output'
+ FileUtils.rm 'tmp/krb5cc_test', :force => true
end
end
end
@@ -193,7 +198,7 @@ class TC_RemctlFull < Test::Unit::TestCase
assert_raise Remctl::Error do
Remctl.new('127.0.0.1', 14373, @principal)
end
- Remctl.ccache = 'data/test.cache'
+ Remctl.ccache = 'tmp/krb5cc_test'
begin
Remctl.new('127.0.0.1', 14373, @principal)
rescue Remctl::Error