Skip to content

Commit

Permalink
Merge pull request #43 from leancodepl/publisher/funnelled-service-tests
Browse files Browse the repository at this point in the history
Funnel in µsvcs tests
  • Loading branch information
Dragemil authored Oct 30, 2023
2 parents e6721c5 + f84cac9 commit 58acf04
Show file tree
Hide file tree
Showing 39 changed files with 1,391 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/funnel_msvc_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Funnel in µsvc tests

on:
push:
branches: [ main ]
tags-ignore: [ "*-v*" ]
paths:
- "publisher/**"
pull_request:
branches: [ main ]
paths:
- "publisher/**"

jobs:
setup-cluster-and-test:
name: Test Funnel on cluster with multiple scaled services
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./publisher
env:
DOTNET_VERSION: 8.0.100-rc.1.23463.5
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Tilt
uses: yokawasa/[email protected]
with:
tilt: v0.33.6
setup-tools: |
tilt
- name: Create test cluster
uses: AbsaOSS/k3d-action@v2
with:
cluster-name: testapp
args: --config=publisher/funnel_test_cluster/k3d.yaml
- name: Make the script files executable
run: chmod +x funnel_test_cluster/subst_tpl_envs.sh
- name: Run Tilt CI with tests
run: tilt ci --context k3d-testapp -f funnel_test_cluster/Tiltfile
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# JetBrains Rider
**/.idea/

**/out/
1 change: 1 addition & 0 deletions publisher/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PackageReference Update="LeanCode.IntegrationTestHelpers" Version="$(CoreLibVersion)" />
<PackageReference Update="LeanCode.Logging" Version="$(CoreLibVersion)" />

<PackageReference Update="MassTransit.RabbitMQ" Version="8.1.1" />
<PackageReference Update="MassTransit.SignalR" Version="8.1.1" />

