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

[ASM] Refactor AspNetCore5DatabaseTests #6482

Merged
merged 10 commits into from
Jan 7, 2025
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
7 changes: 0 additions & 7 deletions Datadog.Trace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoadContextResolve"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AspNet.MultipleAppsInDomain", "tracer\test\test-applications\aspnet\Samples.AspNet.MultipleAppsInDomain\Samples.AspNet.MultipleAppsInDomain.csproj", "{A82EB6F8-D8D0-4763-B252-08CA3F39D153}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Security.AspNetCore5.DatabaseIntegration", "tracer\test\test-applications\security\Samples.Security.AspNetCore5.DatabaseIntegration\Samples.Security.AspNetCore5.DatabaseIntegration.csproj", "{067CE939-C803-4959-890A-B6B34C83F87A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1430,10 +1428,6 @@ Global
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Release|Any CPU.Build.0 = Release|Any CPU
{067CE939-C803-4959-890A-B6B34C83F87A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{067CE939-C803-4959-890A-B6B34C83F87A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{067CE939-C803-4959-890A-B6B34C83F87A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{067CE939-C803-4959-890A-B6B34C83F87A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1666,7 +1660,6 @@ Global
{D6155F26-8245-4B66-8944-79C3DF9F9DA3} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
{8B1AF6A7-DD41-4347-B637-90C23D69B50E} = {498A300E-D036-49B7-A43D-821D1CAF11A5}
{A82EB6F8-D8D0-4763-B252-08CA3F39D153} = {AFA0AB23-64F0-4AC1-9050-6CE8FE06F580}
{067CE939-C803-4959-890A-B6B34C83F87A} = {0972AD57-B16B-494F-AE0A-091DD6F3B42B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
Expand Down
4 changes: 2 additions & 2 deletions tracer/build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ void RunWindowsIisIntegrationTests(Project project)
(null, _) => true,
(_, null) => true,
(_, { } p) when !string.IsNullOrWhiteSpace(SampleName) => p.Name.Contains(SampleName, StringComparison.OrdinalIgnoreCase),
(false, { } p) => p.RequiresDockerDependency() == DockerDependencyType.None,
(false, { } p) => p.RequiresDockerDependency() is DockerDependencyType.None or DockerDependencyType.Mixed,
(true, { } p) => p.RequiresDockerDependency() != DockerDependencyType.None,
})
.Where(x =>
Expand Down Expand Up @@ -1938,7 +1938,7 @@ var name when multiPackageProjects.Contains(name) => false,
(null, _) => true,
(_, { project: null}) => true,
(_, { } p) when !string.IsNullOrWhiteSpace(SampleName) => p.project.Name.Contains(SampleName, StringComparison.OrdinalIgnoreCase),
(false, { } p) => p.project.RequiresDockerDependency() == DockerDependencyType.None,
(false, { } p) => p.project.RequiresDockerDependency() == DockerDependencyType.None || p.project.RequiresDockerDependency() == DockerDependencyType.Mixed,
(true, { } p) => p.project.RequiresDockerDependency() != DockerDependencyType.None,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public enum DockerDependencyType
public enum DockerDependencyType
{
/// <summary>
/// Does not require Docker to run sample
Expand All @@ -14,4 +14,9 @@
/// Requires Docker on all platforms except Windows to run samples.
/// </summary>
LinuxAndMac,

/// <summary>
/// Contains both tests that require Docker and tests that do not.
/// </summary>
Mixed,
}
Comment on lines +17 to +21
Copy link
Member

Choose a reason for hiding this comment

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

FYI, I'm working on a PR currently that moves the build to a completely separate stage, and just builds all the samples. That should both speed up the build, and remove some of this complexity. Once I've done that, I think we can just ditch this entirely. It's all fine for now though 👍

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AspNetCore5IastDbTests.cs" company="Datadog">
// <copyright file="AspNetCore5IastDbTests.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>
Expand All @@ -18,7 +18,7 @@ namespace Datadog.Trace.Security.IntegrationTests.IAST;
public class AspNetCore5IastDbTests : AspNetCore5IastTests
{
public AspNetCore5IastDbTests(AspNetCoreTestFixture fixture, ITestOutputHelper outputHelper)
: base(fixture, outputHelper, enableIast: true, testName: "AspNetCore5IastDbTestsIastEnabled", samplingRate: 100, vulnerabilitiesPerRequest: 200, isIastDeduplicationEnabled: false, sampleName: "AspNetCore5.DatabaseIntegration")
: base(fixture, outputHelper, enableIast: true, testName: "AspNetCore5IastDbTestsIastEnabled", samplingRate: 100, vulnerabilitiesPerRequest: 200, isIastDeduplicationEnabled: false, sampleName: "AspNetCore5")
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
SpanId: Id_2,
Name: aspnet_core.request,
Resource: GET /iast/storedsqli,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
Tags: {
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.DatabaseIntegration.IastController.StoredSqli (Samples.Security.AspNetCore5.DatabaseIntegration),
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.IastController.StoredSqli (Samples.Security.AspNetCore5),
aspnet_core.route: iast/storedsqli,
component: aspnet_core,
env: integration_tests,
Expand All @@ -29,7 +29,7 @@
"hash": XXX,
"location": {
"spanId": XXX,
"path": "Samples.Security.AspNetCore5.Controllers.DatabaseIntegration.IastController",
"path": "Samples.Security.AspNetCore5.Controllers.IastController",
"method": "StoredSqli"
},
"evidence": {
Expand Down Expand Up @@ -72,7 +72,7 @@
SpanId: Id_3,
Name: aspnet_core_mvc.request,
Resource: GET /iast/storedsqli,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
ParentId: Id_2,
Tags: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
SpanId: Id_2,
Name: aspnet_core.request,
Resource: GET /iast/storedxss,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
Tags: {
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.DatabaseIntegration.IastController.StoredXss (Samples.Security.AspNetCore5.DatabaseIntegration),
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.IastController.StoredXss (Samples.Security.AspNetCore5),
aspnet_core.route: iast/storedxss,
component: aspnet_core,
env: integration_tests,
Expand Down Expand Up @@ -69,7 +69,7 @@
SpanId: Id_3,
Name: aspnet_core_mvc.request,
Resource: GET /iast/storedxss,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
ParentId: Id_2,
Tags: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
SpanId: Id_2,
Name: aspnet_core.request,
Resource: GET /iast/storedxssescaped,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
Tags: {
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.DatabaseIntegration.IastController.StoredXssEscaped (Samples.Security.AspNetCore5.DatabaseIntegration),
aspnet_core.endpoint: Samples.Security.AspNetCore5.Controllers.IastController.StoredXssEscaped (Samples.Security.AspNetCore5),
aspnet_core.route: iast/storedxssescaped,
component: aspnet_core,
env: integration_tests,
Expand All @@ -34,7 +34,7 @@
SpanId: Id_3,
Name: aspnet_core_mvc.request,
Resource: GET /iast/storedxssescaped,
Service: Samples.Security.AspNetCore5.DatabaseIntegration,
Service: Samples.Security.AspNetCore5,
Type: web,
ParentId: Id_2,
Tags: {
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading