File: TestServer.cpp

package info (click to toggle)
ecflow 5.15.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,868 kB
  • sloc: cpp: 269,341; python: 22,756; sh: 3,609; perl: 770; xml: 333; f90: 204; ansic: 141; makefile: 70
file content (618 lines) | stat: -rw-r--r-- 37,171 bytes parent folder | download
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
/*
 * Copyright 2009- ECMWF.
 *
 * This software is licensed under the terms of the Apache Licence version 2.0
 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
 * In applying this licence, ECMWF does not waive the privileges and immunities
 * granted to it by virtue of its status as an intergovernmental organisation
 * nor does it submit to any jurisdiction.
 */

#include <boost/test/unit_test.hpp>

#include "InvokeServer.hpp"
#include "SCPort.hpp"
#include "ecflow/client/ClientEnvironment.hpp"
#include "ecflow/client/ClientInvoker.hpp"
#include "ecflow/core/Environment.hpp"
#include "ecflow/core/File.hpp"
#include "ecflow/core/Str.hpp"
#include "ecflow/core/Timer.hpp"
#include "ecflow/core/Version.hpp"
#include "ecflow/test/scaffold/Naming.hpp"

using namespace std;
using namespace ecf;

BOOST_AUTO_TEST_SUITE(S_Client)

BOOST_AUTO_TEST_SUITE(T_Server)

// ************************************************************************************
// Note: If you make edits to node tree, they will have no effect until the server is rebuilt
//
// Note: To test HPUX->Linux, invoke serve on (Linux/HPUX) and the client cmds on other system
//       On the client side set ECF_HOST to machine name. To allow further testing if ECF_HOST
//       is specified then *don't* shutdown the server
// ************************************************************************************

BOOST_AUTO_TEST_CASE(test_server_version) {
    ECF_NAME_THIS_TEST();

    /// This will remove checkpt and backup , to avoid server from loading it. (i.e from previous test)
    InvokeServer invokeServer("Client:: ...test_server_version:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    ClientInvoker theClient(invokeServer.host(), invokeServer.port());
    BOOST_REQUIRE_MESSAGE(theClient.server_version() == 0, "server version\n" << theClient.errorMsg());

    auto client_version = theClient.get_string();
    auto server_version = Version::full();

    // Important:
    //   The test only requires a specific server version when both client and server are local.
    //   When contacting a remote server, only a warning is issued if the versions do not match.

    if (ClientEnvironment::hostSpecified().empty()) {
        BOOST_REQUIRE_MESSAGE(client_version == server_version,
                              "Client version (" << client_version << ") does not match server version ("
                                                 << server_version << ")");
    }
    else {
        BOOST_WARN_MESSAGE(client_version == server_version,
                           "Client version (" << client_version << ") does not match server version (" << server_version
                                              << ")");
    }
}

BOOST_AUTO_TEST_CASE(test_server_state_changes) {
    ECF_NAME_THIS_TEST();

    /// This will remove checkpt and backup , to avoid server from loading it. (i.e from previous test)
    InvokeServer invokeServer("Client:: ...test_server_state_changes:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

    ClientInvoker theClient(invokeServer.host(), invokeServer.port());
    BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                          CtsApi::get() << " failed should return 0\n"
                                        << theClient.errorMsg());
    if (ClientEnvironment::hostSpecified().empty()) {
        // server started locally
        BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::HALTED,
                              "Expected INITIAL server state HALTED but found "
                                  << SState::to_string(theClient.defs()->server_state().get_state()));
    }

    BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                          CtsApi::shutdownServer() << " should return 0\n"
                                                   << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                          CtsApi::get() << " failed should return 0\n"
                                        << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::SHUTDOWN,
                          "Expected server state SHUTDOWN but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                          CtsApi::haltServer() << " should return 0\n"
                                               << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                          CtsApi::get() << " failed should return 0\n"
                                        << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::HALTED,
                          "Expected server state HALTED but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                          CtsApi::restartServer() << " should return 0\n"
                                                  << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                          CtsApi::get() << " failed should return 0\n"
                                        << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::RUNNING,
                          "Expected server state RUNNING but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    /// Repeat test using sync_local() to test incremental changes of server
    BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                          CtsApi::shutdownServer() << " should return 0\n"
                                                   << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, " failed should return 0\n" << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::SHUTDOWN,
                          "Expected server state SHUTDOWN but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                          CtsApi::haltServer() << " should return 0\n"
                                               << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, " failed should return 0\n" << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::HALTED,
                          "Expected server state HALTED but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                          CtsApi::restartServer() << " should return 0\n"
                                                  << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, " failed should return 0\n" << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::RUNNING,
                          "Expected server state RUNNING but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    if (ClientEnvironment::hostSpecified().empty()) {
        // This check only valid if server was invoked locally. Ignore for remote servers

        // make sure edit history updated
        BOOST_REQUIRE_MESSAGE(theClient.edit_history(Str::ROOT_PATH()) == 0,
                              CtsApi::to_string(CtsApi::edit_history(Str::ROOT_PATH())) << " should return 0\n"
                                                                                        << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.server_reply().get_string_vec().size() == 7,
                              "Expected edit history of size 7, but found "
                                  << theClient.server_reply().get_string_vec().size());

        // make sure edit history was *NOT* serialized, It is only serialized when check pointing
        BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                              CtsApi::get() << " failed should return 0\n"
                                            << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.defs()->get_edit_history(Str::ROOT_PATH()).size() == 0,
                              "Expected edit history of size 0, but found "
                                  << theClient.defs()->get_edit_history(Str::ROOT_PATH()).size());

        // clear edit history
        BOOST_REQUIRE_MESSAGE(theClient.edit_history("clear") == 0,
                              CtsApi::to_string(CtsApi::edit_history("clear")) << " should return 0\n"
                                                                               << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.edit_history(Str::ROOT_PATH()) == 0,
                              CtsApi::to_string(CtsApi::edit_history(Str::ROOT_PATH())) << " should return 0\n"
                                                                                        << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.server_reply().get_string_vec().size() == 0,
                              "Expected no edit history " << theClient.server_reply().get_string_vec().size());
    }
}

