Sha256: 28c6c3b79d3104249f47fbe41c32d1d6ec3dc8e99ce42f2a276467e59339cd05

Contents?: true

Size: 1.81 KB

Versions: 8

Compression:

Stored size: 1.81 KB

Contents

Feature: -c (--conf) option

  -c (--conf) option specifies emulated network configuration

  Background:
    Given a file named "hello.rb" with:
      """ruby
      class Hello < Trema::Controller
        def switch_ready(dpid)
          logger.info format('Hello %s!', dpid.to_hex)
        end
      end
      """
    And a file named "trema.conf" with:
      """ruby
      vswitch { datapath_id 0xabc }
      """

  @sudo
  Scenario: -c option
    When I successfully run `trema run hello.rb -c trema.conf -d`
    And I run `sleep 5`
    Then the file "Hello.log" should contain "Hello 0xabc!"

  @sudo
  Scenario: --conf option
    When I successfully run `trema run hello.rb --conf trema.conf -d`
    And I run `sleep 5`
    Then the file "Hello.log" should contain "Hello 0xabc!"

  @sudo
  Scenario: "No such file" error
    When I run `trema run hello.rb -c nosuchfile -d`
    Then the exit status should not be 0
    And the stderr should contain:
      """
      No such file
      """

  @sudo
  Scenario: NameError
    Given a file named "invalid_trema.conf" with:
      """
      Foo Bar Baz
      """
    And a file named "null_controller.rb" with:
      """ruby
      class NullController < Trema::Controller; end
      """
    When I run `trema run null_controller.rb -c invalid_trema.conf`
    Then the exit status should not be 0
    Then the output should contain "uninitialized constant Phut::Syntax::Baz (NameError)"

  @sudo
  Scenario: SyntaxError
    Given a file named "invalid_trema.conf" with:
      """
      Today is 19 June 2015
      """
    And a file named "null_controller.rb" with:
      """ruby
      class NullController < Trema::Controller; end
      """
    When I run `trema run null_controller.rb -c invalid_trema.conf`
    Then the exit status should not be 0
    And the output should contain "(SyntaxError)"

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trema-0.8.4 features/trema_run/conf_option.feature
trema-0.8.3 features/trema_run/conf_option.feature
trema-0.8.2 features/trema_run/conf_option.feature
trema-0.8.1 features/trema_run/conf_option.feature
trema-0.8.0 features/trema_run/conf_option.feature
trema-0.7.1 features/trema_run/conf_option.feature
trema-0.7.0 features/trema_run/conf_option.feature
trema-0.6.0 features/trema_run/conf_option.feature