Skip to content

Cherry-Picking Commits for 1.5 #2689

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

Open
wants to merge 9 commits into
base: release/1.5
Choose a base branch
from
5 changes: 3 additions & 2 deletions .pipelines/cosmos-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ steps:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
5 changes: 3 additions & 2 deletions .pipelines/dwsql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ jobs:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
5 changes: 3 additions & 2 deletions .pipelines/mssql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ jobs:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
5 changes: 3 additions & 2 deletions .pipelines/mysql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ jobs:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
5 changes: 3 additions & 2 deletions .pipelines/pg-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ jobs:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
6 changes: 4 additions & 2 deletions .pipelines/templates/build-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ steps:

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
- task: DotNetCoreCLI@2
displayName: Restore NuGet packages
inputs:
restoreSolution: '$(solution)'
command: restore
projects: '$(solution)'
feedsToUse: config
nugetConfigPath: Nuget.config

Expand Down
5 changes: 5 additions & 0 deletions schemas/dab.draft.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@
"type": "string"
},
"default": null
},
"cache-ttl-seconds": {
"type": "integer",
"description": "Time to live in seconds for the Comprehensive Health Check Report cache entry.",
"default": 5
}
}
}
Expand Down
57 changes: 54 additions & 3 deletions src/Cli.Tests/AddEntityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public Task AddNewEntityWhenEntitiesEmpty()
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
Expand Down Expand Up @@ -67,6 +69,8 @@ public Task AddNewEntityWhenEntitiesNotEmpty()
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
Expand Down Expand Up @@ -96,10 +100,12 @@ public void AddDuplicateEntity()
fieldsToExclude: null,
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
);
);

string initialConfiguration = AddPropertiesToJson(INITIAL_CONFIG, GetFirstEntityConfiguration());
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(initialConfiguration, out RuntimeConfig? runtimeConfig), "Loaded config");
Expand All @@ -117,8 +123,8 @@ public void AddDuplicateEntity()
public Task AddEntityWithAnExistingNameButWithDifferentCase()
{
AddOptions options = new(
source: "MyTable",
permissions: new string[] { "anonymous", "*" },
source: "MyTable",
permissions: new string[] { "anonymous", "*" },
entity: "FIRSTEntity",
sourceType: null,
sourceParameters: null,
Expand All @@ -129,6 +135,8 @@ public Task AddEntityWithAnExistingNameButWithDifferentCase()
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
Expand All @@ -138,6 +146,35 @@ public Task AddEntityWithAnExistingNameButWithDifferentCase()
return ExecuteVerifyTest(options, initialConfiguration);
}

/// <summary>
/// Simple test to verify success on adding a new entity with caching enabled.
/// </summary>
[TestMethod]
public Task AddEntityWithCachingEnabled()
{
AddOptions options = new(
source: "MyTable",
permissions: new string[] { "anonymous", "*" },
entity: "CachingEntity",
sourceType: null,
sourceParameters: null,
sourceKeyFields: null,
restRoute: null,
graphQLType: null,
fieldsToInclude: null,
fieldsToExclude: null,
policyRequest: null,
policyDatabase: null,
cacheEnabled: "true",
cacheTtl: "1",
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
);

return ExecuteVerifyTest(options);
}

/// <summary>
/// Add Entity with Policy and Field properties
/// </summary>
Expand Down Expand Up @@ -165,6 +202,8 @@ public Task AddEntityWithPolicyAndFieldProperties(
policyRequest: policyRequest,
policyDatabase: policyDatabase,
config: TEST_RUNTIME_CONFIG_FILE,
cacheEnabled: null,
cacheTtl: null,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
);
Expand Down Expand Up @@ -195,6 +234,8 @@ public Task AddNewEntityWhenEntitiesWithSourceAsStoredProcedure()
policyRequest: null,
policyDatabase: null,
config: TEST_RUNTIME_CONFIG_FILE,
cacheEnabled: null,
cacheTtl: null,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
);
Expand Down Expand Up @@ -223,6 +264,8 @@ public Task TestAddStoredProcedureWithRestMethodsAndGraphQLOperations()
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: new string[] { "Post", "Put", "Patch" },
graphQLOperationForStoredProcedure: "Query"
Expand Down Expand Up @@ -271,6 +314,8 @@ public void TestAddNewEntityWithSourceObjectHavingValidFields(
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
Expand Down Expand Up @@ -328,6 +373,8 @@ public Task TestAddNewSpWithDifferentRestAndGraphQLOptions(
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: restMethods,
graphQLOperationForStoredProcedure: graphQLOperation
Expand Down Expand Up @@ -361,6 +408,8 @@ public void TestAddStoredProcedureWithConflictingRestGraphQLOptions(
fieldsToExclude: new string[] { },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: restMethods,
graphQLOperationForStoredProcedure: graphQLOperation
Expand Down Expand Up @@ -397,6 +446,8 @@ public void TestAddEntityPermissionWithInvalidOperation(IEnumerable<string> perm
fieldsToExclude: new string[] { "level" },
policyRequest: null,
policyDatabase: null,
cacheEnabled: null,
cacheTtl: null,
config: TEST_RUNTIME_CONFIG_FILE,
restMethodsForStoredProcedure: null,
graphQLOperationForStoredProcedure: null
Expand Down
2 changes: 2 additions & 0 deletions src/Cli.Tests/ModuleInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public static void Init()
VerifierSettings.IgnoreMember<RuntimeConfig>(options => options.EnableAggregation);
// Ignore the AllowedRolesForHealth as that's unimportant from a test standpoint.
VerifierSettings.IgnoreMember<RuntimeConfig>(config => config.AllowedRolesForHealth);
// Ignore the CacheTtlSeconds as that's unimportant from a test standpoint.
VerifierSettings.IgnoreMember<RuntimeConfig>(config => config.CacheTtlSecondsForHealthReport);
// Ignore the EnableAggregation as that's unimportant from a test standpoint.
VerifierSettings.IgnoreMember<GraphQLRuntimeOptions>(options => options.EnableAggregation);
// Ignore the EnableDwNto1JoinOpt as that's unimportant from a test standpoint.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
DataSource: {
DatabaseType: MSSQL
},
Runtime: {
Rest: {
Enabled: true,
Path: /api,
RequestBodyStrict: true
},
GraphQL: {
Enabled: true,
Path: /graphql,
AllowIntrospection: true
},
Host: {
Cors: {
AllowCredentials: false
},
Authentication: {
Provider: StaticWebApps
}
}
},
Entities: [
{
CachingEntity: {
Source: {
Object: MyTable,
Type: Table
},
GraphQL: {
Singular: CachingEntity,
Plural: CachingEntities,
Enabled: true
},
Rest: {
Enabled: true
},
Permissions: [
{
Role: anonymous,
Actions: [
{
Action: *
}
]
}
],
Cache: {
Enabled: true,
TtlSeconds: 1
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
DataSource: {
DatabaseType: MSSQL
},
Runtime: {
Rest: {
Enabled: true,
Path: /,
RequestBodyStrict: true
},
GraphQL: {
Enabled: true,
Path: /graphql,
AllowIntrospection: true
},
Host: {
Cors: {
AllowCredentials: false
},
Authentication: {
Provider: StaticWebApps,
Jwt: {
Audience: ,
Issuer:
}
}
}
},
Entities: [
{
MyEntity: {
Source: {
Object: MyTable,
Type: Table
},
GraphQL: {
Singular: MyEntity,
Plural: MyEntities,
Enabled: true
},
Rest: {
Enabled: true
},
Cache: {
Enabled: true,
TtlSeconds: 1
}
}
}
]
}
Loading
Loading