Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
liam-mackie committed Feb 13, 2025
1 parent 1a28ce6 commit 5e079f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ public async Task MigrationFromPreinstallHook_ShouldNotRunWhenTentacleIsAlreadyR
var configMap = await client.CoreV1.ReadNamespacedConfigMapAsync(DestinationConfigMapName, commandNamespace);
var secret = await client.CoreV1.ReadNamespacedSecretAsync(DestinationSecretName, commandNamespace);

configMap.Data.TryGetValue("validationKey", out var validationKeyFromKubernetes);
validationKeyFromKubernetes.Should().Be(validationKey);
configMap.Data.TryGetValue("validationKey", out var validationKeyFromKubernetesConfigMap);
validationKeyFromKubernetesConfigMap.Should().Be(validationKey);

secret.Data.TryGetValue("machine-key", out var hostKeyFromKubernetes);
hostKeyFromKubernetes.Should().Equal(Encoding.UTF8.GetBytes(validationKey));
secret.Data.TryGetValue("validationKey", out var validationKeyFromKubernetesSecret);
validationKeyFromKubernetesSecret.Should().Equal(Encoding.UTF8.GetBytes(validationKey));
}

async Task CreateCommandNamespace(string name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using FluentAssertions;
using k8s.Models;
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using NUnit.Framework;
using Octopus.Tentacle.Commands;

Expand All @@ -16,12 +17,14 @@ public void ShouldNotMigrate_IfNoSource()
{
var targetConfigMap = Substitute.For<V1ConfigMap>();
var targetSecret = Substitute.For<V1Secret>();

MigratePreInstalledKubernetesDeploymentTargetCommand.ShouldMigrateData(null, null, targetConfigMap, targetSecret).Item1.Should().BeFalse();

var (shouldMigrate, reason) = MigratePreInstalledKubernetesDeploymentTargetCommand.ShouldMigrateData(null, null, targetConfigMap, targetSecret);
shouldMigrate.Should().BeFalse();
reason.Should().Be("Source config map or secret not found, skipping migration");
}

[Test]
public void ShouldNotMigrate_ifNoDestination()
public void ShouldNotMigrate_IfNoDestination()
{
var sourceConfigMap = Substitute.For<V1ConfigMap>();
var sourceSecret = Substitute.For<V1Secret>();
Expand All @@ -30,7 +33,7 @@ public void ShouldNotMigrate_ifNoDestination()
}

[Test]
public void ShouldNotMigrate_ifDestinationRegistered()
public void ShouldNotMigrate_IfDestinationRegistered()
{
var sourceConfigMap = Substitute.For<V1ConfigMap>();
var sourceSecret = Substitute.For<V1Secret>();
Expand Down

0 comments on commit 5e079f0

Please sign in to comment.