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

Use hurl for integration tests #27

Merged
merged 1 commit into from
Aug 21, 2023
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
6 changes: 6 additions & 0 deletions .github/workflows/pr-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: install hurl
uses: gacts/install-hurl@v1.0.3
with:
version: 4.0.0
- name: Start Docker containers
working-directory: .
run: docker-compose --project-directory . -f env/local/docker-compose.local.yml up -d
Expand All @@ -40,6 +44,8 @@ jobs:
- name: Run tests
working-directory: ./src/api
run: dotnet test --verbosity normal
- name: Run integration tests
run: hurl --test integrations/**/*.hurl
- name: Stop Docker containers
if: always()
working-directory: .
Expand Down
3 changes: 3 additions & 0 deletions integrations/tests/health.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GET http://localhost:5000/api/health

HTTP 200
55 changes: 55 additions & 0 deletions integrations/tests/secrets.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Create Secrets -- Test Invalid Input

POST http://localhost:5000/api/secrets
{
"message": "",
"expireMinutes": 10
}

HTTP 400

POST http://localhost:5000/api/secrets
{
"message": "Hello, World!",
"expireMinutes": 0
}

HTTP 400

POST http://localhost:5000/api/secrets
{
"message": "Hello, World!",
"expireMinutes": 10080
}

HTTP 400




# Create and Retrieve Secrets

POST http://localhost:5000/api/secrets
{
"message": "Hello, World!",
"expireMinutes": 10
}

HTTP 201
[Captures]
secret_id: jsonpath "$['secretId']"
key: jsonpath "$['key']"


GET http://localhost:5000/api/secrets/{{secret_id}}?key={{key}}

HTTP 200
[Asserts]
jsonpath "$['message']" == "Hello, World!"


# Getting the same secret again should fail
GET http://localhost:5000/api/secrets/{{secret_id}}?key={{key}}

HTTP 404

7 changes: 0 additions & 7 deletions src/api/SecretsSharingTool.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecretsSharingTool.Data", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecretsSharingTool.Data.Tests", "SecretsSharingTool.Data.Tests\SecretsSharingTool.Data.Tests.csproj", "{6A7E7FE5-8C7A-4E0F-9CCA-F63DB9FEC1EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecretsSharingTool.Web.Tests", "SecretsSharingTool.Web.Tests\SecretsSharingTool.Web.Tests.csproj", "{63B69660-D085-4F83-95FD-24EA4FCF2652}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -46,15 +44,10 @@ Global
{6A7E7FE5-8C7A-4E0F-9CCA-F63DB9FEC1EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A7E7FE5-8C7A-4E0F-9CCA-F63DB9FEC1EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A7E7FE5-8C7A-4E0F-9CCA-F63DB9FEC1EC}.Release|Any CPU.Build.0 = Release|Any CPU
{63B69660-D085-4F83-95FD-24EA4FCF2652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63B69660-D085-4F83-95FD-24EA4FCF2652}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63B69660-D085-4F83-95FD-24EA4FCF2652}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63B69660-D085-4F83-95FD-24EA4FCF2652}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{20B91B6D-C37F-4491-A848-C6BAE66A7C0A} = {66872805-2E12-4F37-8E08-08C508201861}
{2133FEDF-EBA3-49F9-826D-6CA3FBB76F86} = {66872805-2E12-4F37-8E08-08C508201861}
{6A7E7FE5-8C7A-4E0F-9CCA-F63DB9FEC1EC} = {66872805-2E12-4F37-8E08-08C508201861}
{63B69660-D085-4F83-95FD-24EA4FCF2652} = {66872805-2E12-4F37-8E08-08C508201861}
EndGlobalSection
EndGlobal
Loading