<PackageReference Update="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0-rc.1.23421.29" />
Expand Down
52 changes: 52 additions & 0 deletions publisher/LeanCode.Pipe.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.TestClient.Te
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.IntegrationTests", "test\LeanCode.Pipe.IntegrationTests\LeanCode.Pipe.IntegrationTests.csproj", "{05F2BDCE-B093-4D4A-BC36-B7F6F12103AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.TestApp1", "test\LeanCode.Pipe.Funnel.TestApp1\LeanCode.Pipe.Funnel.TestApp1.csproj", "{A95EBB5F-D7CD-48D4-9624-F43A486D0D68}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.TestAppFunnel", "test\LeanCode.Pipe.Funnel.TestAppFunnel\LeanCode.Pipe.Funnel.TestAppFunnel.csproj", "{6D361069-9CD4-44DA-914A-80A62458B04F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "funnel_msvc", "funnel_msvc", "{2A218F39-75C1-4EE1-8614-D67AB30574F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.ScaledTargetServiceTests", "test\LeanCode.Pipe.Funnel.ScaledTargetServiceTests\LeanCode.Pipe.Funnel.ScaledTargetServiceTests.csproj", "{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.TestApp2", "test\LeanCode.Pipe.Funnel.TestApp2\LeanCode.Pipe.Funnel.TestApp2.csproj", "{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.MultipleServicesTests", "test\LeanCode.Pipe.Funnel.MultipleServicesTests\LeanCode.Pipe.Funnel.MultipleServicesTests.csproj", "{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.ScaledFunnelTests", "test\LeanCode.Pipe.Funnel.ScaledFunnelTests\LeanCode.Pipe.Funnel.ScaledFunnelTests.csproj", "{8EF7A9C2-B6A0-422A-90B5-76CB2852225D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeanCode.Pipe.Funnel.NoScalingTests", "test\LeanCode.Pipe.Funnel.NoScalingTests\LeanCode.Pipe.Funnel.NoScalingTests.csproj", "{1F89EB12-9052-46D8-A72E-2BA6E030D3BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -52,6 +68,34 @@ Global
{05F2BDCE-B093-4D4A-BC36-B7F6F12103AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05F2BDCE-B093-4D4A-BC36-B7F6F12103AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05F2BDCE-B093-4D4A-BC36-B7F6F12103AC}.Release|Any CPU.Build.0 = Release|Any CPU
{A95EBB5F-D7CD-48D4-9624-F43A486D0D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A95EBB5F-D7CD-48D4-9624-F43A486D0D68}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A95EBB5F-D7CD-48D4-9624-F43A486D0D68}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A95EBB5F-D7CD-48D4-9624-F43A486D0D68}.Release|Any CPU.Build.0 = Release|Any CPU
{6D361069-9CD4-44DA-914A-80A62458B04F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D361069-9CD4-44DA-914A-80A62458B04F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D361069-9CD4-44DA-914A-80A62458B04F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D361069-9CD4-44DA-914A-80A62458B04F}.Release|Any CPU.Build.0 = Release|Any CPU
{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57}.Release|Any CPU.Build.0 = Release|Any CPU
{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB}.Release|Any CPU.Build.0 = Release|Any CPU
{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427}.Release|Any CPU.Build.0 = Release|Any CPU
{8EF7A9C2-B6A0-422A-90B5-76CB2852225D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EF7A9C2-B6A0-422A-90B5-76CB2852225D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EF7A9C2-B6A0-422A-90B5-76CB2852225D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EF7A9C2-B6A0-422A-90B5-76CB2852225D}.Release|Any CPU.Build.0 = Release|Any CPU
{1F89EB12-9052-46D8-A72E-2BA6E030D3BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F89EB12-9052-46D8-A72E-2BA6E030D3BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F89EB12-9052-46D8-A72E-2BA6E030D3BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F89EB12-9052-46D8-A72E-2BA6E030D3BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{75B2B837-B392-4DC1-8CF7-C1B2C4E03312} = {401E8BD4-C7D7-48F2-8899-EA9859247BD7}
Expand All @@ -60,5 +104,13 @@ Global
{F1830D31-AA1D-409B-B78E-FC2BB88B7DF8} = {401E8BD4-C7D7-48F2-8899-EA9859247BD7}
{38F1AA50-B16E-47A7-925A-AB574E9120FF} = {CBE053F8-6853-4FFC-A931-84A210C5FF2C}
{05F2BDCE-B093-4D4A-BC36-B7F6F12103AC} = {CBE053F8-6853-4FFC-A931-84A210C5FF2C}
{2A218F39-75C1-4EE1-8614-D67AB30574F0} = {CBE053F8-6853-4FFC-A931-84A210C5FF2C}
{A95EBB5F-D7CD-48D4-9624-F43A486D0D68} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{6D361069-9CD4-44DA-914A-80A62458B04F} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{531D5FD5-9C72-4F24-B9E7-E53CFBF20B57} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{66FEF33B-4FCB-41BC-B81F-DE20C02F95DB} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{B77F5B9B-2FF6-4A86-88B9-9C3BF9FF6427} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{8EF7A9C2-B6A0-422A-90B5-76CB2852225D} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
{1F89EB12-9052-46D8-A72E-2BA6E030D3BD} = {2A218F39-75C1-4EE1-8614-D67AB30574F0}
EndGlobalSection
EndGlobal
238 changes: 238 additions & 0 deletions publisher/funnel_test_cluster/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
load('ext://namespace', 'namespace_create')

allow_k8s_contexts('k3d-testapp')
default_registry('k3d-testapp-registry.local.lncd.pl:21345')

# All services needed for tests

local_resource(
'build-testappfunnel',
'dotnet publish -o out/testapp_funnel ../test/LeanCode.Pipe.Funnel.TestAppFunnel',
deps=['../src', '../test/LeanCode.Pipe.Funnel.TestAppFunnel'],
ignore=['../**/obj', '../**/bin'],
labels=['test-services'],
)

local_resource(
'build-testapp1',
'dotnet publish -o out/testapp1 ../test/LeanCode.Pipe.Funnel.TestApp1',
deps=['src', '../test/LeanCode.Pipe.Funnel.TestApp1'],
ignore=['../**/obj', '../**/bin'],
labels=['test-services'],
)

local_resource(
'build-testapp2',
'dotnet publish -o out/testapp2 ../test/LeanCode.Pipe.Funnel.TestApp2',
deps=['src', '../test/LeanCode.Pipe.Funnel.TestApp2'],
ignore=['../**/obj', '../**/bin'],
labels=['test-services'],
)

docker_build(
'testapp_funnel',
'.',
dockerfile='testapp_funnel.dockerfile',
only = ['out/testapp_funnel'],
)

docker_build(
'testapp1',
'.',
dockerfile='testapp1.dockerfile',
only = ['out/testapp1'],
)

docker_build(
'testapp2',
'.',
dockerfile='testapp2.dockerfile',
only = ['out/testapp2'],
)

k8s_yaml('rabbitmq.yaml')
k8s_resource('rabbitmq', labels=['test-services'])

# No scaling tests

namespace_create('no-scaling')

local_resource(
'build-no-scaling-tests',
'dotnet publish -o out/no_scaling_tests ../test/LeanCode.Pipe.Funnel.NoScalingTests',
deps=[
'../src',
'../test/LeanCode.Pipe.Funnel.TestAppFunnel',
'../test/LeanCode.Pipe.Funnel.TestApp1',
'../test/LeanCode.Pipe.Funnel.NoScalingTests' ],
ignore=['../**/obj', '../**/bin'],
labels=['no-scaling-tests']
)

docker_build(
'no_scaling_tests',
'.',
dockerfile='no_scaling/tests.dockerfile',
only = ['out/no_scaling_tests']
)

k8s_yaml(local('./subst_tpl_envs.sh no_scaling funnel.yaml'))
k8s_resource(
'no-scaling-funnel',
resource_deps=['rabbitmq'],
labels=['no-scaling-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh no_scaling testapp1.yaml'))
k8s_resource(
'no-scaling-testapp1',
resource_deps=['rabbitmq'],
labels=['no-scaling-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh no_scaling tests.yaml'))
k8s_resource(
'no-scaling-tests',
resource_deps=['no-scaling-funnel', 'no-scaling-testapp1'],
labels=['no-scaling-tests']
)

# Scaled target service tests

namespace_create('scaled-target-service')

local_resource(
'build-scaled-target-service-tests',
'dotnet publish -o out/scaled_target_service_tests ../test/LeanCode.Pipe.Funnel.ScaledTargetServiceTests',
deps=[
'../src',
'../test/LeanCode.Pipe.Funnel.TestAppFunnel',
'../test/LeanCode.Pipe.Funnel.TestApp1',
'../test/LeanCode.Pipe.Funnel.ScaledTargetServiceTests' ],
ignore=['../**/obj', '../**/bin'],
labels=['scaled-target-service-tests']
)

docker_build(
'scaled_target_service_tests',
'.',
dockerfile='scaled_target_service/tests.dockerfile',
only = ['out/scaled_target_service_tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_target_service funnel.yaml'))
k8s_resource(
'scaled-target-service-funnel',
resource_deps=['rabbitmq'],
labels=['scaled-target-service-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_target_service testapp1.yaml'))
k8s_resource(
'scaled-target-service-testapp1',
resource_deps=['rabbitmq'],
labels=['scaled-target-service-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_target_service tests.yaml'))
k8s_resource(
'scaled-target-service-tests',
resource_deps=['scaled-target-service-funnel', 'scaled-target-service-testapp1'],
labels=['scaled-target-service-tests']
)

# Scaled funnel tests

namespace_create('scaled-funnel')

local_resource(
'build-scaled-funnel-tests',
'dotnet publish -o out/scaled_funnel_tests ../test/LeanCode.Pipe.Funnel.ScaledFunnelTests',
deps=[
'../src',
'../test/LeanCode.Pipe.Funnel.TestAppFunnel',
'../test/LeanCode.Pipe.Funnel.TestApp1',
'../test/LeanCode.Pipe.Funnel.ScaledFunnelTests' ],
ignore=['../**/obj', '../**/bin'],
labels=['scaled-funnel-tests']
)

docker_build(
'scaled_funnel_tests',
'.',
dockerfile='scaled_funnel/tests.dockerfile',
only = ['out/scaled_funnel_tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_funnel funnel.yaml'))
k8s_resource(
'scaled-funnel-funnel',
resource_deps=['rabbitmq'],
labels=['scaled-funnel-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_funnel testapp1.yaml'))
k8s_resource(
'scaled-funnel-testapp1',
resource_deps=['rabbitmq'],
labels=['scaled-funnel-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh scaled_funnel tests.yaml'))
k8s_resource(
'scaled-funnel-tests',
resource_deps=['scaled-funnel-funnel', 'scaled-funnel-testapp1'],
labels=['scaled-funnel-tests']
)

# Multiple services tests

namespace_create('multiple-services')

local_resource(
'build-multiple-services-tests',
'dotnet publish -o out/multiple_services_tests ../test/LeanCode.Pipe.Funnel.MultipleServicesTests',
deps=[
'../src',
'../test/LeanCode.Pipe.Funnel.TestAppFunnel',
'../test/LeanCode.Pipe.Funnel.TestApp1',
'../test/LeanCode.Pipe.Funnel.TestApp2',
'../test/LeanCode.Pipe.Funnel.MultipleServicesTests' ],
ignore=['../**/obj', '../**/bin'],
labels=['multiple-services-tests']
)

docker_build(
'multiple_services_tests',
'.',
dockerfile='multiple_services/tests.dockerfile',
only = ['out/multiple_services_tests']
)

k8s_yaml(local('./subst_tpl_envs.sh multiple_services funnel.yaml'))
k8s_resource(
'multiple-services-funnel',
resource_deps=['rabbitmq'],
labels=['multiple-services-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh multiple_services testapp1.yaml'))
k8s_resource(
'multiple-services-testapp1',
resource_deps=['rabbitmq'],
labels=['multiple-services-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh multiple_services testapp2.yaml'))
k8s_resource(
'multiple-services-testapp2',
resource_deps=['rabbitmq'],
labels=['multiple-services-tests']
)

k8s_yaml(local('./subst_tpl_envs.sh multiple_services tests.yaml'))
k8s_resource(
'multiple-services-tests',
resource_deps=['multiple-services-funnel', 'multiple-services-testapp1', 'multiple-services-testapp2'],
labels=['multiple-services-tests']
)
Loading

0 comments on commit 58acf04

Please sign in to comment.