[DRE-commits] [ruby-aruba] 17/74: Added documentation/tests for sending signals from cucumber

Hideki Yamane henrich at moszumanska.debian.org
Sat Nov 28 01:16:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository ruby-aruba.

commit 7cf8f43b43704ba22c95253942a1e2c5a5719873
Author: Max Meyer <dev at fedux.org>
Date:   Tue Nov 24 10:12:25 2015 +0100

    Added documentation/tests for sending signals from cucumber
---
 features/steps/commands/send_signal.feature | 104 ++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/features/steps/commands/send_signal.feature b/features/steps/commands/send_signal.feature
new file mode 100644
index 0000000..71b7f3f
--- /dev/null
+++ b/features/steps/commands/send_signal.feature
@@ -0,0 +1,104 @@
+Feature: Send a signal to command
+
+  You can send a command a signal with the following steps:
+
+  - `When I send the signal "USR1" to the command started last`
+  - `When I send the signal "USR1" to the command "bin/cli"`
+
+  Or just use `kill` on compatible platforms.
+
+  Background:
+    Given I use a fixture named "cli-app"
+
+  Scenario: Sending signal to the command started last
+    Given an executable named "bin/cli" with:
+    """bash
+    #!/usr/bin/env bash
+    function usr1 {
+      echo "Got signal USR1."
+      exit 0
+    }
+
+    trap usr1 USR1
+    while [ true ]; do sleep 1; done
+    """
+    And a file named "features/run.feature" with:
+    """
+    Feature: Run it
+      Scenario: Run command
+        Given the default aruba exit timeout is 5 seconds
+        And I wait 2 seconds for a command to start up
+        When I run `cli` in background
+        And I send the signal "USR1" to the command started last
+        Then the exit status should be 0
+        And the output should contain:
+        \"\"\"
+        Got signal USR1.
+        \"\"\"
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  Scenario: Sending signal to a command given by command line
+    Given an executable named "bin/cli" with:
+    """bash
+    #!/usr/bin/env bash
+    function usr1 {
+      echo "Got signal USR1."
+      exit 0
+    }
+
+    trap usr1 USR1
+    while [ true ]; do sleep 1; done
+    """
+    And a file named "features/run.feature" with:
+    """
+    Feature: Run it
+      Scenario: Run command
+        Given the default aruba exit timeout is 5 seconds
+        And I wait 2 seconds for a command to start up
+        When I run `cli` in background
+        And I send the signal "USR1" to the command "cli"
+        Then the exit status should be 0
+        And the output should contain:
+        \"\"\"
+        Got signal USR1.
+        \"\"\"
+    """
+    When I run `cucumber`
+    Then the features should all pass
+
+  @unsupported-on-platform-windows
+  @experimental
+  Scenario: Using the "kill"-command
+
+    `<pid-last-command-started>` in your command line will be replaced by the
+    PID of the last command started. Please note, this feature is experimental.
+    The name of the variable may change without further notice.
+
+    Given an executable named "bin/cli" with:
+    """bash
+    #!/usr/bin/env bash
+    function usr1 {
+      echo "Got signal USR1."
+      exit 0
+    }
+
+    trap usr1 USR1
+    while [ true ]; do sleep 1; done
+    """
+    And a file named "features/run.feature" with:
+    """
+    Feature: Run it
+      Scenario: Run command
+        Given the default aruba exit timeout is 5 seconds
+        And I wait 2 seconds for a command to start up
+        When I run `cli` in background
+        And I run `kill -USR1 <pid-last-command-started>`
+        Then the output should contain:
+        \"\"\"
+        Got signal USR1.
+        \"\"\"
+    """
+    When I run `cucumber`
+    Then the features should all pass

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git



More information about the Pkg-ruby-extras-commits mailing list