Skip to content

Commit

Permalink
Move setenv cucumber steps to hooks.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuhito committed Sep 30, 2015
1 parent 91b6c0a commit bf6ec44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 1 addition & 6 deletions features/learning_switch.feature
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
7 changes: 1 addition & 6 deletions features/multi_learning_switch.feature
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
13 changes: 11 additions & 2 deletions features/support/hooks.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bf6ec44

Please sign in to comment.