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

ZMQ: fixed warnings #115

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d2d260a
zmq-source: change the way how zmq-source handle the connection creation
lmesz Oct 15, 2015
086fc55
zmq: removed unused zmq-source and destination header files
lmesz Oct 15, 2015
cf3c984
zmq: added missing "dependency" it contains the init_sequence_number …
lmesz Oct 15, 2015
2a9838a
zmq: added minimal structure for testing at least to test if it can b…
lmesz Oct 15, 2015
62ea7f7
zmq: added unit test to some zmq-source function and fix a bug around…
lmesz Nov 10, 2015
c6141a2
zmq: made source function consistent every function starts with zmq_s…
lmesz Nov 10, 2015
7a7eecf
zmq: set socket type from destination
lmesz Nov 10, 2015
3e0bccb
zmq: refactored zmq-destination address -> host
lmesz Nov 10, 2015
5fa40df
zmq: refactor source grammar
lmesz Nov 10, 2015
9921ce1
zmq: added test case to destination
lmesz Nov 10, 2015
5f93580
zmq: close socket when something goes wrong
lmesz Nov 22, 2015
af9d9fc
zmq(WIP): added functional test
lmesz Nov 22, 2015
9dcf58a
zmq: fixed errno value when everything goes wrong, do not return EAGAIN
lmesz Nov 26, 2015
318c129
zmq: changed zmq_ctx_term to destroy, it will be depreicated and need…
lmesz Nov 26, 2015
71bfa73
zmq: added queue to source
lmesz Nov 27, 2015
014f835
zmq: fixed path of runtesth.sh
lmesz Nov 27, 2015
7b84415
zmq: remove term like before one remained. Forget to grep!
lmesz Nov 27, 2015
3cbd1e7
zmq(wip): use syslog-ng test infrastructure instead of own for func t…
lmesz Nov 27, 2015
8e6ce4a
zmq(wip): extended travis config
lmesz Nov 27, 2015
6f2dd3e
zmq(wip): one little step toward zmq-func-test
lmesz Dec 1, 2015
2a75ca4
zmq: fixed plugin information
lmesz Dec 26, 2015
bc83a69
zmq(wip): check if SYSLOG_NG_BINARY set and if not use the system-wid…
lmesz Jan 3, 2016
c6cc731
zmq: waaa func-test
lmesz Jan 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: c
install:
- sudo apt-get update -qq
- sudo apt-get install -qq curl
- sudo apt-get install -qq curl git wget
- wget http://download.opensuse.org/repositories/home:/laszlo_budai:/syslog-ng/xUbuntu_12.04/Release.key
- sudo apt-key add Release.key
- rm -rf Release.key
Expand All @@ -11,10 +11,13 @@ install:
- sudo sh -c 'echo "deb http://download.opensuse.org/repositories/home:/viktorjuhasz/xUbuntu_12.04/ ./" >> /etc/apt/sources.list'
- sudo apt-get update -qq
- sudo apt-get install -qq aptitude
- sudo aptitude install -q -y pkg-config flex bison liblua5.2-dev libmongo-client-dev syslog-ng-dev libperl-dev python-dev python3-dev libgrok-dev libtokyocabinet-dev libzmq3-dev librdkafka-dev
- sudo aptitude install -q -y autoconf libtool build-essential pkg-config flex bison liblua5.2-dev libmongo-client-dev syslog-ng-core syslog-ng-dev libperl-dev python-dev python3-dev libgrok-dev libtokyocabinet-dev libzmq3-dev librdkafka-dev
- git clone https://github.com/lmesz/syslog-ng && cd syslog-ng && git checkout remove-fix-relative-path-of-syslog-ng-in-func-test
before_script:
- autoreconf -i
script:
- ./configure
- make && make func-test
- travis/build
compiler:
- gcc
Expand Down
2 changes: 2 additions & 0 deletions modules/zmq/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ modules_zmq_libzmq_la_LDFLAGS = \
modules_zmq_libzmq_la_DEPENDENCIES = \
$(MODULE_DEPS_LIBS)

include modules/zmq/tests/Makefile.am

modules/zmq modules/zmq/ mod-zmq: modules/zmq/libzmq.la

else
Expand Down
35 changes: 0 additions & 35 deletions modules/zmq/scripts/publisher.c

This file was deleted.

54 changes: 0 additions & 54 deletions modules/zmq/scripts/pusher.c

This file was deleted.

52 changes: 0 additions & 52 deletions modules/zmq/scripts/subscriber.c

This file was deleted.

