Skip to content

Commit

Permalink
Reviewed tests and build workflow for test execution (#251)
Browse files Browse the repository at this point in the history
* Add test with raw transport

* Added KNetReplicator test

* Added cache final cleanup

* Split cache by framework

* Report error on exception
  • Loading branch information
masesdevelopers authored Jun 26, 2024
1 parent 707be6e commit 13d3bd0
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 23 deletions.
95 changes: 76 additions & 19 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,25 @@ jobs:

- name: Prepare configuration files
run: |
Copy-Item .github\workflows\zookeeper.properties -Destination bin\zookeeper.properties -Force
Copy-Item .github\workflows\server.properties -Destination bin\server.properties -Force
Copy-Item .github\workflows\zookeeper.properties -Destination bin\net6.0\zookeeper.properties -Force
Copy-Item .github\workflows\server.properties -Destination bin\net6.0\server.properties -Force
Copy-Item .github\workflows\zookeeper.properties -Destination bin\net8.0\zookeeper.properties -Force
Copy-Item .github\workflows\server.properties -Destination bin\net8.0\server.properties -Force
- name: Save KEFCore bin in cache
- name: Save KEFCore net6.0 bin in cache
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: ./bin/
key: KEFCore_bin_${{ github.sha }}

path: ./bin/net6.0/
key: KEFCore_net6.0_bin_${{ github.sha }}

- name: Save KEFCore net8.0 bin in cache
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: ./bin/net8.0/
key: KEFCore_net8.0_bin_${{ github.sha }}

execute_tests_linux:
needs: build_windows
services:
Expand Down Expand Up @@ -115,22 +124,32 @@ jobs:

runs-on: 'ubuntu-latest'
steps:
- name: Restore KEFCore bin from cache
- name: Restore KEFCore ${{ matrix.framework }} bin from cache
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
enableCrossOsArchive: true
path: ./bin/
key: KEFCore_bin_${{ github.sha }}
path: ./bin/${{ matrix.framework }}/
key: KEFCore_${{ matrix.framework }}_bin_${{ github.sha }}

- name: Set up JDK distribution
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: ${{ matrix.jdk_vendor }}
java-version: ${{ matrix.jdk_version }}

- name: Executing KNetReplicator Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetReplicator.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
run: dotnet ./bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ./bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092
- name: Executing KNetStreams Raw Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetStreams.Raw.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Executing KNetStreams Buffered Benchmark on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetStreams.Buffered.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

Expand All @@ -153,13 +172,13 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Restore KEFCore bin from cache
- name: Restore KEFCore ${{ matrix.framework }} bin from cache
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
enableCrossOsArchive: true
path: ./bin/
key: KEFCore_bin_${{ github.sha }}
path: ./bin/${{ matrix.framework }}/
key: KEFCore_${{ matrix.framework }}_bin_${{ github.sha }}

- name: Set up JDK distribution
uses: actions/setup-java@v4
Expand All @@ -176,14 +195,25 @@ jobs:
- name: Start Kafka on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
shell: pwsh
run: |
Start-Process -FilePath knet -ArgumentList ( 'zookeeperstart', '${{ github.workspace }}/bin/zookeeper.properties' )
Start-Process -FilePath knet -ArgumentList ( 'kafkastart', '${{ github.workspace }}/bin/server.properties' )
Start-Process -FilePath knet -ArgumentList ( 'zookeeperstart', '${{ github.workspace }}/bin/${{ matrix.framework }}/zookeeper.properties' )
Start-Process -FilePath knet -ArgumentList ( 'kafkastart', '${{ github.workspace }}/bin/${{ matrix.framework }}/server.properties' )
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Executing MASES.EntityFrameworkCore.KNet.Test.Benchmark on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
- name: Executing KNetReplicator Benchmark on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetReplicator.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Executing KNetStreams Raw Benchmark on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
shell: pwsh
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetStreams.json localhost:9092
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetStreams.Raw.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Executing KNetStreams Buffered Benchmark on ${{ matrix.os }} with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
shell: pwsh
run: dotnet ${{ github.workspace }}/bin/${{ matrix.framework }}/MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}/bin/${{ matrix.framework }}/Benchmark.KNetStreams.Buffered.json localhost:9092
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

Expand All @@ -205,4 +235,31 @@ jobs:
# if: ${{ matrix.os == 'windows-latest' }}
# run: dotnet ${{ github.workspace }}\bin\${{ matrix.framework }}\MASES.EntityFrameworkCore.KNet.Test.Benchmark.dll ${{ github.workspace }}\bin\${{ matrix.framework }}\Benchmark.KNetStreams.json localhost:9092
# env:
# JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}
# JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

final_cleanup:
needs: [ execute_tests_linux, execute_tests_other ]
if: "always()"
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'

- name: Clear caches
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list --key KEFCore_ )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions test/KEFCore.Benchmark.Test/Benchmark.KNetStreams.Raw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DatabaseName": "TestDBBenchmark",
"UseCompactedReplicator": false,
"UseByteBufferDataTransfer": false,
"BootstrapServers": "192.168.0.101:9092",
"NumberOfExecutions": 10
}
5 changes: 4 additions & 1 deletion test/KEFCore.Benchmark.Test/KEFCore.Benchmark.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
</ItemGroup>

<ItemGroup>
<None Update="Benchmark.KNetStreams.Buffered.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Benchmark.Protobuf.KNetStreams.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Benchmark.KNetStreams.json">
<None Update="Benchmark.KNetStreams.Raw.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Benchmark.Avro.KNetStreams.json">
Expand Down
1 change: 1 addition & 0 deletions test/KEFCore.Benchmark.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ join pg in context.Posts on op.BlogId equals pg.BlogId
catch (Exception ex)
{
ProgramConfig.ReportString(ex.ToString());
Environment.ExitCode = 1;
}
finally
{
Expand Down
3 changes: 2 additions & 1 deletion test/KEFCore.Complex.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ join pg in context.Posts on op.BlogId equals pg.BlogId
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
ProgramConfig.ReportString(ex.ToString());
Environment.ExitCode = 1;
}
finally
{
Expand Down
3 changes: 2 additions & 1 deletion test/KEFCore.StreamTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ join pg in context.Posts on op.BlogId equals pg.BlogId
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
ProgramConfig.ReportString(ex.ToString());
Environment.ExitCode = 1;
}
finally
{
Expand Down
3 changes: 2 additions & 1 deletion test/KEFCore.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ join pg in context.Posts on op.BlogId equals pg.BlogId
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
ProgramConfig.ReportString(ex.ToString());
Environment.ExitCode = 1;
}
finally
{
Expand Down

0 comments on commit 13d3bd0

Please sign in to comment.