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

Feature/naming service tests #709

Merged
merged 29 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ddee279
prepare gtest for naming service test
zerotacg Jun 8, 2024
1a45228
extract CServiceEntry into separate file
zerotacg Jun 8, 2024
b0fe35e
revert changes to unrelated files
zerotacg Jun 8, 2024
4050df9
apply clang tidy recommendation
zerotacg Jun 8, 2024
d4e7e66
extract some helper and variables into separate files
zerotacg Jun 8, 2024
04cdfc2
extract some functions into separate files
zerotacg Jun 8, 2024
01d6b98
removed clutter
zerotacg Jun 8, 2024
b806666
simplify code
zerotacg Jun 8, 2024
10933b9
move naming service tests into corresponding subfolder
zerotacg Jun 8, 2024
1b698b2
move CServiceInstanceManager into separate file and add first test fo…
zerotacg Jun 8, 2024
3e94cc5
add test case for service instance manager singleton
zerotacg Jun 8, 2024
a85a166
add test for singleton handling in CServiceInstanceManager
zerotacg Jun 9, 2024
e65ef0b
add tests for addind unique services
zerotacg Jun 9, 2024
c1c3e1f
add test results
zerotacg Jun 9, 2024
db740b5
add additional test coverage
zerotacg Jun 9, 2024
47bac25
remove unused import
zerotacg Jun 9, 2024
8a06ea7
extract service class and dependent functions into separate files
zerotacg Jun 9, 2024
80afc23
extract functions into separate files and organize imports
zerotacg Jun 9, 2024
02c5b14
Merge branch 'refs/heads/core4' into feature/naming_service_tests
zerotacg Jun 9, 2024
85371e3
cleanup singleton in IService on destruction
zerotacg Jun 9, 2024
279ff11
prepare integration test for naming service
zerotacg Jun 9, 2024
73c850f
remove integration test
zerotacg Jun 9, 2024
b6f91f5
add basic test for running a naming service
zerotacg Jun 9, 2024
f45c85f
reformat code
zerotacg Jun 9, 2024
8085351
remove integration test
zerotacg Jun 9, 2024
eeed8e0
arrange code into preious sections
zerotacg Jun 9, 2024
5b9fe94
make library parts of naming service static
zerotacg Jun 11, 2024
5de513a
revert unwanted changes
zerotacg Jun 11, 2024
ebd74a1
remove some unused variables in tests
zerotacg Jun 11, 2024
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
6 changes: 6 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ jobs:
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}

- uses: actions/upload-artifact@v4
if: (success() || failure()) && matrix.os == 'ubuntu-22.04'
with:
name: test-results
path: "${{ steps.strings.outputs.build-output-dir }}/**/reports/junit-*.xml"

- name: Package
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Test Report"
on:
workflow_run:
workflows: ["CMake on multiple platforms"]
types:
- completed
permissions:
contents: read
actions: read
checks: write
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1
with:
artifact: test-results
name: GTests
path: '**/*.xml'
reporter: java-junit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ snowballs/build/*
ryzom/build/*
build/*
build-2010/*
build/*
install/*
build_*
install_*
nel/tools/build_gamedata/configuration/buildsite.py
cmake-build-*

# Linux nel compile
nel/build/nel-config
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,17 @@ ENDIF()
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)

ENABLE_TESTING()
INCLUDE(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47.zip
EXCLUDE_FROM_ALL
)
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
INCLUDE(GoogleTest)
ENDIF()

IF(HUNTER_ENABLED)
Expand Down
3 changes: 3 additions & 0 deletions nel/src/net/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ IService::IService() :

IService::~IService()
{
// Singleton
_Instance = nullptr;

// unregister the singleton
INelContext::getInstance().releaseSingletonPointer("IService", this);
}
Expand Down
26 changes: 22 additions & 4 deletions nelns/naming_service/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
FILE(GLOB SRC *.cpp *.h)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

ADD_EXECUTABLE(naming_service WIN32 ${SRC})
add_library(nelns_naming_service STATIC
nelns/naming_service/functions.cpp
nelns/naming_service/naming_service.cpp
nelns/naming_service/service_instance_manager.cpp
nelns/naming_service/variables.cpp
)
add_library(nelns::ns ALIAS nelns_naming_service)
target_link_libraries(nelns_naming_service
nelmisc
nelnet
)

ADD_EXECUTABLE(naming_service WIN32
naming_service.cpp
)

TARGET_LINK_LIBRARIES(naming_service
nelmisc
nelnet)
nelns::ns
)

NL_DEFAULT_PROPS(naming_service "NeLNS, Services: Naming Service")
NL_ADD_RUNTIME_FLAGS(naming_service)

INSTALL(TARGETS naming_service RUNTIME DESTINATION sbin COMPONENT ns)
INSTALL(FILES naming_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT ns)

IF (WITH_NEL_TESTS)
ADD_SUBDIRECTORY(tests)
ENDIF ()
Loading
Loading