Skip to content

Commit 7757d5e

Browse files
#36 Test local
1 parent 8242329 commit 7757d5e

File tree

21 files changed

+231
-97
lines changed

21 files changed

+231
-97
lines changed

bicep/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var applicationInsightsName = '${applicationName}Insights'
2727
var apimName = '${applicationName}Apim'
2828
var sqlServerName = '${applicationName}-db'
2929
var staticWebAppName = '${applicationName}Web'
30-
var storageAccountName = toLower('${applicationName}functionstore')
30+
var storageAccountName = take(toLower(replace('${applicationName}func', '-', '')), 24)
3131
var functionsApps = [
3232
'Trips'
3333
'Drivers'

bicep/modules/cosmosdb.bicep

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ param location string = resourceGroup().location
99
param databaseName string
1010
param resourceTags object
1111

12+
param throughput int = 400
13+
1214
var containerNames = [
1315
'main'
1416
'archiver'
@@ -24,11 +26,6 @@ resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
2426
consistencyPolicy: {
2527
defaultConsistencyLevel: 'Session'
2628
}
27-
capabilities: [
28-
{
29-
name: 'EnableServerless'
30-
}
31-
]
3229
enableFreeTier: false
3330
locations: [
3431
{
@@ -53,6 +50,9 @@ resource cosmosDB 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-06-15
5350
resource: {
5451
id: '${toLower(databaseName)}'
5552
}
53+
options: {
54+
throughput: throughput
55+
}
5656
}
5757
}
5858

bicep/parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
},
2222
"secretName": "sqlAdminPassword"
2323
}
24+
},
25+
"staticWebAppLocation": {
26+
"value": "westus2"
2427
}
2528
}
2629
}

documentation/monitoring-testing.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ The .NET `ServerlessMicroservices.Seeder` project contains a multi-thread tester
1212

1313
**Please note** that the test will usually run against a deployment environment where the `AuthEnabled` setting is set to false.
1414

15+
```powershell
16+
> ServerlessMicroservices.Seeder.exe testTrips --help
17+
18+
Usage: testTrips [options]
19+
20+
Options:
21+
--help Show help information
22+
-t|--seeddriversurl Set seed drivers url
23+
-t|--testurl Set test url
24+
-i|--testiterations Set test iterations
25+
-s|--testseconds Set test seconds
26+
-v|--signalrinfourl Set SignalR Info URL
27+
28+
> ServerlessMicroservices.Seeder.exe testTrips --seeddriversurl http://localhost:7071 --testurl http://localhost:7072/api/triptestparameters
29+
```
30+
1531
The `testTrips` command takes 1 mandatory argument and 2 optional arguments i.e. `ServerlessMicroservices.Seeder testTrips testUrl testiterations testseconds`
1632

1733
- Test Parameters URL to read the test data from.

documentation/setup.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ az group create -n serverless-microservices-dev -l westus2
8686
az deployment group create -g serverless-microservices-dev -f bicep/main.bicep -p @bicep/parameters.local.json
8787
```
8888

89+
Create local settings:
90+
91+
``` powershell
92+
cd dotnet
93+
copy ServerlessMicroservices.FunctionApp.Drivers\local.settings.example.json ServerlessMicroservices.FunctionApp.Drivers\local.settings.json
94+
copy ServerlessMicroservices.FunctionApp.Orchestrators\local.settings.example.json ServerlessMicroservices.FunctionApp.Orchestrators\local.settings.json
95+
copy ServerlessMicroservices.FunctionApp.Passengers\local.settings.example.json ServerlessMicroservices.FunctionApp.Passengers\local.settings.json
96+
copy ServerlessMicroservices.FunctionApp.Trips\local.settings.example.json ServerlessMicroservices.FunctionApp.Trips\local.settings.json
97+
# Update local settings with your environment's values
98+
```
99+
89100
Build and run local:
90101

91102
```powershell
@@ -1503,16 +1514,27 @@ From a PowerShell command, use the following commands for the `Prod` environment
15031514

15041515
## Seeding
15051516

1506-
The .NET `ServerlessMicroservices.Seeder` project contains a seeding command that can be used to seed `drivers` and `passengers` using the `Drivers APIs` and `Passengers APIs`, respectively.
1517+
The .NET `ServerlessMicroservices.Seeder` project contains a seeding command that can be used to seed `drivers` using the `Drivers APIs`.
15071518

