Skip to content

Commit

Permalink
SLVS-1477 Add more logs to new migration
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriela-trutan-sonarsource committed Oct 1, 2024
1 parent 62ca1e9 commit cff3956
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public async Task MigrateBindingToServerConnectionIfNeeded_ConnectionsStorageFil
serverConnectionsRepository.Received(1).ConnectionsFileExists();
serverConnectionsRepository.DidNotReceiveWithAnyArgs().TryAdd(default);
unintrusiveBindingPathProvider.DidNotReceive().GetBindingPaths();
logger.Received(1).WriteLine(MigrationStrings.ConnectionMigration_NoMigration);
}

[TestMethod]
Expand All @@ -118,6 +119,7 @@ public async Task MigrateBindingToServerConnectionIfNeeded_ConnectionsStorageDoe
unintrusiveBindingPathProvider.GetBindingPaths();
serverConnectionsRepository.TryAdd(Arg.Any<ServerConnection>());
serverConnectionsRepository.TryAdd(Arg.Any<ServerConnection>());
logger.WriteLine(MigrationStrings.ConnectionMigration_EndMigration);
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/ConnectedMode/Migration/BindingToConnectionMigration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private void MigrateBindingToServerConnectionIfNeeded()
{
if (serverConnectionsRepository.ConnectionsFileExists())
{
logger.WriteLine(MigrationStrings.ConnectionMigration_NoMigration);
return;
}

Expand All @@ -96,6 +97,7 @@ private void MigrateBindingToServerConnectionIfNeeded()
{
MigrateBindingToServerConnection(bindingPath);
}
logger.WriteLine(MigrationStrings.ConnectionMigration_EndMigration);
}

private void MigrateBindingToServerConnection(string bindingFilePath)
Expand Down
18 changes: 18 additions & 0 deletions src/ConnectedMode/Migration/MigrationStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/ConnectedMode/Migration/MigrationStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,10 @@
<data name="ConnectionsJson_DoesNotExist" xml:space="preserve">
<value>[Migration] Connections.json file does not exist. The new migration has to be performed first.</value>
</data>
<data name="ConnectionMigration_EndMigration" xml:space="preserve">
<value>[Connection Migration] End migrating connections from existing bindings</value>
</data>
<data name="ConnectionMigration_NoMigration" xml:space="preserve">
<value>[Connection Migration] Connections.json exists. Migrating connections from existing bindings was not performed</value>
</data>
</root>

0 comments on commit cff3956

Please sign in to comment.