Skip to content

Commit f4f6fa6

Browse files
Christoph Bühlerbuehler
authored andcommitted
feat(testing): split out the testing resources.
BREAKING CHANGE: This removes the application factory from `KubeOps`. Please install the `KubeOps.Testing` package if you need the resources.
1 parent 590432f commit f4f6fa6

File tree

13 files changed

+111
-7
lines changed

13 files changed

+111
-7
lines changed

DotnetOperatorSdk.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ ProjectSection(SolutionItems) = preProject
3232
.releaserc.json = .releaserc.json
3333
EndProjectSection
3434
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Testing", "src\KubeOps.Testing\KubeOps.Testing.csproj", "{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}"
36+
EndProject
3537
Global
3638
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3739
Debug|Any CPU = Debug|Any CPU
@@ -56,6 +58,10 @@ Global
5658
{B374D7E4-E9BA-47F8-B1A4-440DECD376E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
5759
{B374D7E4-E9BA-47F8-B1A4-440DECD376E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
5860
{B374D7E4-E9BA-47F8-B1A4-440DECD376E4}.Release|Any CPU.Build.0 = Release|Any CPU
61+
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62+
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Debug|Any CPU.Build.0 = Debug|Any CPU
63+
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Release|Any CPU.ActiveCfg = Release|Any CPU
64+
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Release|Any CPU.Build.0 = Release|Any CPU
5965
EndGlobalSection
6066
GlobalSection(SolutionProperties) = preSolution
6167
HideSolutionNode = FALSE
@@ -66,6 +72,7 @@ Global
6672
{D47717CB-A02E-4B12-BAA8-1D7F8BAE9BBD} = {9AF95FE4-DA1F-4BB0-B60E-23FCFA6AAAA2}
6773
{751BDC14-D75F-4DDE-9C45-2432041FBCAC} = {50E9B964-68F7-4B9F-BEA8-165CE45BC5C6}
6874
{B374D7E4-E9BA-47F8-B1A4-440DECD376E4} = {50E9B964-68F7-4B9F-BEA8-165CE45BC5C6}
75+
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93} = {95F3A6DD-B421-441D-B263-1B34A1465FF5}
6976
EndGlobalSection
7077
GlobalSection(ExtensibilityGlobals) = postSolution
7178
SolutionGuid = {ADAA5DFB-A7E5-490C-88EF-48D67C715F24}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="..\..\config\Common.targets" />
4+
<Import Project="..\..\config\CodeAnalysis.targets" />
5+
6+
<PropertyGroup>
7+
<IsPackable>true</IsPackable>
8+
<PackageId>KubeOps.Testing</PackageId>
9+
<PackageTags>Kubernetes Operator SDK CustomResourceDefinition Testing Test</PackageTags>
10+
<PackageProjectUrl>https://github.com/buehler/dotnet-operator-sdk</PackageProjectUrl>
11+
<PackageLicense>https://opensource.org/licenses/MIT</PackageLicense>
12+
<PackageDescription>
13+
Additional Resources that helps / supports integration
14+
testing on a kubernetes operator written with the KubeOps
15+
operator sdk.
16+
</PackageDescription>
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.7" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<ProjectReference Include="..\KubeOps\KubeOps.csproj" />
25+
</ItemGroup>
26+
27+
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/KubeOps/KubeOps.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<PropertyGroup>
77
<OutputType>exe</OutputType>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
89
</PropertyGroup>
910

1011
<PropertyGroup>
@@ -42,10 +43,4 @@
4243
</Content>
4344
</ItemGroup>
4445

45-
<ItemGroup>
46-
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
47-
<_Parameter1>$(MSBuildProjectName).Test</_Parameter1>
48-
</AssemblyAttribute>
49-
</ItemGroup>
50-
5146
</Project>

src/KubeOps/Operator/Caching/CacheComparisonResult.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,31 @@
22
{
33
public enum CacheComparisonResult
44
{
5+
/// <summary>
6+
/// The resource is new to the cache
7+
/// and was never seen.
8+
/// </summary>
59
New,
10+
11+
/// <summary>
12+
/// The resource was in the cache and some
13+
/// properties changed (but not resourceVersion).
14+
/// </summary>
615
Modified,
16+
17+
/// <summary>
18+
/// The resource has changed, but only the "status" of it.
19+
/// </summary>
720
StatusModified,
21+
22+
/// <summary>
23+
/// The resource has changed, but only the "finalizers" list.
24+
/// </summary>
825
FinalizersModified,
26+
27+
/// <summary>
28+
/// The resource stayed the same.
29+
/// </summary>
930
NotModified,
1031
}
1132
}

src/KubeOps/Operator/Entities/EntityScope.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
{
33
public enum EntityScope
44
{
5+
/// <summary>
6+
/// The resource is namespace.
7+
/// </summary>
58
Namespaced,
9+
10+
/// <summary>
11+
/// The resource is cluster-wide.
12+
/// </summary>
613
Cluster,
714
}
815
}

src/KubeOps/Operator/Entities/Extensions/DeepCloneExtensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ internal static class DeepCloneExtensions
1818
throw new ArgumentNullException();
1919

2020
/// <summary>
21-
/// Returns a Deep Clone / Deep Copy of an object of type T using a recursive call to the CloneMethod specified above.
21+
/// Returns a Deep Clone / Deep Copy of an object of type T using a recursive
22+
/// call to the CloneMethod specified above.
2223
/// </summary>
24+
/// <param name="obj">The object to deeply clone.</param>
25+
/// <typeparam name="TResource">Object type.</typeparam>
26+
/// <returns>A deep clone of a given object.</returns>
2327
internal static TResource DeepClone<TResource>(this TResource obj)
2428
where TResource : IKubernetesObject<V1ObjectMeta>
2529
{

0 commit comments

Comments
 (0)