BOOST_AUTO_TEST_CASE(test_server_state_changes_with_auto_sync) {
    ECF_NAME_THIS_TEST();

    /// This will remove checkpt and backup , to avoid server from loading it. (i.e from previous test)
    InvokeServer invokeServer("Client:: ...test_server_state_changes_with_auto_sync:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

    ClientInvoker theClient(invokeServer.host(), invokeServer.port());
    theClient.set_auto_sync(true);

    BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
    if (ClientEnvironment::hostSpecified().empty()) {
        // server started locally
        BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::HALTED,
                              "Expected INITIAL server state HALTED but found "
                                  << SState::to_string(theClient.defs()->server_state().get_state()));
    }

    BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                          CtsApi::shutdownServer() << " should return 0\n"
                                                   << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::SHUTDOWN,
                          "Expected server state SHUTDOWN but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                          CtsApi::haltServer() << " should return 0\n"
                                               << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::HALTED,
                          "Expected server state HALTED but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                          CtsApi::restartServer() << " should return 0\n"
                                                  << theClient.errorMsg());
    BOOST_REQUIRE_MESSAGE(theClient.defs()->server_state().get_state() == SState::RUNNING,
                          "Expected server state RUNNING but found "
                              << SState::to_string(theClient.defs()->server_state().get_state()));

    if (ClientEnvironment::hostSpecified().empty()) {
        // This check only valid if server was invoked locally. Ignore for remote servers

        // make sure edit history updated
        BOOST_REQUIRE_MESSAGE(theClient.edit_history(Str::ROOT_PATH()) == 0,
                              CtsApi::to_string(CtsApi::edit_history(Str::ROOT_PATH())) << " should return 0\n"
                                                                                        << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.server_reply().get_string_vec().size() == 8 &&
                                  theClient.server_reply().get_string_vec().size() <=
                                      Defs::max_edit_history_size_per_node(),
                              "Expected edit history of size 8, but found "
                                  << theClient.server_reply().get_string_vec().size() << "\n"
                                  << Str::dump_string_vec(theClient.server_reply().get_string_vec()));

        // make sure edit history was *NOT* serialized, It is only serialized when check pointing
        BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                              CtsApi::get() << " failed should return 0\n"
                                            << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.defs()->get_edit_history(Str::ROOT_PATH()).size() == 0,
                              "Expected edit history of size 0, but found "
                                  << theClient.defs()->get_edit_history(Str::ROOT_PATH()).size());
    }
}

