From 8454faa84733f6a766a05f460596a6dae054a8df Mon Sep 17 00:00:00 2001 From: "huhouhuam@outlook.com" Date: Wed, 18 Oct 2023 00:23:30 +0800 Subject: [PATCH 1/2] add docker Integration package for unit test --- test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj b/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj index 44dc8d3..62f18ca 100644 --- a/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj +++ b/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj @@ -8,6 +8,7 @@ + From bed59a746b7986a383660f7ff2156a09c7ffc984 Mon Sep 17 00:00:00 2001 From: "huhouhuam@outlook.com" Date: Wed, 18 Oct 2023 01:06:53 +0800 Subject: [PATCH 2/2] add kubernetes Integration package for unit test --- .../ArgoCD.Client.Test.csproj | 7 +++- .../Utilities/ArgoCDContainerFixture.cs | 20 ---------- .../Utilities/ArgoCDKubernetesFixture.cs | 38 +++++++++++++++++++ test/ArgoCD.Client.Test/VersionClientTest.cs | 2 +- 4 files changed, 45 insertions(+), 22 deletions(-) delete mode 100644 test/ArgoCD.Client.Test/Utilities/ArgoCDContainerFixture.cs create mode 100644 test/ArgoCD.Client.Test/Utilities/ArgoCDKubernetesFixture.cs diff --git a/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj b/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj index 62f18ca..8759715 100644 --- a/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj +++ b/test/ArgoCD.Client.Test/ArgoCD.Client.Test.csproj @@ -8,7 +8,7 @@ - + @@ -29,4 +29,9 @@ PreserveNewest + + + 12.1.1 + + diff --git a/test/ArgoCD.Client.Test/Utilities/ArgoCDContainerFixture.cs b/test/ArgoCD.Client.Test/Utilities/ArgoCDContainerFixture.cs deleted file mode 100644 index 4a5f9c8..0000000 --- a/test/ArgoCD.Client.Test/Utilities/ArgoCDContainerFixture.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace ArgoCD.Client.Test.Utilities -{ - internal class ArgoCDContainerFixture : IAsyncLifetime - { - public Task DisposeAsync() - { - return Task.CompletedTask; - - } - public Task InitializeAsync() - { - return Task.CompletedTask; - } - } -} diff --git a/test/ArgoCD.Client.Test/Utilities/ArgoCDKubernetesFixture.cs b/test/ArgoCD.Client.Test/Utilities/ArgoCDKubernetesFixture.cs new file mode 100644 index 0000000..a193005 --- /dev/null +++ b/test/ArgoCD.Client.Test/Utilities/ArgoCDKubernetesFixture.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using k8s; + +namespace ArgoCD.Client.Test.Utilities +{ + internal class ArgoCDKubernetesFixture : IAsyncLifetime + { + public static string Token { get; private set; } + public static string ArgoCDHost { get; private set; } + private Kubernetes kubernetes; + + + public async Task InitializeAsync() + { + await StartKubernetesAsync(); + + } + + public Task DisposeAsync() + { + + kubernetes?.Dispose(); + return Task.CompletedTask; + + } + private async Task StartKubernetesAsync() + { + var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(Environment.GetEnvironmentVariable("KUBECONFIG")); + kubernetes = new Kubernetes(config); + + await Task.CompletedTask; + } + } +} diff --git a/test/ArgoCD.Client.Test/VersionClientTest.cs b/test/ArgoCD.Client.Test/VersionClientTest.cs index b844d01..db12a78 100644 --- a/test/ArgoCD.Client.Test/VersionClientTest.cs +++ b/test/ArgoCD.Client.Test/VersionClientTest.cs @@ -18,7 +18,7 @@ public class VersionClientTest //{ // var file = await _client.GetVersionAsync(). // ConfigureAwait(false); - //} + } }