Skip to content

Commit

Permalink
chore: make template tests async and use editorconfig (#604)
Browse files Browse the repository at this point in the history
This fixes #542.
  • Loading branch information
buehler authored Sep 19, 2023
1 parent 9e9bc0f commit 1602b1c
Show file tree
Hide file tree
Showing 117 changed files with 651 additions and 283 deletions.
473 changes: 331 additions & 142 deletions .editorconfig

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DotnetOperatorSdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{EF94C4
ProjectSection(SolutionItems) = preProject
config\CodeAnalysis.targets = config\CodeAnalysis.targets
config\Common.targets = config\Common.targets
config\project.ruleset = config\project.ruleset
config\stylecop.json = config\stylecop.json
.gitignore = .gitignore
.releaserc.json = .releaserc.json
renovate.json = renovate.json
config\CommonTests.targets = config\CommonTests.targets
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Testing", "src\KubeOps.Testing\KubeOps.Testing.csproj", "{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}"
Expand Down
1 change: 0 additions & 1 deletion config/CodeAnalysis.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/project.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
34 changes: 0 additions & 34 deletions config/project.ruleset

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;

using k8s;
using k8s.Models;

Expand Down
1 change: 1 addition & 0 deletions src/KubeOps.KubernetesClient/Entities/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;

using k8s;
using k8s.Models;

Expand Down
1 change: 1 addition & 0 deletions src/KubeOps.KubernetesClient/IKubernetesClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using KubeOps.KubernetesClient.LabelSelectors;

namespace KubeOps.KubernetesClient;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps.KubernetesClient/KubernetesClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Net;

using k8s;
using k8s.Autorest;
using k8s.Models;

using KubeOps.KubernetesClient.Entities;
using KubeOps.KubernetesClient.LabelSelectors;

Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps.Testing/KubernetesOperatorFactory.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using k8s;
using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Controller;
using KubeOps.Operator.Kubernetes;
using KubeOps.Operator.Leadership;

using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps.Testing/MockEventQueue.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Reactive.Subjects;

using k8s;
using k8s.Models;

using KubeOps.Operator.Controller;

namespace KubeOps.Testing;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps.Testing/MockKubernetesClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Diagnostics.CodeAnalysis;

using k8s;
using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.KubernetesClient.LabelSelectors;

Expand Down
1 change: 1 addition & 0 deletions src/KubeOps.Testing/MockedLeaderElection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reactive.Subjects;

using KubeOps.Operator.Leadership;

namespace KubeOps.Testing;
Expand Down
3 changes: 3 additions & 0 deletions src/KubeOps/Operator/ApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Reflection;

using KubeOps.Operator.Builder;
using KubeOps.Operator.Webhooks;

using Microsoft.AspNetCore.Diagnostics.HealthChecks;

using Prometheus;

namespace KubeOps.Operator;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Builder/AssemblyScanner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Reflection;

using k8s;
using k8s.Models;

using KubeOps.Operator.Controller;
using KubeOps.Operator.Finalizer;
using KubeOps.Operator.Webhooks;
Expand Down
3 changes: 3 additions & 0 deletions src/KubeOps/Operator/Builder/ComponentRegistrar.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Collections.Immutable;

using k8s;
using k8s.Models;

using KubeOps.Operator.Controller;
using KubeOps.Operator.Finalizer;
using KubeOps.Operator.Webhooks;

using static KubeOps.Operator.Builder.IComponentRegistrar;

namespace KubeOps.Operator.Builder;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Builder/IComponentRegistrar.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Collections.Immutable;

using k8s;
using k8s.Models;

using KubeOps.Operator.Controller;
using KubeOps.Operator.Finalizer;
using KubeOps.Operator.Webhooks;
Expand Down
3 changes: 3 additions & 0 deletions src/KubeOps/Operator/Builder/IOperatorBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Reflection;

using k8s;
using k8s.Models;

using KubeOps.Operator.Controller;
using KubeOps.Operator.Finalizer;
using KubeOps.Operator.Webhooks;

using Microsoft.Extensions.Diagnostics.HealthChecks;

namespace KubeOps.Operator.Builder;
Expand Down
4 changes: 4 additions & 0 deletions src/KubeOps/Operator/Builder/OperatorBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Reflection;

using k8s;
using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Caching;
using KubeOps.Operator.Controller;
Expand All @@ -12,8 +14,10 @@
using KubeOps.Operator.Leadership;
using KubeOps.Operator.Rbac;
using KubeOps.Operator.Webhooks;

using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Diagnostics.HealthChecks;

using Prometheus;

namespace KubeOps.Operator.Builder;
Expand Down
3 changes: 3 additions & 0 deletions src/KubeOps/Operator/Caching/ResourceCache{TEntity}.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Collections.Concurrent;

using k8s;
using k8s.Models;

using KellermanSoftware.CompareNetObjects;

using KubeOps.Operator.DevOps;
using KubeOps.Operator.Entities.Extensions;

Expand Down
1 change: 1 addition & 0 deletions src/KubeOps/Operator/Commands/Generators/CrdGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using KubeOps.Operator.Entities;
using KubeOps.Operator.Entities.Kustomize;
using KubeOps.Operator.Serialization;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Generators/DockerGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Text;

using KubeOps.Operator.Builder;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using k8s.Models;

using KubeOps.Operator.Commands.CommandHelpers;
using KubeOps.Operator.Entities.Kustomize;
using KubeOps.Operator.Serialization;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Generators/OperatorGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using k8s.Models;

using KubeOps.Operator.Builder;
using KubeOps.Operator.Commands.CommandHelpers;
using KubeOps.Operator.Entities.Kustomize;
using KubeOps.Operator.Serialization;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
1 change: 1 addition & 0 deletions src/KubeOps/Operator/Commands/Generators/OutputBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using KubeOps.Operator.Serialization;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Generators/RbacGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using k8s.Models;

using KubeOps.Operator.Commands.CommandHelpers;
using KubeOps.Operator.Entities.Kustomize;
using KubeOps.Operator.Rbac;
using KubeOps.Operator.Serialization;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Generators;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Management/Install.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using k8s.Autorest;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Entities;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Management;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Management/Uninstall.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using k8s.Autorest;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Entities;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Management;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Commands/Management/Webhooks/Install.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.KubernetesClient.LabelSelectors;
using KubeOps.Operator.Commands.CommandHelpers;
using KubeOps.Operator.Entities.Extensions;
using KubeOps.Operator.Webhooks;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Management.Webhooks;
Expand Down
3 changes: 3 additions & 0 deletions src/KubeOps/Operator/Commands/Management/Webhooks/Register.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.Text;

using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Builder;
using KubeOps.Operator.Webhooks;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Management.Webhooks;
Expand Down
1 change: 1 addition & 0 deletions src/KubeOps/Operator/Commands/RunOperator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using KubeOps.KubernetesClient;
using KubeOps.Operator.Commands.Generators;
using KubeOps.Operator.Commands.Management;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands;
Expand Down
1 change: 1 addition & 0 deletions src/KubeOps/Operator/Commands/Utilities/Version.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using KubeOps.KubernetesClient;

using McMaster.Extensions.CommandLineUtils;

namespace KubeOps.Operator.Commands.Utilities;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using KubeOps.Operator.Builder;

namespace KubeOps.Operator.Controller;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/Controller/EventQueue.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Reactive.Linq;
using System.Reactive.Subjects;

using k8s;
using k8s.Models;

using KubeOps.KubernetesClient;
using KubeOps.Operator.Caching;
using KubeOps.Operator.Kubernetes;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using KubeOps.Operator.Builder;

namespace KubeOps.Operator.Controller;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using KubeOps.Operator.Controller.Results;
using KubeOps.Operator.Kubernetes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;

using k8s;
using k8s.Autorest;
using k8s.Models;

using KubeOps.Operator.Controller.Results;
using KubeOps.Operator.DevOps;
using KubeOps.Operator.Finalizer;
using KubeOps.Operator.Kubernetes;

using static KubeOps.Operator.Builder.IComponentRegistrar;

namespace KubeOps.Operator.Controller;
Expand Down
1 change: 1 addition & 0 deletions src/KubeOps/Operator/Controller/ResourceEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using KubeOps.Operator.Kubernetes;

namespace KubeOps.Operator.Controller;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using k8s;
using k8s.Models;

using Prometheus;

namespace KubeOps.Operator.DevOps;
Expand Down
2 changes: 2 additions & 0 deletions src/KubeOps/Operator/DevOps/ResourceCacheMetrics{TEntity}.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using k8s;
using k8s.Models;

using KubeOps.KubernetesClient.Entities;

using Prometheus;

namespace KubeOps.Operator.DevOps;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using k8s;
using k8s.Models;

using KubeOps.KubernetesClient.Entities;

using Prometheus;

namespace KubeOps.Operator.DevOps;
Expand Down
Loading

0 comments on commit 1602b1c

Please sign in to comment.