Skip to content

Commit

Permalink
GEODE-9549: enable netcore tests in CI (apache#867)
Browse files Browse the repository at this point in the history
* GEODE-9549: Enable .net core tests in CI
- Enable test running job in yml
* GEODE-9549: Build NetCore and NetCore.Test projects individually
- This simplifies the cmake config, and makes the post-build file copy
  steps more reliable
* GEODE-9549: Copy C bindings lib to binary dir for tests
- Give Java project a reasonable name
* GEODE-9549: Use ctest to run netcore tests
- Eliminates need for start/stop scripts, all done via ctest now
* GEODE-9549: Make .net core project build in sequence
- Still getting sharing violations on parallel builds, so need to ensure
  none of these build at the same time.

Co-authored-by: Jacob Barrett <[email protected]>
  • Loading branch information
2 people authored and davebarnes97 committed Feb 9, 2022
1 parent 1f9dd5b commit e0a0748
Show file tree
Hide file tree
Showing 70 changed files with 158 additions and 265 deletions.
2 changes: 1 addition & 1 deletion ci/docker/task/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine:latest
FROM alpine:3.13
LABEL maintainer="Apache Geode <[email protected]>"
LABEL description="Minimal image for executing CI tasks."
RUN apk add --no-cache bash git openssh-client
8 changes: 1 addition & 7 deletions ci/lib/templates.lib.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ set -ueo pipefail
remote_shell cmake -E chdir (@= path @) ctest -C ${CMAKE_CONFIG} -j(@= str(parallel) @) --timeout=(@= str(timeout) @) --output-on-failure --repeat until-pass:4 --schedule-random
(@- end @)

(@ def dotnet_bash_task(path): -@)
set -ueo pipefail
(@= remote_functions() @)
remote_shell cmake -E chdir (@= path @) dotnet test
(@- end @)

(@ def clang_tidy_bash_task(): -@)
set -ueo pipefail
export GEODE_HOME=$(pwd)/geode
Expand Down Expand Up @@ -309,4 +303,4 @@ exclude_dirs="ci packer docker tools"
exclude_files="*/*.md"
is_source_from_pr_testable "source" "${exclude_dirs}" "${exclude_files}" && exit 0 || exit 1

(@- end @)
(@- end @)
4 changes: 2 additions & 2 deletions ci/lib/templates.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#@ "upload_source_bash_task",
#@ "upload_geode_bash_task",
#@ "extract_geode_bash_task",
#@ "dotnet_bash_task",
#@ )

#@ load("@ytt:overlay", "overlay")
Expand Down Expand Up @@ -222,7 +221,8 @@ plan:
- #@ remote_task("net-integration-tests", config.config, ctest_bash_task("build/clicache/integration-test2"), "1h", build.params)
- #@ remote_task("net-legacy-integration-tests", config.config, ctest_bash_task("build/clicache/integration-test", timeout=500, parallel=4), "2h", build.params)
#@ end
#! - #@ remote_task("netcore-tests", config.config, dotnet_bash_task("source/netcore/NetCore.Test"), "10m", build.params)
- #@ remote_task("netcore-integration-test", config.config, ctest_bash_task("build/netcore/netcore-integration-test", config.config, parallel=1), "10m", build.params)
- #@ remote_task("netcore-session-integration-test", config.config, ctest_bash_task("build/netcore/netcore-session-integration-test", parallel=1), "10m", build.params)
on_failure:
in_parallel:
steps:
Expand Down
1 change: 1 addition & 0 deletions ci/release/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ configs:
#@overlay/append
- name: release
config: RelWithDebInfo

1 change: 0 additions & 1 deletion cppcache/integration-test/ThinClientDurableConnect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const char* durableId = "DurableId";


std::string getServerEndPoint(int instance) {
char instanceStr[16];
int port;
if (instance == 1) {
port = CacheHelper::staticHostPort1;
Expand Down
11 changes: 6 additions & 5 deletions netcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project(netcore LANGUAGES NONE)

option(INCLUDE_DOTNET_CORE "Build .NET Core client." ON)

find_program(DOTNET dotnet)

if(DOTNET AND INCLUDE_DOTNET_CORE)
add_custom_target(netcore ALL COMMAND ${DOTNET} build --configuration $<CONFIG> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/NetCore DEPENDS apache-geode-c VERBATIM)
add_custom_target(netcore-test ALL COMMAND ${DOTNET} build --configuration $<CONFIG> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/NetCore.Test DEPENDS netcore VERBATIM)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/NetCore/bin/$<CONFIG>/netcoreapp3.1/Apache.Geode.NetCore.dll DESTINATION ./lib)
add_subdirectory(netcore-lib)
add_subdirectory(netcore-session)
add_subdirectory(netcore-integration-test)
add_subdirectory(netcore-session-integration-test)
add_subdirectory(utility)
endif()

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\NetCore.Session\NetCore.Session.csproj" />
<ProjectReference Include="..\netcore-session\netcore-session.csproj" />
</ItemGroup>


Expand Down
18 changes: 18 additions & 0 deletions netcore/cmake/remove_dirs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
# FindGeode CMake find module.
##
file(REMOVE_RECURSE locator server auth_locator auth_server)
10 changes: 5 additions & 5 deletions netcore/geode-dotnet-core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30001.183
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore", "NetCore\NetCore.csproj", "{09ABBCE7-B217-43F1-A51B-CC5BDCD8EE98}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "netcore", "netcore\netcore.csproj", "{09ABBCE7-B217-43F1-A51B-CC5BDCD8EE98}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore.Test", "NetCore.Test\NetCore.Test.csproj", "{501DEA7E-8985-42A8-8BC9-C073E1B6DFE0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "netcore-integration-test", "netcore-integration-test\netcore-integration-test.csproj", "{501DEA7E-8985-42A8-8BC9-C073E1B6DFE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Session", "Session", "{520C96EC-F929-4365-8D78-CC5785419B62}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore.Session", "NetCore.Session\NetCore.Session.csproj", "{B88C58EB-B144-403B-85F7-7A5B45E643E3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "netcore-session", "netcore-session\netcore-session.csproj", "{B88C58EB-B144-403B-85F7-7A5B45E643E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore.Session.IntegrationTests", "NetCore.Session.IntegrationTests\NetCore.Session.IntegrationTests.csproj", "{94D2CD59-A5F3-4504-BF01-0A3B95CE12B5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "netcore-session-integration-test", "netcore-session-integration-test\netcore-session-integration-test.csproj", "{94D2CD59-A5F3-4504-BF01-0A3B95CE12B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore GeodeSession Sample", "AspNetCore GeodeSession Sample\AspNetCore GeodeSession Sample.csproj", "{4E830BC8-D1CA-40AF-9C9C-D15E193C6585}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "asp-netcore-session-sample", "asp-netcore-session-sample\asp-netcore-session-sample.csproj", "{4E830BC8-D1CA-40AF-9C9C-D15E193C6585}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
57 changes: 57 additions & 0 deletions netcore/netcore-integration-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
project(netcore-test LANGUAGES NONE)

add_custom_target(netcore-integration-test ALL
COMMAND ${DOTNET} build netcore-integration-test.csproj --configuration $<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:apache-geode-c> ${CMAKE_CURRENT_SOURCE_DIR}/bin/$<CONFIG>/netcoreapp3.1/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS apache-geode-c netcore-lib netcore-utility VERBATIM)

enable_testing()

set(AUTH_OPTS "--J=-Dgemfire.security-username=server --J=-Dgemfire.security-password=server --classpath=$<SHELL_PATH:${CMAKE_CURRENT_BINARY_DIR}/../utility/netcore-utility.jar>")
set(AUTH_LOCATOR_OPTS "${AUTH_OPTS} --J=-Dgemfire.security-manager=javaobject.SimpleSecurityManager")

add_test(NAME startclusters COMMAND ${Geode_gfsh_EXECUTABLE}
-e "start locator --name=locator --port=10334 --http-service-port=6060 --J=-Dgemfire.jmx-manager-port=1099"
-e "start server --name=server --server-port=0"
-e "create region --name=exampleRegion --type=PARTITION"
-e "create region --name=geodeSessionState --type=PARTITION"
-e "disconnect"
-e "start locator --name=auth_locator ${AUTH_LOCATOR_OPTS} --port=10335 --http-service-port=7070 --J=-Dgemfire.jmx-manager-port=2099"
-e "connect --locator=localhost[10335] --user=server --password=server"
-e "start server --name=auth_server ${AUTH_OPTS} --server-port=0"
-e "create region --name=authExampleRegion --type=PARTITION"
-e "create region --name=authGeodeSessionState --type=PARTITION")
add_test(NAME stopclusters
COMMAND ${Geode_gfsh_EXECUTABLE}
-e "connect --locator=localhost[10335] --user=server --password=server"
-e "stop server --name=auth_server"
-e "stop locator --name=auth_locator"
-e "connect --locator=localhost[10334]"
-e "stop server --name=server"
-e "stop locator --name=locator")
add_test(NAME remove_dirs
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/remove_dirs.cmake)

add_test(NAME netcore-test
COMMAND dotnet test -c $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

set_tests_properties(startclusters PROPERTIES FIXTURES_SETUP geode)
set_tests_properties(netcore-test PROPERTIES FIXTURES_REQUIRED geode)
set_tests_properties(stopclusters PROPERTIES FIXTURES_CLEANUP geode)
set_tests_properties(remove_dirs PROPERTIES DEPENDS stopclusters)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NetCore\NetCore.csproj" />
<ProjectReference Include="..\netcore-lib\netcore-lib.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
project(netcore-lib LANGUAGES NONE)

#!/usr/bin/env bash
GFSH_PATH=""
which gfsh 2> /dev/null

if [ $? -eq 0 ]; then
GFSH_PATH="gfsh"
else
if [ "$GEODE_HOME" == "" ]; then
echo "Could not find gfsh. Please set the GEODE_HOME path."
echo "e.g. export GEODE_HOME=<path to Geode>"
else
GFSH_PATH=$GEODE_HOME/bin/gfsh
fi
fi

$GFSH_PATH -e "connect --locator=localhost[10335] --user=server --password=server" -e "shutdown --include-locators=true"
$GFSH_PATH -e "connect --locator=localhost[10334]" -e "shutdown --include-locators=true"

rm -rf locator server auth_locator auth_server
add_custom_target(netcore-lib ALL COMMAND ${DOTNET} build netcore-lib.csproj --configuration $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS apache-geode-c VERBATIM)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/$<CONFIG>/netcoreapp3.1/Apache.Geode.NetCore.dll DESTINATION ./lib)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions netcore/netcore-session-integration-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
project(netcore-session-integrationtest LANGUAGES NONE)

add_custom_target(netcore-session-integration-test ALL
COMMAND ${DOTNET} build netcore-session-integration-test.csproj --configuration $<CONFIG>
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:apache-geode-c> ${CMAKE_CURRENT_SOURCE_DIR}/bin/$<CONFIG>/netcoreapp3.1/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS apache-geode-c netcore-session VERBATIM)

enable_testing()

add_test(NAME startclusters COMMAND ${Geode_gfsh_EXECUTABLE}
-e "start locator --name=locator --port=10334 --http-service-port=6060 --J=-Dgemfire.jmx-manager-port=1099"
-e "start server --name=server --server-port=0"
-e "create region --name=exampleRegion --type=PARTITION"
-e "create region --name=geodeSessionState --type=PARTITION"
-e "disconnect"
-e "start locator --name=auth_locator ${AUTH_LOCATOR_OPTS} --port=10335 --http-service-port=7070 --J=-Dgemfire.jmx-manager-port=2099"
-e "connect --locator=localhost[10335] --user=server --password=server"
-e "start server --name=auth_server ${AUTH_OPTS} --server-port=0"
-e "create region --name=authExampleRegion --type=PARTITION"
-e "create region --name=authGeodeSessionState --type=PARTITION")
add_test(NAME stopclusters
COMMAND ${Geode_gfsh_EXECUTABLE}
-e "connect --locator=localhost[10335] --user=server --password=server"
-e "stop server --name=auth_server"
-e "stop locator --name=auth_locator"
-e "connect --locator=localhost[10334]"
-e "stop server --name=server"
-e "stop locator --name=locator")
add_test(NAME remove_dirs
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/remove_dirs.cmake)

add_test(NAME netcore-session-test
COMMAND dotnet test -c $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

set_tests_properties(startclusters PROPERTIES FIXTURES_SETUP geode)
set_tests_properties(netcore-session-test PROPERTIES FIXTURES_REQUIRED geode)
set_tests_properties(stopclusters PROPERTIES FIXTURES_CLEANUP geode)
set_tests_properties(remove_dirs PROPERTIES DEPENDS stopclusters)
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NetCore.Session\NetCore.Session.csproj" />
<ProjectReference Include="..\NetCore\NetCore.csproj" />
<ProjectReference Include="..\netcore-session\netcore-session.csproj" />
<ProjectReference Include="..\netcore-lib\netcore-lib.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
project(netcore-session LANGUAGES NONE)

#!/usr/bin/env bash

set -e
set -x
# Setup GEODE_HOME, if not set use default
if [ "$GEODE_HOME" == "" ]; then
export GEODE_HOME=$HOME/src/apache-geode
fi

# Setup BUILD_HOME, if not set use default
if [ "$BUILD_HOME" == "" ]; then
export BUILD_HOME=$HOME/src/geode-native/netcore/build
fi

echo "Using environment vars GEODE_HOME=${GEODE_HOME} and BUILD_HOME=${BUILD_HOME}"

# Build utility .jar file # BUild NetCore library
pushd ./NetCore
dotnet build
popd

# Build NetCore tests
pushd ./NetCore.Test
dotnet build
popd

# Build utility jar file used for auth test
pushd ./utility
if [ -d "./build" ]; then
:
else
mkdir build
fi

cd build
cmake ..
cmake --build .
popd

add_custom_target(netcore-session ALL COMMAND ${DOTNET} build netcore-session.csproj --configuration $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS apache-geode-c netcore-integration-test VERBATIM)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NetCore\NetCore.csproj" />
<ProjectReference Include="..\netcore-lib\netcore-lib.csproj" />
</ItemGroup>

</Project>
16 changes: 0 additions & 16 deletions netcore/scripts/run-clang-format.cmd

This file was deleted.

Loading

0 comments on commit e0a0748

Please sign in to comment.