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

refactor: organize targets by service not endpoint #567

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
101 changes: 53 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
# - On other operating systems `make build` (test) we only runs the .NET 6.0 build (test) targets.
# - We also have a GRPC_WEB flag that can be set to true to enable gRPC-Web support.
# - The caller can run `make GRPC_WEB=true build` to enable gRPC-Web support.
# - We additionally group the integration tests by endpoint (cache, control, token).
# - This is to allow for more granular testing by endpoint.
# - Similar to `build` and `test` targets, we have `test-cache-endpoint`, `test-control-endpoint`, `test-token-endpoint`, and `test-storage-endpoint` targets
# - We additionally group the integration tests by service (auth, cache, topics).
# - This is to allow for more granular testing by service.
# - Similar to `build` and `test` targets, we have `test-cache-service`, `test-topics-service`, `test-auth-service` targets
# that are conditionally run based on the operating system.

.PHONY: all build build-dotnet6 build-dotnet-framework clean clean-build precommit restore test \
test-dotnet6 test-dotnet6-integration test-dotnet6-cache-endpoint test-dotnet6-control-endpoint test-dotnet6-token-endpoint \
test-dotnet-framework test-dotnet-framework-integration test-dotnet-framework-cache-endpoint test-dotnet-framework-control-endpoint test-dotnet-framework-token-endpoint \
test-control-endpoint test-cache-endpoint test-token-endpoint test-storage-endpoint \
test-dotnet6 test-dotnet6-integration test-dotnet6-cache-service test-dotnet6-topics-service test-dotnet6-auth-service \
test-dotnet-framework test-dotnet-framework-integration test-dotnet-framework-cache-service test-dotnet-framework-topics-service test-dotnet-framework-auth-service \
test-auth-service test-cache-service test-leaderboard-service test-storage-service test-topics-service \
run-examples help

# Determine the operating system
Expand All @@ -32,15 +32,15 @@ TEST_LOGGER_OPTIONS := --logger "console;verbosity=detailed"
ifneq (,$(findstring NT,$(OS)))
BUILD_TARGETS := build-dotnet6 build-dotnet-framework
TEST_TARGETS := test-dotnet6 test-dotnet-framework
TEST_TARGETS_CACHE_ENDPOINT := test-dotnet6-cache-endpoint test-dotnet-framework-cache-endpoint
TEST_TARGETS_CONTROL_ENDPOINT := test-dotnet6-control-endpoint test-dotnet-framework-control-endpoint
TEST_TARGETS_TOKEN_ENDPOINT := test-dotnet6-token-endpoint test-dotnet-framework-token-endpoint
TEST_TARGETS_AUTH_SERVICE := test-dotnet6-auth-service test-dotnet-framework-auth-service
TEST_TARGETS_CACHE_SERVICE := test-dotnet6-cache-service test-dotnet-framework-cache-service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@malandis I think we still need to keep control plane tests separate since it has a different endpoint, right? sorry if I missed calling this out when you pinged me in slack the other day. lmk if you want to zoom about it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clearing that up. As discussed we can loop back and split this up additionally by endpoint.

TEST_TARGETS_TOPICS_SERVICE := test-dotnet6-topics-service test-dotnet-framework-topics-service
else
BUILD_TARGETS := build-dotnet6
TEST_TARGETS := test-dotnet6
TEST_TARGETS_CACHE_ENDPOINT := test-dotnet6-cache-endpoint
TEST_TARGETS_CONTROL_ENDPOINT := test-dotnet6-control-endpoint
TEST_TARGETS_TOKEN_ENDPOINT := test-dotnet6-token-endpoint
TEST_TARGETS_AUTH_SERVICE := test-dotnet6-auth-service
TEST_TARGETS_CACHE_SERVICE := test-dotnet6-cache-service
TEST_TARGETS_TOPICS_SERVICE := test-dotnet6-topics-service
endif

# Enable gRPC-Web if requested
Expand All @@ -50,9 +50,9 @@ ifeq ($(GRPC_WEB), true)
endif

# Various test filters
CACHE_ENDPOINT_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Cache.Data|FullyQualifiedName~Momento.Sdk.Tests.Integration.Topics.Data"
CONTROL_ENDPOINT_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Cache.Control"
TOKEN_ENDPOINT_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Auth"
CACHE_SERVICE_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Cache"
TOPICS_SERVICE_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Topics"
AUTH_SERVICE_TESTS_FILTER := "FullyQualifiedName~Momento.Sdk.Tests.Integration.Auth"


## Generate sync unit tests, format, lint, and test
Expand Down Expand Up @@ -104,22 +104,22 @@ test-dotnet6:
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION}


## Run integration tests on the .NET 6.0 runtime against the cache endpoint
test-dotnet6-cache-endpoint:
@echo "Running integration tests on the .NET 6.0 runtime against the cache endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${CACHE_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET 6.0 runtime against the cache service
test-dotnet6-cache-service:
@echo "Running integration tests on the .NET 6.0 runtime against the cache service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${CACHE_SERVICE_TESTS_FILTER}


