File: send_signal.feature

package info (click to toggle)
ruby-aruba 0.14.8-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,216 kB
  • sloc: ruby: 7,951; sh: 21; makefile: 12
file content (104 lines) | stat: -rw-r--r-- 2,921 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Feature: Send a signal to command

  You can send a command a signal with the following steps:

  - `When I send the signal "HUP" to the command started last`
  - `When I send the signal "HUP" 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 hup {
      echo "Got signal HUP."
      exit 0
    }

    trap hup HUP
    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 5 seconds for a command to start up
        When I run `cli` in background
        And I send the signal "HUP" to the command started last
        Then the exit status should be 0
        And the output should contain:
        \"\"\"
        Got signal HUP.
        \"\"\"
    """
    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 hup {
      echo "Got signal HUP."
      exit 0
    }

    trap hup HUP
    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 5 seconds for a command to start up
        When I run `cli` in background
        And I send the signal "HUP" to the command "cli"
        Then the exit status should be 0
        And the output should contain:
        \"\"\"
        Got signal HUP.
        \"\"\"
    """
    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 hup {
      echo "Got signal HUP."
      exit 0
    }

    trap hup HUP
    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 5 seconds for a command to start up
        When I run `cli` in background
        And I run `kill -HUP <pid-last-command-started>`
        Then the output should contain:
        \"\"\"
        Got signal HUP.
        \"\"\"
    """
    When I run `cucumber`
    Then the features should all pass