BOOST_AUTO_TEST_CASE(test_server_stress_test) {
    ECF_NAME_THIS_TEST();

    /// This will remove checkpt and backup , to avoid server from loading it. (i.e from previous test)
    InvokeServer invokeServer("Client:: ...test_server_stress_test:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

    ClientInvoker theClient(invokeServer.host(), invokeServer.port());
    int load = 125;
#ifdef ECF_OPENSSL
    if (ecf::environment::has(ecf::environment::ECF_SSL)) {
        load = 30;
    }
#endif

    {
        PerformanceTimer timer;
        DurationTimer duration_timer;
        Timer<std::chrono::milliseconds> chrono_timer;
        for (int i = 0; i < load; i++) {

            BOOST_REQUIRE_MESSAGE(theClient.delete_all() == 0,
                                  CtsApi::to_string(CtsApi::delete_node()) << " should return 0\n"
                                                                           << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.suspend("/suite1") == 0, "should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.resume("/suite1") == 0, "should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                                  CtsApi::shutdownServer() << " should return 0\n"
                                                           << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                                  CtsApi::haltServer() << " should return 0\n"
                                                       << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                                  CtsApi::restartServer() << " should return 0\n"
                                                          << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "unknown", true) == 0,
                                  "check should return 0\n"
                                      << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());

            BOOST_REQUIRE_MESSAGE(theClient.defs().get(), "Server returned a NULL defs");
            BOOST_REQUIRE_MESSAGE(theClient.defs()->suiteVec().size() >= 1, "  no suite ?");
        }
        cout << " Server handled " << load * 16 << " requests in CPU timer(" << timer << ")" << " Duration timer("
             << DurationTimer::to_simple_string(duration_timer.elapsed()) << ")" << " Chrono timer("
             << std::chrono::duration<double, std::milli>(chrono_timer.elapsed()).count() << " milli)" << endl;
    }
    {
        theClient.set_auto_sync(true);
        PerformanceTimer timer;
        DurationTimer duration_timer;
        Timer<std::chrono::milliseconds> chrono_timer;
        for (int i = 0; i < load; i++) {

            BOOST_REQUIRE_MESSAGE(theClient.delete_all() == 0,
                                  CtsApi::to_string(CtsApi::delete_node()) << " should return 0\n"
                                                                           << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.suspend("/suite1") == 0, "should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.resume("/suite1") == 0, "should return 0\n" << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                                  CtsApi::shutdownServer() << " should return 0\n"
                                                           << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                                  CtsApi::haltServer() << " should return 0\n"
                                                       << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                                  CtsApi::restartServer() << " should return 0\n"
                                                          << theClient.errorMsg());
            BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "unknown", true) == 0,
                                  "check should return 0\n"
                                      << theClient.errorMsg());

            BOOST_REQUIRE_MESSAGE(theClient.defs().get(), "Server returned a NULL defs");
            BOOST_REQUIRE_MESSAGE(theClient.defs()->suiteVec().size() >= 1, "  no suite ?");
        }
        cout << " Server handled " << load * 8 << " requests in boost_timer(" << timer << ")" << " DurationTimer("
             << DurationTimer::to_simple_string(duration_timer.elapsed()) << ")" << " Chrono_timer("
             << std::chrono::duration<double, std::milli>(chrono_timer.elapsed()).count() << " milli)"
             << " *with* AUTO SYNC" << endl;
    }
}