1508-
**Please note** that the `seed` command will seed drivers only if there are no drivers and will seed passengers only if there are no passengers in the solution's database.
1519+
**Please note** that the `seed` command will seed drivers only if there are no drivers.
15091520

15101521
> You must set the **EnableAuth** App Setting on the **Drivers** and **Passengers** Function Apps to `false` for the seeder to work.
15111522
1512-
The `seed` command takes 5 non-optional arguments i.e. `ServerlessMicroservices.Seeder.exe seed --seeddriversurl https://ridesharedrivers.azurewebsites.net --seedpassengersurl https://ridesharepassengers.azurewebsites.net`
1523+
```
1524+
> ServerlessMicroservices.Seeder.exe seed --help
1525+
1526+
Usage: seed [options]
1527+
1528+
Options:
1529+
--help Show help information
1530+
-t|--seeddriversurl Set seed drivers url
1531+
-t|--testurl Set test url
1532+
-i|--testiterations Set test iterations
1533+
-s|--testseconds Set test seconds
1534+
-v|--signalrinfourl Set SignalR Info URL
15131535
1514-
- Drivers Function Base URL
1515-
- Passengers Function Base URL
1536+
> ServerlessMicroservices.Seeder.exe seed --seeddriversurl https://ridesharedrivers.azurewebsites.net
1537+
```
15161538

15171539
## Containers
15181540

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"ServerlessMicroservices.FunctionApp.Orchestrators": {
4+
"commandName": "Project",
5+
"commandLineArgs": "start --port 7074"
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"ServerlessMicroservices.FunctionApp.Passengers": {
4+
"commandName": "Project",
5+
"commandLineArgs": "start --port 7073"
6+
}
7+
}
8+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"profiles": {
33
"ServerlessMicroservices.FunctionApp.Trips": {
4-
"commandName": "Project"
4+
"commandName": "Project",
5+
"commandLineArgs": "start --port 7072"
56
}
67
}
78
}

dotnet/ServerlessMicroservices.Models/BaseItem.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System;
2-
using System.Text.Json.Serialization;
1+
using Newtonsoft.Json;
2+
using System;
33

44
namespace ServerlessMicroservices.Models
55
{
@@ -15,19 +15,19 @@ public enum ItemCollectionTypes
1515

1616
public class BaseItem
1717
{
18-
[JsonPropertyName("id")]
18+
[JsonProperty("id")]
1919
public string Id { get; set; } = "";
2020

21-
[JsonPropertyName("_self")]
21+
[JsonProperty("self")]
2222
public string Self { get; set; } = "";
2323

24-
[JsonPropertyName("correlationId")]
24+
[JsonProperty("correlationId")]
2525
public string CorrelationId { get; set; } = "";
2626

27-
[JsonPropertyName("upsertDate")]
27+
[JsonProperty("upsertDate")]
2828
public DateTime UpsertDate { get; set; } = DateTime.Now;
2929

30-
[JsonPropertyName("collectionType")]
30+
[JsonProperty("collectionType")]
3131
public ItemCollectionTypes CollectionType { get; set; }
3232
}
3333
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
using System.Text.Json.Serialization;
1+
using Newtonsoft.Json;
22

33
namespace ServerlessMicroservices.Models
44
{
55
public class CarItem : BaseItem
66
{
7-
[JsonPropertyName("driverCode")]
7+
[JsonProperty("driverCode")]
88
public string DriverCode { get; set; } = "";
99

10-
[JsonPropertyName("make")]
10+
[JsonProperty("make")]
1111
public string Make { get; set; } = "";
1212

13-
[JsonPropertyName("model")]
13+
[JsonProperty("model")]
1414
public string Model { get; set; } = "";
1515

16-
[JsonPropertyName("year")]
16+
[JsonProperty("year")]
1717
public string Year { get; set; } = "";
1818

19-
[JsonPropertyName("color")]
19+
[JsonProperty("color")]
2020
public string Color { get; set; } = "";
2121

22-
[JsonPropertyName("licensePlate")]
22+
[JsonProperty("licensePlate")]
2323
public string LicensePlate { get; set; } = "";
2424
}
2525
}

0 commit comments

Comments
 (0)