-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
170 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
|
||
namespace Difficalcy.Services | ||
{ | ||
public class TestBeatmapProvider : IBeatmapProvider | ||
{ | ||
private string _resourceAssemblyName; | ||
|
||
public TestBeatmapProvider(string resourceAssemblyName) | ||
{ | ||
_resourceAssemblyName = resourceAssemblyName; | ||
} | ||
|
||
public Task<bool> EnsureBeatmap(string beatmapId) | ||
{ | ||
var resourceName = $"{_resourceAssemblyName}.Resources.{beatmapId}"; | ||
var info = ResourceAssembly.GetManifestResourceInfo(resourceName); | ||
return Task.FromResult(info != null); | ||
} | ||
|
||
public Stream GetBeatmapStream(string beatmapId) | ||
{ | ||
var resourceNamespace = "Testing.Beatmaps"; | ||
var resourceName = $"{resourceNamespace}.{beatmapId}.osu"; | ||
var fullResourceName = $"{_resourceAssemblyName}.Resources.{resourceName}"; | ||
var stream = ResourceAssembly.GetManifestResourceStream(fullResourceName); | ||
if (stream == null) | ||
throw new Exception($@"Unable to find resource ""{fullResourceName}"" in assembly ""{_resourceAssemblyName}"""); | ||
return stream; | ||
} | ||
|
||
private Assembly ResourceAssembly | ||
{ | ||
get | ||
{ | ||
string localPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!; | ||
return Assembly.LoadFrom(Path.Combine(localPath, $"{_resourceAssemblyName}.dll")); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
services: | ||
e2e-test-runner: | ||
image: alpine | ||
build: ./e2e | ||
environment: | ||
- DIFFICALCY_OSU_HOST=e2e-difficalcy-osu:80 | ||
- DIFFICALCY_TAIKO_HOST=e2e-difficalcy-taiko:80 | ||
- DIFFICALCY_CATCH_HOST=e2e-difficalcy-catch:80 | ||
- DIFFICALCY_MANIA_HOST=e2e-difficalcy-mania:80 | ||
depends_on: | ||
- e2e-difficalcy-osu | ||
- e2e-difficalcy-taiko | ||
- e2e-difficalcy-catch | ||
- e2e-difficalcy-mania | ||
|
||
e2e-difficalcy-osu: | ||
build: | ||
context: . | ||
dockerfile: ./Difficalcy.Osu/Dockerfile | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Production | ||
- USE_TEST_BEATMAP_PROVIDER=true | ||
- REDIS_CONFIGURATION=cache:6379 | ||
depends_on: | ||
- cache | ||
|
||
e2e-difficalcy-taiko: | ||
build: | ||
context: . | ||
dockerfile: ./Difficalcy.Taiko/Dockerfile | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Production | ||
- USE_TEST_BEATMAP_PROVIDER=true | ||
- REDIS_CONFIGURATION=cache:6379 | ||
depends_on: | ||
- cache | ||
|
||
e2e-difficalcy-catch: | ||
build: | ||
context: . | ||
dockerfile: ./Difficalcy.Catch/Dockerfile | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Production | ||
- USE_TEST_BEATMAP_PROVIDER=true | ||
- REDIS_CONFIGURATION=cache:6379 | ||
depends_on: | ||
- cache | ||
|
||
e2e-difficalcy-mania: | ||
build: | ||
context: . | ||
dockerfile: ./Difficalcy.Mania/Dockerfile | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Production | ||
- USE_TEST_BEATMAP_PROVIDER=true | ||
- REDIS_CONFIGURATION=cache:6379 | ||
depends_on: | ||
- cache | ||
|
||
cache: | ||
image: redis:6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM alpine:3 | ||
|
||
RUN apk add --no-cache bash curl jq | ||
|
||
WORKDIR /e2e | ||
|
||
COPY test . | ||
|
||
CMD [ "./test" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
curl --fail http://$DIFFICALCY_OSU_HOST/api/calculator/info | jq | ||
curl --fail http://$DIFFICALCY_OSU_HOST/api/calculator/calculation?BeatmapId=diffcalc-test | jq | ||
|
||
curl --fail http://$DIFFICALCY_CATCH_HOST/api/calculator/info | jq | ||
curl --fail http://$DIFFICALCY_CATCH_HOST/api/calculator/calculation?BeatmapId=diffcalc-test | jq | ||
|
||
curl --fail http://$DIFFICALCY_TAIKO_HOST/api/calculator/info | jq | ||
curl --fail http://$DIFFICALCY_TAIKO_HOST/api/calculator/calculation?BeatmapId=diffcalc-test | jq | ||
|
||
curl --fail http://$DIFFICALCY_MANIA_HOST/api/calculator/info | jq | ||
curl --fail http://$DIFFICALCY_MANIA_HOST/api/calculator/calculation?BeatmapId=diffcalc-test | jq |