From bf6ec44b460006870d5b84d6215e20473866c1f3 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Wed, 30 Sep 2015 15:46:07 +0900 Subject: [PATCH] Move setenv cucumber steps to hooks.rb. --- features/learning_switch.feature | 7 +------ features/multi_learning_switch.feature | 7 +------ features/support/hooks.rb | 13 +++++++++++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/features/learning_switch.feature b/features/learning_switch.feature index e0ea1a6..36149f6 100644 --- a/features/learning_switch.feature +++ b/features/learning_switch.feature @@ -1,11 +1,6 @@ Feature: "Learning Switch" example Background: - Given I set the environment variables to: - | variable | value | - | TREMA_LOG_DIR | . | - | TREMA_PID_DIR | . | - | TREMA_SOCKET_DIR | . | - And a file named "trema.conf" with: + Given a file named "trema.conf" with: """ vswitch('learning') { datapath_id 0xabc } diff --git a/features/multi_learning_switch.feature b/features/multi_learning_switch.feature index cfbff2d..9ae58ac 100644 --- a/features/multi_learning_switch.feature +++ b/features/multi_learning_switch.feature @@ -1,11 +1,6 @@ Feature: "Multi Learning Switch" example Background: - Given I set the environment variables to: - | variable | value | - | TREMA_LOG_DIR | . | - | TREMA_PID_DIR | . | - | TREMA_SOCKET_DIR | . | - And a file named "trema.conf" with: + Given a file named "trema.conf" with: """ vswitch('lsw1') { datapath_id 0x1 } vswitch('lsw2') { datapath_id 0x2 } diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 73ec4ef..bd885ff 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -1,9 +1,18 @@ Before('@sudo') do fail 'sudo authentication failed' unless system 'sudo -v' @aruba_timeout_seconds = 15 + ENV['TREMA_LOG_DIR'] = '.' + ENV['TREMA_PID_DIR'] = '.' + ENV['TREMA_SOCKET_DIR'] = '.' end After('@sudo') do - run 'trema killall --all' - sleep 10 + begin + run 'trema killall --all' + sleep 10 + ensure + ENV['TREMA_LOG_DIR'] = nil + ENV['TREMA_PID_DIR'] = nil + ENV['TREMA_SOCKET_DIR'] = nil + end end