## Run integration tests on the .NET 6.0 runtime against the control endpoint
test-dotnet6-control-endpoint:
@echo "Running integration tests on the .NET 6.0 runtime against the control endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${CONTROL_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET 6.0 runtime against the topics service
test-dotnet6-topics-service:
@echo "Running integration tests on the .NET 6.0 runtime against the topics service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${TOPICS_SERVICE_TESTS_FILTER}


## Run integration tests on the .NET 6.0 runtime against the token endpoint
test-dotnet6-token-endpoint:
@echo "Running integration tests on the .NET 6.0 runtime against the token endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${TOKEN_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET 6.0 runtime against the auth service
test-dotnet6-auth-service:
@echo "Running integration tests on the .NET 6.0 runtime against the auth service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_VERSION} --filter ${AUTH_SERVICE_TESTS_FILTER}


## Run unit and integration tests on the .NET Framework runtime (Windows only)
Expand All @@ -128,39 +128,44 @@ test-dotnet-framework:
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION}


## Run integration tests on the .NET Framework runtime against the cache endpoint (Windows only)
test-dotnet-framework-cache-endpoint:
@echo "Running integration tests on the .NET Framework runtime against the cache endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${CACHE_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET Framework runtime against the cache service (Windows only)
test-dotnet-framework-cache-service:
@echo "Running integration tests on the .NET Framework runtime against the cache service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${CACHE_SERVICE_TESTS_FILTER}


## Run integration tests on the .NET Framework runtime against the control endpoint (Windows only)
test-dotnet-framework-control-endpoint:
@echo "Running integration tests on the .NET Framework runtime against the control endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${CONTROL_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET Framework runtime against the topics service (Windows only)
test-dotnet-framework-topics-service:
@echo "Running integration tests on the .NET Framework runtime against the topics service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${TOPICS_SERVICE_TESTS_FILTER}


## Run integration tests on the .NET Framework runtime against the token endpoint (Windows only)
test-dotnet-framework-token-endpoint:
@echo "Running integration tests on the .NET Framework runtime against the token endpoint..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${TOKEN_ENDPOINT_TESTS_FILTER}
## Run integration tests on the .NET Framework runtime against the auth service (Windows only)
test-dotnet-framework-auth-service:
@echo "Running integration tests on the .NET Framework runtime against the auth service..."
@dotnet test ${TEST_LOGGER_OPTIONS} -f ${DOTNET_FRAMEWORK_VERSION} --filter ${AUTH_SERVICE_TESTS_FILTER}


## Run cache endpoint tests
test-cache-endpoint: ${TEST_TARGETS_CACHE_ENDPOINT}
## Run auth service tests
test-auth-service: ${TEST_TARGETS_AUTH_SERVICE}


## Run control endpoint tests
test-control-endpoint: ${TEST_TARGETS_CONTROL_ENDPOINT}
## Run cache service tests
test-cache-service: ${TEST_TARGETS_CACHE_SERVICE}


## Run token endpoint tests
test-token-endpoint: ${TEST_TARGETS_TOKEN_ENDPOINT}
## Run leaderboard service tests
test-leaderboard-service:
@echo "Leaderboard client not implemented yet."


## Run storage endpoint tests
test-storage-endpoint:
@echo "Storage tests are not yet implemented."
## Run storage service tests
test-storage-service:
@echo "Storage client not implemented yet."


## Run topics service tests
test-topics-service: ${TEST_TARGETS_TOPICS_SERVICE}


## Run example applications and snippets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;
using Momento.Sdk.Auth;

namespace Momento.Sdk.Tests.Integration.Cache.Control;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class CacheControlTest : TestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Momento.Sdk.Config;
using Momento.Sdk.Config.Transport;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

public class CacheEagerConnectionTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Threading.Tasks;
using Momento.Sdk.Internal.ExtensionMethods;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class CacheDataTest : TestBase
public class CacheScalarTest : TestBase
{
// Test initialization
public CacheDataTest(CacheClientFixture fixture) : base(fixture)
public CacheScalarTest(CacheClientFixture fixture) : base(fixture)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Momento.Sdk.Internal.ExtensionMethods;
using Momento.Sdk.Requests;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class DictionaryTest : TestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Momento.Sdk.Responses;
using Momento.Sdk.Tests;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class ListTest : TestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Momento.Sdk.Tests;
using Xunit.Abstractions;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class SetTest : TestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Momento.Sdk.Internal.ExtensionMethods;

namespace Momento.Sdk.Tests.Integration.Cache.Data;
namespace Momento.Sdk.Tests.Integration.Cache;

[Collection("CacheClient")]
public class TtlTest : TestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Momento.Sdk.Tests.Integration.Topics.Data;
namespace Momento.Sdk.Tests.Integration.Topics;

public class TopicTest : IClassFixture<CacheClientFixture>, IClassFixture<TopicClientFixture>
{
Expand Down
Loading