Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netcat relay services in test suite slow and complicated #1

Open
JPvRiel opened this issue Sep 26, 2017 · 3 comments
Open

netcat relay services in test suite slow and complicated #1

JPvRiel opened this issue Sep 26, 2017 · 3 comments

Comments

@JPvRiel
Copy link
Owner

JPvRiel commented Sep 26, 2017

The current test suite relies on two containers running netcat and using a shared docker volume where the behave container searches for the logs in the volume

Due to disc IO caching writes, etc, a time delay between sending and event and searching for it is needed. And this might be unreliable. A more reliable solution would be to have behave itself listen on ports and receive network events directly. Unfortunately, only v1.2.6 has support for async patterns such as opening a network socket in the background, sending a network event, and then waiting on the reply.

When 1.2.6 becomes latest/stable, this improvement can be made.

@JPvRiel
Copy link
Owner Author

JPvRiel commented Sep 26, 2017

To clarify a test case can fail when it should not. E.g. when run once, this scenario fails, but running a 2nd time succeeds. Added 'over "5" seconds' to tests to allow more time for IO to sync in the background as an ugly workaround.

Scenario: Messages are forwarded to another server in syslog format               # behave/features/syslog_forwarding.feature:19
    Given a valid rsyslog configuration                                             # behave/features/steps/step_background.py:10 0.000s
    And a server "test_syslog_server"                                               # behave/features/steps/step_background.py:30 0.000s
    And an environment variable file "test_syslog_server.env"                       # behave/features/steps/step_background.py:47 0.000s
    Given "rsyslog_omfwd_syslog_enabled" environment variable is "on"               # behave/features/steps/step_syslog_forwarding.py:13 0.000s
    And "rsyslog_omfwd_syslog_host" environment variable is set                     # behave/features/steps/step_syslog_forwarding.py:20 0.000s
    And "rsyslog_omfwd_syslog_port" environment variable is set                     # behave/features/steps/step_syslog_forwarding.py:20 0.000s
    And a file "/tmp/syslog_relay/nc.out"                                           # behave/features/steps/step_syslog_messages.py:10 0.000s
    When sending the syslog message "Testing syslog forwarding" in "RFC3164" format # behave/features/steps/step_syslog_forwarding.py:26 0.001s
    And waiting "1" seconds                                                         # behave/features/steps/step_syslog_forwarding.py:79 1.001s
    And searching lines for the pattern "Testing syslog forwarding"                 # behave/features/steps/step_syslog_messages.py:45 0.001s
    Then the pattern should be found                                                # behave/features/steps/step_syslog_messages.py:81 0.000s

@JPvRiel
Copy link
Owner Author

JPvRiel commented Sep 28, 2017

Attempting work around with FIFO between containers, but the blocking read() on the FIFO in python is cumbersome to handle - so using a FIFO is probably as might be almost as much effort as doing a workaround for async socket input.

@JPvRiel
Copy link
Owner Author

JPvRiel commented Oct 8, 2017

To confirm the "quick fix" of having two netcat containers act as relay recipients and write to a shared docker volume has timing issues, and even waiting up to 15 seconds can sometimes fail (falsely) . Would be better to have the sut behave test suite start a TCP server and act as the relay recipient itself, but Python asyncio looks quite complex to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant