#
#  Copyright (C) GridGain Systems. All Rights Reserved.
#  _________        _____ __________________        _____
#  __  ____/___________(_)______  /__  ____/______ ____(_)_______
#  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
#  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
#  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
#

set(TARGET gridgain-fake-server)

set(SOURCES
    main.cpp
    fake_server.cpp
    tcp_client_channel.cpp
    connection_test.cpp
    compute_observable_ts_test.cpp
    dns_resolve_test.cpp
    lazy_transaction_test.cpp
    piggyback_test.cpp
    direct_enlist_test.cpp
    batch_split_test.cpp
    run_in_transaction_test.cpp
    tx_auto_rollback_test.cpp
    tx_read_timestamp_test.cpp
)

set(LIBS gridgain-test-common gridgain9-client-static msgpack-c gridgain-protocol gridgain-tuple)

# extension_client is only available when the extension library is built.
if (${ENABLE_EXTENSION})
    list(APPEND SOURCES extension_connection_test.cpp)
    list(APPEND LIBS gridgain9-extension)
endif()

add_definitions(-D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING)

# RESOURCE_LOCK serializes these against each other under ctest. Every fixture binds a fixed port and
# the tests of one fixture share it, so without the lock a parallel ctest run has them racing for the
# same port - which is also why they had only ever run as one sequential binary.
ignite_test(${TARGET} DISCOVER SOURCES ${SOURCES} LIBS ${LIBS}
    PROPERTIES RESOURCE_LOCK fake_server_ports)