BOOST_AUTO_TEST_CASE(test_server_group_stress_test) {
    ECF_NAME_THIS_TEST();

    /// This is exactly the same test as above, but uses the group command
    /// This should be faster as the network traffic should be a lot less
    InvokeServer invokeServer("Client:: ...test_server_group_stress_test:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

    PerformanceTimer timer;
    DurationTimer duration_timer;
    ClientInvoker theClient(invokeServer.host(), invokeServer.port());

    std::string groupRequest = CtsApi::to_string(CtsApi::delete_node());
    groupRequest += ";";
    groupRequest += CtsApi::to_string(CtsApi::loadDefs(path, true /*force*/, false /*check_only*/, false /*print*/));
    groupRequest += ";";
    groupRequest += CtsApi::shutdownServer();
    groupRequest += ";";
    groupRequest += CtsApi::haltServer();
    groupRequest += ";";
    groupRequest += CtsApi::restartServer();
    groupRequest += ";";
    groupRequest += CtsApi::restartServer();
    groupRequest += ";";
    groupRequest += CtsApi::checkPtDefs();
    groupRequest += ";";
    groupRequest += CtsApi::get();

    // cout << "groupRequest = " << groupRequest << "\n";

    int load = 125;
#ifdef ECF_OPENSSL
    if (ecf::environment::has(ecf::environment::ECF_SSL)) {
        load = 30;
    }
#endif

    for (int i = 0; i < load; i++) {
        BOOST_REQUIRE_MESSAGE(theClient.group(groupRequest) == 0,
                              "Group request " << CtsApi::group(groupRequest) << " failed should return 0\n"
                                               << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.defs().get(), "Server returned a NULL defs");
        BOOST_REQUIRE_MESSAGE(theClient.defs()->suiteVec().size() >= 1, "  no suite ?");
    }
    cout << " Server handled " << load * 8 << " commands using " << load << " group requests in boost_timer(" << timer
         << ") DurationTimer(" << DurationTimer::to_simple_string(duration_timer.elapsed()) << ")" << endl;
}

BOOST_AUTO_TEST_CASE(test_server_stress_test_2) {
    ECF_NAME_THIS_TEST();

    /// More extensive stress test, using as many user based command as possible.
    ///
    /// This will remove checkpt and backup , to avoid server from loading it. (i.e from previous test)
    InvokeServer invokeServer("Client:: ...test_server_stress_test_2:", SCPort::next());
    BOOST_REQUIRE_MESSAGE(invokeServer.server_started(),
                          "Server failed to start on " << invokeServer.host() << ":" << invokeServer.port());

    std::string path = File::test_data("libs/client/test/data/lifecycle.txt", "libs/client");

    Zombie z(Child::USER,
             ecf::Child::INIT,
             ZombieAttr::get_default_attr(Child::USER),
             "path_to_task",
             "DUMMY_JOBS_PASSWORD",
             "DUMMY_PROCESS_OR_REMOTE_ID",
             1,
             "host");
    std::vector<std::string> suites;
    suites.emplace_back("suite1");
    suites.emplace_back("made_up_suite");

    std::vector<std::string> nodes_to_delete;
    nodes_to_delete.emplace_back("/suite1/family2/aa"); // these should exist in lifecycle.txt
    nodes_to_delete.emplace_back("/suite1/family2/bb");

#if defined(HPUX)
    int load = 10; // On non linux systems use different load otherwise it takes to long
#elif defined(_AIX)
    int load = 65; // On non linux systems use different load otherwise it takes to long
#else
    int load = 130;
#endif

#ifdef ECF_OPENSSL
    if (ecf::environment::has(ecf::environment::ECF_SSL)) {
        load = 10;
    }
#endif

    PerformanceTimer timer;
    DurationTimer duration_timer;
    ClientInvoker theClient(invokeServer.host(), invokeServer.port());
    theClient.set_throw_on_error(false);

    for (int i = 0; i < load; i++) {

        BOOST_REQUIRE_MESSAGE(theClient.pingServer() == 0, " ping should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.delete_all() == 0,
                              CtsApi::to_string(CtsApi::delete_node()) << " should return 0\n"
                                                                       << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.loadDefs(path) == 0, "load defs failed \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.shutdownServer() == 0,
                              CtsApi::shutdownServer() << " should return 0\n"
                                                       << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.haltServer() == 0,
                              CtsApi::haltServer() << " should return 0\n"
                                                   << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.restartServer() == 0,
                              CtsApi::restartServer() << " should return 0\n"
                                                      << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.news_local() == 0,
                              " new local failed should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.sync_local() == 0, "failed should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.stats() == 0, CtsApi::stats() << " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.stats_server() == 0,
                              CtsApi::stats_server() << " should return 0\n"
                                                     << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.suites() == 0,
                              CtsApi::suites() << " should return 0\n"
                                               << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.server_version() == 0,
                              CtsApi::server_version() << " should return 0\n"
                                                       << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.debug_server_off() == 0,
                              CtsApi::debug_server_off() << " should return 0\n"
                                                         << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.check("/suite1") == 0, "check should return 0\n" << theClient.errorMsg()); // 13

        BOOST_REQUIRE_MESSAGE(theClient.logMsg("start") == 0, "log msg should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.get_log_path() == 0, "get_log_path should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.getLog(1) == 0, "get_log last line should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.flushLog() == 0, "flushLog should return 0\n" << theClient.errorMsg());

        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "unknown", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "complete", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "submitted", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "active", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "aborted", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1", "queued", true) == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1/family1/a:myEvent", "set") == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.force("/suite1/family1/a:myEvent", "clear") == 0,
                              "check should return 0\n"
                                  << theClient.errorMsg());

        BOOST_REQUIRE_MESSAGE(theClient.zombieGet() == 0,
                              CtsApi::zombieGet() << " should return 0\n"
                                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieFob(z) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieFail(z) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieAdopt(z) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieBlock(z) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieRemove(z) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.zombieKill(z) == 0, " should return 0\n" << theClient.errorMsg()); // 19

        BOOST_REQUIRE_MESSAGE(theClient.suspend("/suite1") == 0,
                              CtsApi::to_string(CtsApi::suspend("/suite1")) << " should return 0\n"
                                                                            << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.resume("/suite1") == 0,
                              CtsApi::to_string(CtsApi::resume("/suite1")) << " should return 0\n"
                                                                           << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.edit_history("/suite1") == 0,
                              CtsApi::to_string(CtsApi::edit_history("/suite1")) << " should return 0\n"
                                                                                 << theClient.errorMsg());

        BOOST_REQUIRE_MESSAGE(theClient.replace("/suite1", path) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.replace("/suite1", path, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.replace("/suite1", path, true, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.replace("/suite1", path, false, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg()); // 26

        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs() == 0,
                              CtsApi::checkPtDefs() << " should return 0\n"
                                                    << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::NEVER) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::ALWAYS) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::ON_TIME, 180) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::ON_TIME) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::UNDEFINED) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg()); // 32
        BOOST_REQUIRE_MESSAGE(theClient.checkPtDefs(ecf::CheckPt::ON_TIME, CheckPt::default_interval()) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());

        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1") == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1", true, true, true, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1", true) == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1", false, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1", false, false, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.freeDep("/suite1", false, false, false, true) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg()); // 38

        BOOST_REQUIRE_MESSAGE(theClient.ch_register(true, suites) == 0, "--ch_register \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_suites() == 0, "--ch_suites should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_add(1, suites) == 0, "--ch_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_remove(1, suites) == 0, "--ch_remove \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_auto_add(1, true) == 0, "--ch_auto_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_auto_add(1, false) == 0, "--ch_auto_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch_drop(1) == 0, "--ch_drop should return 0\n" << theClient.errorMsg()); // 45

        BOOST_REQUIRE_MESSAGE(theClient.ch_register(true, suites) == 0, "--ch_register \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch1_add(suites) == 0, "--ch1_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch1_auto_add(true) == 0, "--ch1_auto_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch1_auto_add(false) == 0, "--ch1_auto_add \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch1_remove(suites) == 0, "--ch1_remove \n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.ch1_drop() == 0, "--ch1_drop \n" << theClient.errorMsg()); // 51

        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", "top") == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", "bottom") == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", "alpha") == 0, " should return 0\n" << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", NOrder::ORDER) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", NOrder::UP) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.order("/suite1", NOrder::DOWN) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg()); // 57

        BOOST_REQUIRE_MESSAGE(theClient.delete_node("/suite1/family1/a") == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());
        BOOST_REQUIRE_MESSAGE(theClient.delete_nodes(nodes_to_delete) == 0,
                              " should return 0\n"
                                  << theClient.errorMsg());

        BOOST_REQUIRE_MESSAGE(theClient.getDefs() == 0,
                              CtsApi::get() << " failed should return 0\n"
                                            << theClient.errorMsg()); // 60
        BOOST_REQUIRE_MESSAGE(theClient.defs().get(), "Server returned a NULL defs");
        BOOST_REQUIRE_MESSAGE(theClient.defs()->suiteVec().size() >= 1, "  no suite ?");
    }

    int no_of_client_calls = 74;

    cout << " Server handled " << load * no_of_client_calls << " requests in boost_timer(" << timer
         << ") DurationTimer(" << DurationTimer::to_simple_string(duration_timer.elapsed()) << ")" << endl;
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()