13 changes: 13 additions & 0 deletions modules/zmq/scripts/test_pusher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python

import time
import zmq

def producer():
context = zmq.Context()
zmq_socket = context.socket(zmq.PUSH)
zmq_socket.bind("tcp://127.0.0.1:5558")
for num in xrange(1):
zmq_socket.send("Almafa!\n")

producer()
14 changes: 14 additions & 0 deletions modules/zmq/tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
modules_zmq_tests_TESTS = \
modules/zmq/tests/test_zmq

check_PROGRAMS += \
${modules_zmq_tests_TESTS}

modules_zmq_tests_test_zmq_CFLAGS = \
$(INCUBATOR_CFLAGS)

modules_zmq_tests_test_zmq_LDADD = \
$(INCUBATOR_TEST_LDADD) $(INCUBATOR_LIBS) \
$(top_builddir)/modules/zmq/libzmq.la

include modules/zmq/tests/functional/Makefile.am
8 changes: 8 additions & 0 deletions modules/zmq/tests/functional/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export top_srcdir
export top_builddir

EXTRA_DIST += \
modules/zmq/tests/functional/runtests.sh

func-test:
@$(top_srcdir)/modules/zmq/tests/functional/runtests.sh
20 changes: 20 additions & 0 deletions modules/zmq/tests/functional/runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/sh
top_srcdir=$(cd ${top_srcdir}; pwd)
top_builddir=$(cd ${top_builddir}; pwd)
export func_test_dir=$(cd ${top_srcdir}/syslog-ng/tests/functional; pwd)


if [ -z "$SYSLOG_NG_BINARY" ]
then
SYSLOG_NG_BINARY=$(which syslog-ng)
if [ -z "$SYSLOG_NG_BINARY" ]
then
echo "Failed to determine syslog-ng binary."
exit 1
fi
fi

export SYSLOG_NG_BINARY

${top_srcdir}/modules/zmq/tests/functional/test_zmq_source.py
${top_srcdir}/modules/zmq/tests/functional/test_zmq_destination.py
8 changes: 8 additions & 0 deletions modules/zmq/tests/functional/test_suite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python

import os
import sys

sys.path.append(os.environ['func_test_dir'])

from func_test import *
Empty file.
25 changes: 25 additions & 0 deletions modules/zmq/tests/functional/test_zmq_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python

from control import *

conf = """
@version: 3.8

source zmq {
zmqq();
};

destination file {
file("/tmp/res");
};

log {
source(zmq);
destination(file);
};
"""

def test_zmq_source_can_receive_a_message():
if not start_syslogng(conf, keep_persist=False, verbose=False):
sys.exit(42)
stop_syslogng()
46 changes: 46 additions & 0 deletions modules/zmq/tests/test_zmq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <apphook.h>
#include <libtest/testutils.h>

#include "modules/zmq/zmq-module.h"

void
test_source_methods(){
ZMQSourceDriver *self = g_new0(ZMQSourceDriver, 1);

zmq_sd_set_host((LogDriver *) self, "example_address");
zmq_sd_set_port((LogDriver *) self, 42);
assert_string(zmq_sd_get_address(self), "tcp://example_address:42", "Failed to set zmq address");
assert_string(zmq_sd_get_persist_name(self), "zmq_source:example_address:42", "Given persist name is not okay");
assert_false(zmq_sd_connect(self), "Connection was successful but it shouldn't have been on source site");

zmq_sd_set_host((LogDriver *) self, "localhost");
zmq_sd_set_port((LogDriver *) self, 65530);
assert_true(zmq_sd_connect(self), "tcp://localhost:65530", "Failed to set zmq address");
}

void
test_destination_methods(){
ZMQDestDriver *self = g_new0(ZMQDestDriver, 1);

zmq_dd_set_host((LogDriver *) self, "almafa");
zmq_dd_set_port((LogDriver *) self, 42);
assert_string(zmq_dd_get_address(self), "tcp://almafa:42", "The given address is not the expected!");
assert_false(zmq_dd_connect(self), "Connection was successfully, but it shouldn't have been on source site");

zmq_dd_set_host((LogDriver *) self, "*");
zmq_dd_set_port((LogDriver *) self, 64444);
assert_string(zmq_dd_get_address(self), "tcp://*:64444", "The given address is not the expected!");
assert_true(zmq_dd_connect(self), "Failed to connect on destination site");
}


int main()
{
app_startup();

test_source_methods();
test_destination_methods();

app_shutdown();
return 0;
}
Loading