#include <cynara-client-async.h>
#include <cstdint>
+#include <unistd.h>
using namespace CynaraTestClientAsync;
using namespace CynaraTestAdmin;
client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
}
+void tca12_multiple_connections_without_requests_func()
+{
+ std::string testNo("12");
+
+ cynara_check_id id;
+ RequestEntity callbackData = {RequestFunction(),
+ CYNARA_API_ACCESS_DENIED,
+ CYNARA_CALL_CAUSE_FINISH};
+
+ DBusAccess dbusAccess(CynaraTestConsts::SERVICE.c_str());
+ pid_t before = dbusAccess.getServicePid();
+ timeval beforeTimestamp = dbusAccess.getServiceStartTimestamp();
+
+ for (int i = 0; i < 10; ++i)
+ {
+ Client client;
+ client.createRequest({testNo}, id, callbackData);
+ client.assertStatus(READWRITE);
+ }
+
+//wait until cynara possibly restarts
+ sleep(3);
+
+ pid_t after = dbusAccess.getServicePid();
+ timeval afterTimestamp = dbusAccess.getServiceStartTimestamp();
+ RUNNER_ASSERT_MSG(after != 0,
+ "cynara service not running. After = " << after << ".");
+ RUNNER_ASSERT_MSG(before == after
+ && beforeTimestamp.tv_sec == afterTimestamp.tv_sec
+ && beforeTimestamp.tv_usec == afterTimestamp.tv_usec,
+ "cynara service was restarted during the test. Before pid / timestamp = "
+ << before << " / " << beforeTimestamp.tv_sec << "."
+ << beforeTimestamp.tv_usec << " and after pid / timestamp = "
+ << after << " / " << afterTimestamp.tv_sec << "."
+ << afterTimestamp.tv_usec);
+}
+
RUNNER_TEST_GROUP_INIT(cynara_async_tests)
RUN_CYNARA_TEST(tca01_initialize)
RUN_CYNARA_TEST(tca09_disconnect_and_cancel2)
RUN_CYNARA_TEST(tca10_double_request)
RUN_CYNARA_TEST(tca11_double_request_with_restart)
+RUN_CYNARA_TEST(tca12_multiple_connections_without_requests)