From e6b113018b22fbbfea04b4387ffbb69a3cd7ab18 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Wed, 20 Nov 2024 15:06:28 +0000 Subject: [PATCH 01/35] workaround 'dotnet clean' not supporting --use-current-runtime --- bin/smi/build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/smi/build.py b/bin/smi/build.py index d1571486b..20ffe039e 100755 --- a/bin/smi/build.py +++ b/bin/smi/build.py @@ -17,17 +17,20 @@ def main(argv: Optional[Sequence[str]] = None) -> int: parser = argparse.ArgumentParser() DC.add_args(parser) + # "clean" needs an argument due to + # https://github.com/dotnet/sdk/issues/27488 parser.add_argument( "--clean", - action="store_true", - help="Cleanup any existing files", + metavar="RID", + help="Cleanup any existing files. You must specify the RID", ) args = parser.parse_args(argv) - if args.clean: + if args.clean is not None: cmd = ( "dotnet", "clean", + "--runtime", args.clean, "--verbosity", "quiet", "--nologo", ) From 47a5a88ba1b1c5091c00a65315691c7896a85cbf Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Wed, 20 Nov 2024 15:12:36 +0000 Subject: [PATCH 02/35] add news file --- news/2013-bugfix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2013-bugfix.md diff --git a/news/2013-bugfix.md b/news/2013-bugfix.md new file mode 100644 index 000000000..ebff09a04 --- /dev/null +++ b/news/2013-bugfix.md @@ -0,0 +1 @@ +Require RID in dotnet clean script to workaround lack of `--use-current-runtime` From 9e89709f2ad240933d77288155f4d35b9426c1a0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:00:29 +0000 Subject: [PATCH 03/35] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/executablebooks/mdformat: 0.7.18 → 0.7.19](https://github.com/executablebooks/mdformat/compare/0.7.18...0.7.19) - [github.com/tcort/markdown-link-check: v3.12.2 → v3.13.6](https://github.com/tcort/markdown-link-check/compare/v3.12.2...v3.13.6) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7ce7e54b..85deb7bc6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,7 +60,7 @@ repos: )$ # Markdown - repo: https://github.com/executablebooks/mdformat - rev: 0.7.18 + rev: 0.7.19 hooks: - id: mdformat additional_dependencies: @@ -70,7 +70,7 @@ repos: .github/ISSUE_TEMPLATE/.*md| )$ - repo: https://github.com/tcort/markdown-link-check - rev: "v3.12.2" + rev: "v3.13.6" hooks: - id: markdown-link-check args: [--quiet, --config, .meta/markdown-link-check.json] From e200082cd060c7d4b4699ce62c8721ff24365cf9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:00:50 +0000 Subject: [PATCH 04/35] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGELOG.md | 20 ++++++++++---------- docs/services/cohort-extractor.md | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9463a7250..4457941ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -253,7 +253,7 @@ A raw git diff can be seen [here][unreleased]. - [#1450](https://github.com/SMI/SmiServices/pull/1450) by darshad-github. Update contributing.md with feature branch workflow guidelines - [#1451](https://github.com/SMI/SmiServices/pull/1451) by rkm. adopt dotnet central package management (CPM) - [#1468](https://github.com/SMI/SmiServices/pull/1468) by rkm. switch rabbitmq docker-compose images to include management plugin -- [#1494](https://github.com/SMI/SmiServices/pull/1494) by rkm. \[actions\] replace deprecated set-output with GITHUB_OUTPUT +- [#1494](https://github.com/SMI/SmiServices/pull/1494) by rkm. [actions] replace deprecated set-output with GITHUB_OUTPUT - [#1496](https://github.com/SMI/SmiServices/pull/1496) by rkm. add CodeQL scan ## [5.3.0] 2022-11-08 @@ -353,7 +353,7 @@ A raw git diff can be seen [here][unreleased]. ### Bugfix -- [#1087](https://github.com/SMI/SmiServices/pull/1087) by rkm. \[CI\] Misc. CI +- [#1087](https://github.com/SMI/SmiServices/pull/1087) by rkm. [CI] Misc. CI fixes - Fixes the build scripts to respect any intermediate non-zero return codes @@ -927,7 +927,7 @@ A raw git diff can be seen [here][unreleased]. ### Added -- \[breaking\] Add identifiable extraction support +- [breaking] Add identifiable extraction support - New service "FileCopier" which sits in place of CTP for identifiable extractions and copies source files to their output dirs - Changes to MongoDB extraction schema, but backwards compatibility has @@ -948,7 +948,7 @@ A raw git diff can be seen [here][unreleased]. ### Changed -- \[breaking\] Environment variables are no longer required. Previous settings +- [breaking] Environment variables are no longer required. Previous settings now appear in configuration file - Environment variable `SMI_LOGS_ROOT` is now `GlobalOptions.LogsRoot` - Environment variable `MONGO_SERVICE_PASSWORD` is now @@ -1050,7 +1050,7 @@ A raw git diff can be seen [here][unreleased]. - Records in the referenced table will blacklist where any UID is found (StudyInstanceUID, SeriesInstanceUID or SOPInstanceUID). This allows blacklisting an entire study or only specific images. - - \[breaking\] Config on live system may need updated + - [breaking] Config on live system may need updated - Change the extraction directory generation to be `/image-requests/`. Fixes [MVP Service #159](https://dev.azure.com/smiops/MVP%20Service/_workitems/edit/159/) @@ -1103,8 +1103,8 @@ A raw git diff can be seen [here][unreleased]. ### Changed -- \[Breaking\] Promote the PT modality to its own collection in MongoDB -- \[Breaking\] Renamed `RedisHost` to `RedisConnectionString` in the config +- [Breaking] Promote the PT modality to its own collection in MongoDB +- [Breaking] Renamed `RedisHost` to `RedisConnectionString` in the config options for clarity - Update to .Net Core 3.1 (supported until Dec 2022) since 2.2 support ended last year @@ -1190,12 +1190,12 @@ A raw git diff can be seen [here][unreleased]. ## [1.5.0] - 2020-03-05 -- \[Breaking\] Updated RabbitMQ extraction config to match extraction plan v2 +- [Breaking] Updated RabbitMQ extraction config to match extraction plan v2 - Refactor Java exception handling and use of threads -- `TessDirectory` option in \[IsIdentifiable\] now expects tesseract models file +- `TessDirectory` option in [IsIdentifiable] now expects tesseract models file to exist (no longer downloads it on demand) - Added support for outsourcing classification (e.g. NLP) to other processes - via TCP (entered in \[SocketRules\] in `Rules.yaml`) + via TCP (entered in [SocketRules] in `Rules.yaml`) - IsIdentifiable NLP text classification now outsourced via TCP to any services configured in - StanfordNER implementation written in Java diff --git a/docs/services/cohort-extractor.md b/docs/services/cohort-extractor.md index 3db446b6f..f3928b990 100644 --- a/docs/services/cohort-extractor.md +++ b/docs/services/cohort-extractor.md @@ -33,7 +33,7 @@ The set of images that **could** be extracted is controlled by the `IExtractionR The current recommended implementation is FromCataloguesExtractionRequestFulfiller. This fulfiller will look up one or more tables or multi table joins (Catalogues) and search for the provided extraction key (e.g. SeriesInstanceUID = x) -The matched records are what will be reported on e.g. "for x UIDs we found y available images". From this result set a subset will be rejected (because you have made row level decisions not to extract particular images). This is handled by the \[Rejector\] +The matched records are what will be reported on e.g. "for x UIDs we found y available images". From this result set a subset will be rejected (because you have made row level decisions not to extract particular images). This is handled by the [Rejector] Configure the fulfiller in your options yaml: From 70e9c7f16831cc3847286b1e3d8f07287b410f58 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 13:11:03 +0000 Subject: [PATCH 05/35] revert markdown-link-check upgrade, as release is broken --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85deb7bc6..4a4577e4b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,7 +70,7 @@ repos: .github/ISSUE_TEMPLATE/.*md| )$ - repo: https://github.com/tcort/markdown-link-check - rev: "v3.13.6" + rev: "v3.12.2" hooks: - id: markdown-link-check args: [--quiet, --config, .meta/markdown-link-check.json] From 5147f5b2424a01df09a8288d077cfdec63bfb5d9 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 13:56:06 +0000 Subject: [PATCH 06/35] Revert "workaround 'dotnet clean' not supporting --use-current-runtime" This reverts commit e6b113018b22fbbfea04b4387ffbb69a3cd7ab18. --- bin/smi/build.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bin/smi/build.py b/bin/smi/build.py index 20ffe039e..d1571486b 100755 --- a/bin/smi/build.py +++ b/bin/smi/build.py @@ -17,20 +17,17 @@ def main(argv: Optional[Sequence[str]] = None) -> int: parser = argparse.ArgumentParser() DC.add_args(parser) - # "clean" needs an argument due to - # https://github.com/dotnet/sdk/issues/27488 parser.add_argument( "--clean", - metavar="RID", - help="Cleanup any existing files. You must specify the RID", + action="store_true", + help="Cleanup any existing files", ) args = parser.parse_args(argv) - if args.clean is not None: + if args.clean: cmd = ( "dotnet", "clean", - "--runtime", args.clean, "--verbosity", "quiet", "--nologo", ) From df64753f57e6e795f52c06f9231e3dd3fc716561 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 16:58:05 +0000 Subject: [PATCH 07/35] use msbuild property where --use-current-runtime not available This is effectively what --ucr does anyway: https://github.com/dotnet/sdk/blob/f65053d80604949ed62c663e3e6975bc75273ba6/src/Cli/dotnet/CommonOptions.cs#L79-L83 --- bin/smi/build.py | 1 + bin/smi/test.py | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/smi/build.py b/bin/smi/build.py index d1571486b..a67d634b1 100755 --- a/bin/smi/build.py +++ b/bin/smi/build.py @@ -28,6 +28,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int: cmd = ( "dotnet", "clean", + "-p:UseCurrentRuntimeIdentifier=True", "--verbosity", "quiet", "--nologo", ) diff --git a/bin/smi/test.py b/bin/smi/test.py index a7596af89..732889e57 100755 --- a/bin/smi/test.py +++ b/bin/smi/test.py @@ -86,6 +86,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int: "--settings", "coverage.settings", "--", "dotnet", "test", + "-p:UseCurrentRuntimeIdentifier=True", "-warnaserror", "--configuration", args.configuration, "--no-build" if args.no_build else "", From 023e59226ed780031b3b59d696b5949372191314 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 17:00:15 +0000 Subject: [PATCH 08/35] add news file --- news/2015-meta.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2015-meta.md diff --git a/news/2015-meta.md b/news/2015-meta.md new file mode 100644 index 000000000..7694d617f --- /dev/null +++ b/news/2015-meta.md @@ -0,0 +1 @@ +Fix runtime selection in helper scripts From 4eca2fc5ef9b2c048b44b0fb7b09b785edb6bd58 Mon Sep 17 00:00:00 2001 From: James A Sutherland Date: Thu, 21 Nov 2024 12:04:34 -0600 Subject: [PATCH 09/35] Feature/requirescache (#2014) * Evaluate service availability once rather than per test * Remove redundant RequiresExternalService annotation * Backport to v6 RabbitMQ client for now * Single connection operation * Update ControlMessageConsumer.cs Fixup stray factory reference * Update GlobalOptions.cs YamlIgnore * Update GlobalOptions.cs Adjust connection syntax * Adjust options decoration logic to ignore non-yaml properties * Check Rabbit exchange each time a unit test uses Rabbit --------- Co-authored-by: James A Sutherland <> --- .../Messaging/ControlMessageConsumer.cs | 24 +++----- .../Common/Messaging/RabbitMQBroker.cs | 10 +--- .../Options/EnvironmentVariableDecorator.cs | 4 +- .../Common/Options/GlobalOptions.cs | 28 +++++++-- .../Common/Options/GlobalOptionsFactory.cs | 10 ++-- .../Common/Options/OptionsDecorator.cs | 9 ++- .../DicomLoader/DicomLoaderTests.cs | 1 - .../MapperSourceIntegrationTest.cs | 2 +- .../Common/GlobalOptionsExtensions.cs | 9 +-- .../Common/Messaging/RabbitMQBrokerTests.cs | 37 ++---------- .../MicroservicesIntegrationTest.cs | 2 +- .../RequiresExternalService.cs | 40 +++++++++---- .../RequiresMongoDb.cs | 22 +++---- .../RequiresRabbit.cs | 57 +++++++------------ .../RequiresRelationalDb.cs | 14 ++--- .../DicomTagReaderTestHelper.cs | 9 +-- 16 files changed, 118 insertions(+), 160 deletions(-) diff --git a/src/SmiServices/Common/Messaging/ControlMessageConsumer.cs b/src/SmiServices/Common/Messaging/ControlMessageConsumer.cs index 176d24f10..90fb6b1c8 100644 --- a/src/SmiServices/Common/Messaging/ControlMessageConsumer.cs +++ b/src/SmiServices/Common/Messaging/ControlMessageConsumer.cs @@ -27,8 +27,7 @@ public class ControlMessageConsumer : Consumer private readonly string _processName; private readonly string _processId; - - private readonly IConnectionFactory _factory; + private readonly IConnection _connection; private const string ControlQueueBindingKey = "smi.control.all.*"; @@ -41,24 +40,17 @@ public ControlMessageConsumer( Action stopEvent) { ArgumentNullException.ThrowIfNull(processName); + ArgumentNullException.ThrowIfNull(controlExchangeName); + ArgumentNullException.ThrowIfNull(stopEvent); + + _connection = rabbitOptions.Connection; _processName = processName.ToLower(); _processId = processId.ToString(); ControlConsumerOptions.QueueName = $"Control.{_processName}{_processId}"; - _factory = new ConnectionFactory() - { - HostName = rabbitOptions.RabbitMqHostName, - VirtualHost = rabbitOptions.RabbitMqVirtualHost, - Port = rabbitOptions.RabbitMqHostPort, - UserName = rabbitOptions.RabbitMqUserName, - Password = rabbitOptions.RabbitMqPassword - }; - - ArgumentNullException.ThrowIfNull(controlExchangeName); SetupControlQueueForHost(controlExchangeName); - ArgumentNullException.ThrowIfNull(stopEvent); StopHost += () => stopEvent("Control message stop"); } @@ -150,8 +142,7 @@ public override void ProcessMessage(BasicDeliverEventArgs e) /// public override void Shutdown() { - using IConnection connection = _factory.CreateConnection(_processName + _processId + "-ControlQueueShutdown"); - using IModel model = connection.CreateModel(); + using var model = _connection.CreateModel(); Logger.Debug($"Deleting control queue: {ControlConsumerOptions.QueueName}"); model.QueueDelete(ControlConsumerOptions.QueueName); } @@ -169,8 +160,7 @@ public override void Shutdown() /// private void SetupControlQueueForHost(string controlExchangeName) { - using IConnection connection = _factory.CreateConnection($"{_processName}{_processId}-ControlQueueSetup"); - using IModel model = connection.CreateModel(); + using var model = _connection.CreateModel(); try { model.ExchangeDeclarePassive(controlExchangeName); diff --git a/src/SmiServices/Common/Messaging/RabbitMQBroker.cs b/src/SmiServices/Common/Messaging/RabbitMQBroker.cs index 3fb9ef200..447d3a9a7 100644 --- a/src/SmiServices/Common/Messaging/RabbitMQBroker.cs +++ b/src/SmiServices/Common/Messaging/RabbitMQBroker.cs @@ -73,15 +73,7 @@ public RabbitMQBroker(RabbitOptions rabbitOptions, string hostId, HostFatalHandl if (string.IsNullOrWhiteSpace(hostId)) throw new ArgumentException("RabbitMQ host ID required", nameof(hostId)); - var connectionFactory = new ConnectionFactory() - { - HostName = rabbitOptions.RabbitMqHostName, - VirtualHost = rabbitOptions.RabbitMqVirtualHost, - Port = rabbitOptions.RabbitMqHostPort, - UserName = rabbitOptions.RabbitMqUserName, - Password = rabbitOptions.RabbitMqPassword - }; - _connection = connectionFactory.CreateConnection(hostId); + _connection = rabbitOptions.Connection; _connection.ConnectionBlocked += (s, a) => _logger.Warn($"ConnectionBlocked (Reason: {a.Reason})"); _connection.ConnectionUnblocked += (s, a) => _logger.Warn("ConnectionUnblocked"); diff --git a/src/SmiServices/Common/Options/EnvironmentVariableDecorator.cs b/src/SmiServices/Common/Options/EnvironmentVariableDecorator.cs index 6a090711b..9c12eda7c 100644 --- a/src/SmiServices/Common/Options/EnvironmentVariableDecorator.cs +++ b/src/SmiServices/Common/Options/EnvironmentVariableDecorator.cs @@ -13,10 +13,10 @@ public override GlobalOptions Decorate(GlobalOptions options) return options; } - private MongoDbOptions SetMongoPassword(MongoDbOptions opt) + private static MongoDbOptions SetMongoPassword(MongoDbOptions opt) { //get the environment variables current value - string? envVar = Environment.GetEnvironmentVariable("MONGO_SERVICE_PASSWORD"); + var envVar = Environment.GetEnvironmentVariable("MONGO_SERVICE_PASSWORD"); //if there's an env var for it and there are mongodb options being used if (!string.IsNullOrWhiteSpace(envVar)) diff --git a/src/SmiServices/Common/Options/GlobalOptions.cs b/src/SmiServices/Common/Options/GlobalOptions.cs index 49a227d5b..889417adc 100644 --- a/src/SmiServices/Common/Options/GlobalOptions.cs +++ b/src/SmiServices/Common/Options/GlobalOptions.cs @@ -13,8 +13,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Text; +using RabbitMQ.Client; +using YamlDotNet.Serialization; using DatabaseType = FAnsi.DatabaseType; namespace SmiServices.Common.Options @@ -78,10 +79,10 @@ public static string GenerateToString(object o) { var sb = new StringBuilder(); - foreach (PropertyInfo prop in o.GetType().GetProperties()) + foreach (var prop in o.GetType().GetProperties().Where(static prop => + !prop.Name.Contains("password", StringComparison.OrdinalIgnoreCase))) { - if (!prop.Name.Contains("password", StringComparison.CurrentCultureIgnoreCase)) - sb.Append(string.Format("{0}: {1}, ", prop.Name, prop.GetValue(o))); + sb.Append($"{prop.Name}: {prop.GetValue(o)}, "); } return sb.ToString(); @@ -620,6 +621,25 @@ public override string ToString() /// public class RabbitOptions : IOptions { + private IConnection CreateConnection() => + new ConnectionFactory + { + HostName = RabbitMqHostName, + Port = RabbitMqHostPort, + VirtualHost = RabbitMqVirtualHost, + UserName = RabbitMqUserName, + Password = RabbitMqPassword + }.CreateConnection(); + + private readonly Lazy _connectionCache; + + public RabbitOptions() + { + _connectionCache = new Lazy(CreateConnection); + } + + [YamlIgnore] + public IConnection Connection => _connectionCache.Value; public string RabbitMqHostName { get; set; } = "localhost"; public int RabbitMqHostPort { get; set; } = 5672; public string? RabbitMqVirtualHost { get; set; } = "/"; diff --git a/src/SmiServices/Common/Options/GlobalOptionsFactory.cs b/src/SmiServices/Common/Options/GlobalOptionsFactory.cs index bae5ecccd..431bf517f 100644 --- a/src/SmiServices/Common/Options/GlobalOptionsFactory.cs +++ b/src/SmiServices/Common/Options/GlobalOptionsFactory.cs @@ -35,17 +35,17 @@ public GlobalOptions Load(string hostProcessName, string configFilePath = "defau { fileSystem ??= new FileSystem(); - IDeserializer deserializer = new DeserializerBuilder() - .WithObjectFactory(GetGlobalOption) - .IgnoreUnmatchedProperties() - .Build(); + var deserializer = new DeserializerBuilder() + .WithObjectFactory(GetGlobalOption) + .IgnoreUnmatchedProperties() + .Build(); if (!fileSystem.File.Exists(configFilePath)) throw new ArgumentException($"Could not find config file '{configFilePath}'"); var yamlContents = fileSystem.File.ReadAllText(configFilePath); var globals = deserializer.Deserialize(yamlContents) - ?? throw new Exception("Did not deserialize a GlobalOptions object from the provided YAML file. Does it contain at least one valid key?"); + ?? throw new Exception("Did not deserialize a GlobalOptions object from the provided YAML file. Does it contain at least one valid key?"); globals.HostProcessName = hostProcessName; diff --git a/src/SmiServices/Common/Options/OptionsDecorator.cs b/src/SmiServices/Common/Options/OptionsDecorator.cs index 9a2b1456c..cafb62f83 100644 --- a/src/SmiServices/Common/Options/OptionsDecorator.cs +++ b/src/SmiServices/Common/Options/OptionsDecorator.cs @@ -1,5 +1,6 @@ using System; using System.Reflection; +using YamlDotNet.Serialization; namespace SmiServices.Common.Options { @@ -7,11 +8,13 @@ public abstract class OptionsDecorator : IOptionsDecorator { public abstract GlobalOptions Decorate(GlobalOptions options); - protected void ForAll(IOptions globals, Func setter) where T : IOptions + protected static void ForAll(IOptions globals, Func setter) where T : IOptions { //for each property on branch - foreach (PropertyInfo p in globals.GetType().GetProperties()) + foreach (var p in globals.GetType().GetProperties()) { + if (p.GetCustomAttribute(typeof(YamlIgnoreAttribute)) is not null) continue; + var currentValue = p.GetValue(globals)!; //if it's a T then call the action (note that we check the property Type because we are interested in the property even if it is null @@ -24,7 +27,7 @@ protected void ForAll(IOptions globals, Func setter) where T : IOptions p.SetValue(globals, result); } - //process it's children + //process its children if (currentValue is IOptions subOptions) { ForAll(subOptions, setter); diff --git a/tests/SmiServices.IntegrationTests/Applications/DicomLoader/DicomLoaderTests.cs b/tests/SmiServices.IntegrationTests/Applications/DicomLoader/DicomLoaderTests.cs index 1ce771895..5379d1739 100644 --- a/tests/SmiServices.IntegrationTests/Applications/DicomLoader/DicomLoaderTests.cs +++ b/tests/SmiServices.IntegrationTests/Applications/DicomLoader/DicomLoaderTests.cs @@ -47,7 +47,6 @@ public void Setup() } [Test] - [RequiresExternalService] public void BatchLoadTest() { DicomDataset[] testImages; diff --git a/tests/SmiServices.IntegrationTests/Applications/TriggerUpdates/MapperSourceIntegrationTest.cs b/tests/SmiServices.IntegrationTests/Applications/TriggerUpdates/MapperSourceIntegrationTest.cs index 603b6bc9a..41aec09ac 100644 --- a/tests/SmiServices.IntegrationTests/Applications/TriggerUpdates/MapperSourceIntegrationTest.cs +++ b/tests/SmiServices.IntegrationTests/Applications/TriggerUpdates/MapperSourceIntegrationTest.cs @@ -126,7 +126,7 @@ public void MapperSource_IntegrationTest(DatabaseType dbType) }; globals.UseTestValues( - RequiresRabbit.GetConnectionFactory(), + RequiresRabbit.Connection.Value, RequiresMongoDb.GetMongoClientSettings(), RequiresRelationalDb.GetRelationalDatabaseConnectionStrings(), ((TableRepository)RepositoryLocator.CatalogueRepository).ConnectionStringBuilder, diff --git a/tests/SmiServices.IntegrationTests/Common/GlobalOptionsExtensions.cs b/tests/SmiServices.IntegrationTests/Common/GlobalOptionsExtensions.cs index 1811a0a96..d53a3ec93 100644 --- a/tests/SmiServices.IntegrationTests/Common/GlobalOptionsExtensions.cs +++ b/tests/SmiServices.IntegrationTests/Common/GlobalOptionsExtensions.cs @@ -20,7 +20,7 @@ public static class GlobalOptionsExtensions /// Connection string to RDMP data export database e.g. TEST_DataExport public static void UseTestValues( this GlobalOptions g, - ConnectionFactory? rabbit, + IConnection? rabbit, MongoClientSettings? mongo, RequiresRelationalDb.ConStrs? relational, DbConnectionStringBuilder? catalogueConnectionString, @@ -28,11 +28,8 @@ public static void UseTestValues( ) { //Rabbit - g.RabbitOptions!.RabbitMqHostName = rabbit?.HostName!; - g.RabbitOptions.RabbitMqHostPort = rabbit?.Port ?? -1; - g.RabbitOptions.RabbitMqVirtualHost = rabbit?.VirtualHost; - g.RabbitOptions.RabbitMqUserName = rabbit?.UserName; - g.RabbitOptions.RabbitMqPassword = rabbit?.Password; + g.RabbitOptions!.RabbitMqHostName = rabbit?.Endpoint.HostName!; + g.RabbitOptions.RabbitMqHostPort = rabbit?.Endpoint.Port ?? -1; //RDMP g.RDMPOptions!.CatalogueConnectionString = catalogueConnectionString?.ConnectionString; diff --git a/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs b/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs index 5b3cf2e92..435e6a2bb 100644 --- a/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs +++ b/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs @@ -14,6 +14,7 @@ using System.Text; using System.Threading; using System.Threading.Channels; +using NUnit.Framework.Internal; namespace SmiServices.IntegrationTests.Common.Messaging { @@ -135,16 +136,7 @@ public void TestStopConsumer() [Test] public void TestGetRabbitServerVersion() { - var testFactory = new ConnectionFactory - { - HostName = _testOptions.RabbitOptions!.RabbitMqHostName, - VirtualHost = _testOptions.RabbitOptions.RabbitMqVirtualHost, - Port = _testOptions.RabbitOptions.RabbitMqHostPort, - UserName = _testOptions.RabbitOptions.RabbitMqUserName, - Password = _testOptions.RabbitOptions.RabbitMqPassword - }; - - using var connection = testFactory.CreateConnection(); + var connection = _testOptions.RabbitOptions?.Connection ?? throw new NUnitException(); // These are all the server properties we can check using the connection PrintObjectDictionary(connection.ServerProperties); @@ -165,34 +157,13 @@ public void TestMultipleConfirmsOk() [Test] public void TestMultipleCloseOk() { - var fact = new ConnectionFactory - { - HostName = _testOptions.RabbitOptions!.RabbitMqHostName, - VirtualHost = _testOptions.RabbitOptions.RabbitMqVirtualHost, - Port = _testOptions.RabbitOptions.RabbitMqHostPort, - UserName = _testOptions.RabbitOptions.RabbitMqUserName, - Password = _testOptions.RabbitOptions.RabbitMqPassword - }; - - var conn = fact.CreateConnection("TestConn"); - var model = conn.CreateModel(); + var model = _testOptions.RabbitOptions?.Connection.CreateModel() ?? throw new NUnitException(); // Closing model twice is ok model.Close(200, "bye"); model.Close(200, "bye"); - // Closing connection twice is NOT ok - conn.Close(200, "bye"); - Assert.Throws(() => conn.Close(200, "bye")); - - // Closing model after connection is ok - model.Close(200, "bye bye"); - - Assert.Multiple(() => - { - Assert.That(model.IsOpen, Is.False); - Assert.That(conn.IsOpen, Is.False); - }); + Assert.That(model.IsOpen, Is.False); } [Test] diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs index f30a0442a..8d44a1897 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs @@ -60,7 +60,7 @@ private void SetupSuite(DiscoveredDatabase server, bool persistentRaw = false, s _globals = new GlobalOptionsFactory().Load(nameof(MicroservicesIntegrationTest)); _globals.UseTestValues( - RequiresRabbit.GetConnectionFactory(), + RequiresRabbit.Connection.Value, RequiresMongoDb.GetMongoClientSettings(), RequiresRelationalDb.GetRelationalDatabaseConnectionStrings(), ((TableRepository)RepositoryLocator.CatalogueRepository).ConnectionStringBuilder, diff --git a/tests/SmiServices.IntegrationTests/RequiresExternalService.cs b/tests/SmiServices.IntegrationTests/RequiresExternalService.cs index 288e6aa6e..e930d4db0 100644 --- a/tests/SmiServices.IntegrationTests/RequiresExternalService.cs +++ b/tests/SmiServices.IntegrationTests/RequiresExternalService.cs @@ -6,32 +6,50 @@ namespace SmiServices.IntegrationTests { - public class RequiresExternalService : CategoryAttribute, IApplyToContext + public abstract class RequiresExternalService : CategoryAttribute, IApplyToContext { - protected readonly bool FailIfUnavailable; - private readonly bool IgnoreIfWinCiSkip; + private static readonly bool _failIfUnavailable; + private static readonly bool _ignoreIfWinCiSkip; + private static bool _cached = false; + private static string? _cache = null; - public RequiresExternalService() + static RequiresExternalService() { - string? ci = Environment.GetEnvironmentVariable("CI"); - if (!string.IsNullOrWhiteSpace(ci) && (ci == "1" || ci.Equals("TRUE", StringComparison.CurrentCultureIgnoreCase))) - FailIfUnavailable = true; + var ci = Environment.GetEnvironmentVariable("CI"); + if (!string.IsNullOrWhiteSpace(ci) && (ci == "1" || ci.Equals("TRUE", StringComparison.OrdinalIgnoreCase))) + _failIfUnavailable = true; if ( Environment.GetEnvironmentVariable("CI_SKIP_WIN_SERVICES") == "1" && RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) ) - IgnoreIfWinCiSkip = true; + _ignoreIfWinCiSkip = true; } public void ApplyToContext(TestExecutionContext context) { - if (IgnoreIfWinCiSkip) + if (_ignoreIfWinCiSkip) Assert.Ignore("CI_SKIP_WIN_SERVICES"); - ApplyToContextImpl(context); + if (!_cached) + { + _cached = true; + _cache = ApplyToContextImpl(); + } + + if (_cache is null) + { + if (this is RequiresRabbit r) + r.CheckExchange(); + return; + } + + if (_failIfUnavailable) + Assert.Fail(_cache); + else + Assert.Ignore(_cache); } - protected virtual void ApplyToContextImpl(TestExecutionContext context) { } + protected abstract string? ApplyToContextImpl(); } } diff --git a/tests/SmiServices.IntegrationTests/RequiresMongoDb.cs b/tests/SmiServices.IntegrationTests/RequiresMongoDb.cs index 037c6d64a..41170c8bd 100644 --- a/tests/SmiServices.IntegrationTests/RequiresMongoDb.cs +++ b/tests/SmiServices.IntegrationTests/RequiresMongoDb.cs @@ -2,7 +2,6 @@ using MongoDB.Bson; using MongoDB.Driver; using NUnit.Framework; -using NUnit.Framework.Internal; using System; using System.IO; using YamlDotNet.Serialization; @@ -12,9 +11,9 @@ namespace SmiServices.IntegrationTests [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Assembly, AllowMultiple = true)] public class RequiresMongoDb : RequiresExternalService { - protected override void ApplyToContextImpl(TestExecutionContext context) + protected override string? ApplyToContextImpl() { - MongoClientSettings address = GetMongoClientSettings(); + var address = GetMongoClientSettings(); Console.WriteLine("Checking the following configuration:" + Environment.NewLine + address); @@ -26,23 +25,18 @@ protected override void ApplyToContextImpl(TestExecutionContext context) } catch (Exception e) { - string msg = + return e is MongoNotPrimaryException - ? "Connected to non-primary MongoDB server. Check replication is enabled" - : $"Could not connect to MongoDB at {address}"; - - msg += $": {e}"; - - if (FailIfUnavailable) - Assert.Fail(msg); - else - Assert.Ignore(msg); + ? "Connected to non-primary MongoDB server. Check replication is enabled" + : $"Could not connect to MongoDB at {address}: {e}"; } + + return null; } public static MongoClientSettings GetMongoClientSettings() { - IDeserializer deserializer = new DeserializerBuilder() + var deserializer = new DeserializerBuilder() .IgnoreUnmatchedProperties() .Build(); diff --git a/tests/SmiServices.IntegrationTests/RequiresRabbit.cs b/tests/SmiServices.IntegrationTests/RequiresRabbit.cs index 7aae294be..586ec526c 100644 --- a/tests/SmiServices.IntegrationTests/RequiresRabbit.cs +++ b/tests/SmiServices.IntegrationTests/RequiresRabbit.cs @@ -1,6 +1,5 @@ using NUnit.Framework; -using NUnit.Framework.Internal; using RabbitMQ.Client; using RabbitMQ.Client.Exceptions; using System; @@ -12,54 +11,42 @@ namespace SmiServices.IntegrationTests { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Assembly, AllowMultiple = true)] - public class RequiresRabbit : RequiresExternalService + public sealed class RequiresRabbit : RequiresExternalService { - protected override void ApplyToContextImpl(TestExecutionContext context) - { - - var factory = GetConnectionFactory(); - factory.ContinuationTimeout = TimeSpan.FromSeconds(5); - factory.HandshakeContinuationTimeout = TimeSpan.FromSeconds(5); - factory.RequestedConnectionTimeout = TimeSpan.FromSeconds(5); - factory.SocketReadTimeout = TimeSpan.FromSeconds(5); - factory.SocketWriteTimeout = TimeSpan.FromSeconds(5); + public static readonly Lazy Connection = new(GetConnectionFactory); + protected override string? ApplyToContextImpl() + { try { - using var conn = factory.CreateConnection(); - using var model = conn.CreateModel(); - model.ExchangeDeclare("TEST.ControlExchange", ExchangeType.Topic, durable: true); + CheckExchange(); + return null; } catch (BrokerUnreachableException e) { - StringBuilder sb = new(); - - sb.AppendLine($"Uri: {factory.Uri}"); - sb.AppendLine($"Host: {factory.HostName}"); - sb.AppendLine($"VirtualHost: {factory.VirtualHost}"); - sb.AppendLine($"UserName: {factory.UserName}"); - sb.AppendLine($"Port: {factory.Port}"); - - string msg = $"Could not connect to RabbitMQ {Environment.NewLine}{sb}{Environment.NewLine}{e.Message}"; - - // NOTE(rkm 2021-01-30) Don't fail for Windows CI builds - bool shouldFail = FailIfUnavailable && !Environment.OSVersion.ToString().Contains("windows", StringComparison.CurrentCultureIgnoreCase); - - if (shouldFail) - Assert.Fail(msg); - else - Assert.Ignore(msg); + return $"Could not connect to RabbitMQ{Environment.NewLine}{e.Message}"; } } - public static ConnectionFactory GetConnectionFactory() + private static IConnection GetConnectionFactory() { - IDeserializer deserializer = new DeserializerBuilder() + var deserializer = new DeserializerBuilder() .IgnoreUnmatchedProperties() .Build(); - - return deserializer.Deserialize(new StreamReader(Path.Combine(TestContext.CurrentContext.TestDirectory, "Rabbit.yaml"))); + var factory = deserializer.Deserialize( + new StreamReader(Path.Combine(TestContext.CurrentContext.TestDirectory, "Rabbit.yaml"))); + factory.ContinuationTimeout = TimeSpan.FromSeconds(5); + factory.HandshakeContinuationTimeout = TimeSpan.FromSeconds(5); + factory.RequestedConnectionTimeout = TimeSpan.FromSeconds(5); + factory.SocketReadTimeout = TimeSpan.FromSeconds(5); + factory.SocketWriteTimeout = TimeSpan.FromSeconds(5); + return factory.CreateConnection(); } + public void CheckExchange() + { + using var model = Connection.Value.CreateModel(); + model.ExchangeDeclare("TEST.ControlExchange", ExchangeType.Topic, durable: true); + } } } diff --git a/tests/SmiServices.IntegrationTests/RequiresRelationalDb.cs b/tests/SmiServices.IntegrationTests/RequiresRelationalDb.cs index b2f5d39fc..d48da9f03 100644 --- a/tests/SmiServices.IntegrationTests/RequiresRelationalDb.cs +++ b/tests/SmiServices.IntegrationTests/RequiresRelationalDb.cs @@ -1,7 +1,6 @@ using FAnsi; using FAnsi.Discovery; using NUnit.Framework; -using NUnit.Framework.Internal; using SmiServices.Common; using System; using System.IO; @@ -21,21 +20,16 @@ public RequiresRelationalDb(DatabaseType type) _type = type; } - protected override void ApplyToContextImpl(TestExecutionContext context) + protected override string? ApplyToContextImpl() { FansiImplementations.Load(); var connectionStrings = GetRelationalDatabaseConnectionStrings(); var server = connectionStrings.GetServer(_type); - if (server.Exists()) - return; - - string msg = $"Could not connect to {_type} at '{server.Name}' with the provided connection options"; - if (FailIfUnavailable) - Assert.Fail(msg); - else - Assert.Ignore(msg); + return server.Exists() + ? null + : $"Could not connect to {_type} at '{server.Name}' with the provided connection options"; } public static ConStrs GetRelationalDatabaseConnectionStrings() diff --git a/tests/SmiServices.UnitTests/Microservices/DicomTagReader/DicomTagReaderTestHelper.cs b/tests/SmiServices.UnitTests/Microservices/DicomTagReader/DicomTagReaderTestHelper.cs index 4b4fed64a..ee92ac08d 100644 --- a/tests/SmiServices.UnitTests/Microservices/DicomTagReader/DicomTagReaderTestHelper.cs +++ b/tests/SmiServices.UnitTests/Microservices/DicomTagReader/DicomTagReaderTestHelper.cs @@ -57,14 +57,7 @@ public void SetUpSuite() tester.CreateExchange(Options.RabbitOptions!.FatalLoggingExchange!, null); tester.Shutdown(); - _testConnection = new ConnectionFactory - { - HostName = Options.RabbitOptions.RabbitMqHostName, - Port = Options.RabbitOptions.RabbitMqHostPort, - VirtualHost = Options.RabbitOptions.RabbitMqVirtualHost, - UserName = Options.RabbitOptions.RabbitMqUserName, - Password = Options.RabbitOptions.RabbitMqPassword - }.CreateConnection("TestConnection"); + _testConnection = Options.RabbitOptions.Connection; _testModel = _testConnection.CreateModel(); From 5fd1d8b19e423249460ce5686203284962221f18 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 13:18:12 +0000 Subject: [PATCH 10/35] bump SDK to 9.0.100 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 30caf8e16..c049535ab 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.300", + "version": "9.0.100", "rollForward": "minor" } } From b68a77f09a44993c9caf3d6d4290cc9c80df3f1c Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 18:35:35 +0000 Subject: [PATCH 11/35] add news file --- news/2018-feature.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2018-feature.md diff --git a/news/2018-feature.md b/news/2018-feature.md new file mode 100644 index 000000000..fa7d94529 --- /dev/null +++ b/news/2018-feature.md @@ -0,0 +1 @@ +Bump .NET SDK to 9.0.100 From 2bc61e0d80b9b64f08516da3774fc8c5152104e4 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Thu, 21 Nov 2024 18:44:35 +0000 Subject: [PATCH 12/35] ensure SDK installed for CodeQL --- .github/workflows/codeql.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d0c2e17d7..c63dd2a72 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,6 +32,10 @@ jobs: - name: Build Python if: ${{ matrix.language == 'python' }} uses: github/codeql-action/autobuild@v3 + - name: setup .NET + if: ${{ matrix.language == 'csharp' }} + # NOTE(rkm 2022-02-20) Uses global.json + uses: actions/setup-dotnet@v4.1.0 - name: Build .Net if: ${{ matrix.language == 'csharp' }} run: ./bin/smi/build.py -c Release From db9d95f7d6d91b047175b1ff2d00f5a505b1ba49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:42:39 +0000 Subject: [PATCH 13/35] Bump Microsoft.CodeCoverage and Microsoft.NET.Test.Sdk Bumps [Microsoft.CodeCoverage](https://github.com/microsoft/vstest) and [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest). These dependencies needed to be updated together. Updates `Microsoft.CodeCoverage` from 17.12.0 to 17.12.0 - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.12.0...v17.12.0) Updates `Microsoft.NET.Test.Sdk` from 17.11.1 to 17.12.0 - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.11.1...v17.12.0) --- updated-dependencies: - dependency-name: Microsoft.CodeCoverage dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- .../packages.lock.json | 22 +++++++++---------- .../SmiServices.UnitTests/packages.lock.json | 20 ++++++++--------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c88a0bf65..ceea54f3c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -35,7 +35,7 @@ - + diff --git a/tests/SmiServices.IntegrationTests/packages.lock.json b/tests/SmiServices.IntegrationTests/packages.lock.json index 616ed3a42..909e05624 100644 --- a/tests/SmiServices.IntegrationTests/packages.lock.json +++ b/tests/SmiServices.IntegrationTests/packages.lock.json @@ -34,12 +34,12 @@ }, "Microsoft.NET.Test.Sdk": { "type": "Direct", - "requested": "[17.11.1, )", - "resolved": "17.11.1", - "contentHash": "U3Ty4BaGoEu+T2bwSko9tWqWUOU16WzSFkq6U8zve75oRBMSLTBdMAZrVNNz1Tq12aCdDom9fcOcM9QZaFHqFg==", + "requested": "[17.12.0, )", + "resolved": "17.12.0", + "contentHash": "kt/PKBZ91rFCWxVIJZSgVLk+YR+4KxTuHf799ho8WNiK5ZQpJNAEZCAWX86vcKrs+DiYjiibpYKdGZP6+/N17w==", "dependencies": { - "Microsoft.CodeCoverage": "17.11.1", - "Microsoft.TestPlatform.TestHost": "17.11.1" + "Microsoft.CodeCoverage": "17.12.0", + "Microsoft.TestPlatform.TestHost": "17.12.0" } }, "Moq": { @@ -459,18 +459,18 @@ }, "Microsoft.TestPlatform.ObjectModel": { "type": "Transitive", - "resolved": "17.11.1", - "contentHash": "E2jZqAU6JeWEVsyOEOrSW1o1bpHLgb25ypvKNB/moBXPVsFYBPd/Jwi7OrYahG50J83LfHzezYI+GaEkpAotiA==", + "resolved": "17.12.0", + "contentHash": "TDqkTKLfQuAaPcEb3pDDWnh7b3SyZF+/W9OZvWFp6eJCIiiYFdSB6taE2I6tWrFw5ywhzOb6sreoGJTI6m3rSQ==", "dependencies": { "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", - "resolved": "17.11.1", - "contentHash": "DnG+GOqJXO/CkoqlJWeDFTgPhqD/V6VqUIL3vINizCWZ3X+HshCtbbyDdSHQQEjrc2Sl/K3yaxX6s+5LFEdYuw==", + "resolved": "17.12.0", + "contentHash": "MiPEJQNyADfwZ4pJNpQex+t9/jOClBGMiCiVVFuELCMSX2nmNfvUor3uFVxNNCg30uxDP8JDYfPnMXQzsfzYyg==", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.11.1", + "Microsoft.TestPlatform.ObjectModel": "17.12.0", "Newtonsoft.Json": "13.0.1" } }, @@ -915,7 +915,7 @@ "HIC.BadMedicine.Dicom": "[0.1.1, )", "HIC.RDMP.Plugin.Test": "[8.3.0, )", "Microsoft.CodeCoverage": "[17.12.0, )", - "Microsoft.NET.Test.Sdk": "[17.11.1, )", + "Microsoft.NET.Test.Sdk": "[17.12.0, )", "Moq": "[4.20.72, )", "NLog": "[5.3.4, )", "NUnit": "[4.2.2, )", diff --git a/tests/SmiServices.UnitTests/packages.lock.json b/tests/SmiServices.UnitTests/packages.lock.json index e7a1d0780..f10661abe 100644 --- a/tests/SmiServices.UnitTests/packages.lock.json +++ b/tests/SmiServices.UnitTests/packages.lock.json @@ -34,12 +34,12 @@ }, "Microsoft.NET.Test.Sdk": { "type": "Direct", - "requested": "[17.11.1, )", - "resolved": "17.11.1", - "contentHash": "U3Ty4BaGoEu+T2bwSko9tWqWUOU16WzSFkq6U8zve75oRBMSLTBdMAZrVNNz1Tq12aCdDom9fcOcM9QZaFHqFg==", + "requested": "[17.12.0, )", + "resolved": "17.12.0", + "contentHash": "kt/PKBZ91rFCWxVIJZSgVLk+YR+4KxTuHf799ho8WNiK5ZQpJNAEZCAWX86vcKrs+DiYjiibpYKdGZP6+/N17w==", "dependencies": { - "Microsoft.CodeCoverage": "17.11.1", - "Microsoft.TestPlatform.TestHost": "17.11.1" + "Microsoft.CodeCoverage": "17.12.0", + "Microsoft.TestPlatform.TestHost": "17.12.0" } }, "Moq": { @@ -459,18 +459,18 @@ }, "Microsoft.TestPlatform.ObjectModel": { "type": "Transitive", - "resolved": "17.11.1", - "contentHash": "E2jZqAU6JeWEVsyOEOrSW1o1bpHLgb25ypvKNB/moBXPVsFYBPd/Jwi7OrYahG50J83LfHzezYI+GaEkpAotiA==", + "resolved": "17.12.0", + "contentHash": "TDqkTKLfQuAaPcEb3pDDWnh7b3SyZF+/W9OZvWFp6eJCIiiYFdSB6taE2I6tWrFw5ywhzOb6sreoGJTI6m3rSQ==", "dependencies": { "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", - "resolved": "17.11.1", - "contentHash": "DnG+GOqJXO/CkoqlJWeDFTgPhqD/V6VqUIL3vINizCWZ3X+HshCtbbyDdSHQQEjrc2Sl/K3yaxX6s+5LFEdYuw==", + "resolved": "17.12.0", + "contentHash": "MiPEJQNyADfwZ4pJNpQex+t9/jOClBGMiCiVVFuELCMSX2nmNfvUor3uFVxNNCg30uxDP8JDYfPnMXQzsfzYyg==", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.11.1", + "Microsoft.TestPlatform.ObjectModel": "17.12.0", "Newtonsoft.Json": "13.0.1" } }, From 86dea10d798b3f27452ede03cb54aa4db8de7ffe Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 14:33:28 +0000 Subject: [PATCH 14/35] add pre-commit python hooks & tidy --- .github/workflows/codeql.yml | 4 +- .github/workflows/main.yml | 10 +- .meta/flake8.conf | 8 ++ .meta/isort.cfg | 3 + .meta/mypy.ini | 9 ++ .pre-commit-config.yaml | 49 ++++++++ bin/checkDocs.py | 10 +- bin/common.py | 71 ++++++------ bin/ctp/build.py | 48 -------- bin/ctp/ctp_build.py | 44 +++++++ ...stPackage.py => ctp_build_test_package.py} | 29 ++--- bin/ctp/ctp_package.py | 65 +++++++++++ bin/ctp/ctp_start_docker_linux.py | 32 +++++ bin/ctp/ctp_stop_docker_linux.py | 36 ++++++ bin/ctp/ctp_test.py | 45 ++++++++ bin/ctp/{installLibs.py => install_libs.py} | 26 ++--- bin/ctp/{javaCommon.py => java_common.py} | 5 +- bin/ctp/package.py | 69 ----------- bin/ctp/startDockerLinux.py | 33 ------ bin/ctp/stopDockerLinux.py | 33 ------ bin/ctp/test.py | 50 -------- bin/release/createReleaseChangelog.py | 9 +- bin/release/updateChangelog.py | 44 +++---- bin/smi/{dotnetCommon.py => dotnet_common.py} | 2 +- bin/smi/downloadRdmpCli.py | 23 ++-- ...wnloadTessdata.py => download_tessdata.py} | 28 ++--- bin/smi/{build.py => smi_build.py} | 36 +++--- ...stPackage.py => smi_build_test_package.py} | 47 ++++---- bin/smi/{package.py => smi_package.py} | 51 ++++---- ...ckerLinux.py => smi_start_docker_linux.py} | 24 ++-- bin/smi/smi_stop_docker_linux.py | 38 ++++++ bin/smi/smi_test.py | 109 ++++++++++++++++++ bin/smi/stopDockerLinux.py | 35 ------ bin/smi/test.py | 102 ---------------- bin/smi/writeDatabaseStrings.py | 34 ++++-- 35 files changed, 664 insertions(+), 597 deletions(-) create mode 100644 .meta/flake8.conf create mode 100644 .meta/isort.cfg create mode 100644 .meta/mypy.ini delete mode 100755 bin/ctp/build.py create mode 100755 bin/ctp/ctp_build.py rename bin/ctp/{buildTestPackage.py => ctp_build_test_package.py} (63%) create mode 100755 bin/ctp/ctp_package.py create mode 100755 bin/ctp/ctp_start_docker_linux.py create mode 100755 bin/ctp/ctp_stop_docker_linux.py create mode 100755 bin/ctp/ctp_test.py rename bin/ctp/{installLibs.py => install_libs.py} (73%) rename bin/ctp/{javaCommon.py => java_common.py} (69%) delete mode 100755 bin/ctp/package.py delete mode 100755 bin/ctp/startDockerLinux.py delete mode 100755 bin/ctp/stopDockerLinux.py delete mode 100755 bin/ctp/test.py rename bin/smi/{dotnetCommon.py => dotnet_common.py} (89%) rename bin/smi/{downloadTessdata.py => download_tessdata.py} (56%) rename bin/smi/{build.py => smi_build.py} (65%) rename bin/smi/{buildTestPackage.py => smi_build_test_package.py} (53%) rename bin/smi/{package.py => smi_package.py} (60%) rename bin/smi/{startDockerLinux.py => smi_start_docker_linux.py} (65%) create mode 100755 bin/smi/smi_stop_docker_linux.py create mode 100755 bin/smi/smi_test.py delete mode 100755 bin/smi/stopDockerLinux.py delete mode 100755 bin/smi/test.py diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c63dd2a72..f6986c2eb 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,11 +38,11 @@ jobs: uses: actions/setup-dotnet@v4.1.0 - name: Build .Net if: ${{ matrix.language == 'csharp' }} - run: ./bin/smi/build.py -c Release + run: ./bin/smi/smi_build.py -c Release - name: Build java if: ${{ matrix.language == 'java' }} # NOTE(rkm 2023-03-21) Ensure test code is detected but don't actually run anything - run: ./bin/ctp/test.py --install-libs -DskipTests + run: ./bin/ctp/ctp_test.py --install-libs -DskipTests - name: SecurityCodescan if: ${{ matrix.language == 'csharp' }} run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3468fa3dd..6f1e32710 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,10 +65,10 @@ jobs: # NOTE(rkm 2022-02-20) Uses global.json uses: actions/setup-dotnet@v4.1.0 - name: download tessdata - run: ./bin/smi/downloadTessdata.py + run: ./bin/smi/download_tessdata.py - name: "[linux] start services" if: ${{ matrix.os == 'linux' }} - run: ./bin/smi/startDockerLinux.py ${{ env.db-password }} + run: ./bin/smi/smi_start_docker_linux.py ${{ env.db-password }} - name: "[linux] re-write database strings" if: ${{ matrix.os == 'linux' }} run: | @@ -96,7 +96,7 @@ jobs: set -euxo pipefail cov="" [ "${{ matrix.os }}" == "windows" ] && cov="--no-coverage" - ./bin/smi/buildTestPackage.py \ + ./bin/smi/smi_build_test_package.py \ ${{ needs.init.outputs.build_ref }} \ "$cov" - name: upload coverage to codecov @@ -139,12 +139,12 @@ jobs: cache: maven - name: "[linux] start services" if: ${{ matrix.os == 'linux' }} - run: ./bin/ctp/startDockerLinux.py + run: ./bin/ctp/ctp_start_docker_linux.py - name: "[windows] skip integration tests" if: ${{ matrix.os == 'windows' }} run: echo "JAVA_TESTS=--skip-integration-tests" >> $GITHUB_ENV - name: build, test, and package ctp - run: ./bin/ctp/buildTestPackage.py --install-libs ${{ needs.init.outputs.build_ref }} ${{ env.JAVA_TESTS }} + run: ./bin/ctp/ctp_build_test_package.py --install-libs ${{ needs.init.outputs.build_ref }} ${{ env.JAVA_TESTS }} - name: "[linux] upload packages" if: ${{ matrix.os == 'linux' }} uses: actions/upload-artifact@v4 diff --git a/.meta/flake8.conf b/.meta/flake8.conf new file mode 100644 index 000000000..3f5824b38 --- /dev/null +++ b/.meta/flake8.conf @@ -0,0 +1,8 @@ +[flake8] + +# https://github.com/psf/black +max-line-length = 120 + +# Ignoring: +# E203 - Whitespace before ':' +extend-ignore = E203 diff --git a/.meta/isort.cfg b/.meta/isort.cfg new file mode 100644 index 000000000..77300c8d5 --- /dev/null +++ b/.meta/isort.cfg @@ -0,0 +1,3 @@ +[isort] +profile = black +force_single_line = True diff --git a/.meta/mypy.ini b/.meta/mypy.ini new file mode 100644 index 000000000..154a1a472 --- /dev/null +++ b/.meta/mypy.ini @@ -0,0 +1,9 @@ +[mypy] +check_untyped_defs = true +disallow_any_generics = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = true +mypy_path = ./bin diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a4577e4b..1a90ee8d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,6 @@ --- +default_language_version: + python: python3.10 exclude: | (?x)^( .*/packages.lock.json| @@ -74,3 +76,50 @@ repos: hooks: - id: markdown-link-check args: [--quiet, --config, .meta/markdown-link-check.json] + # Python + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.10.0" + hooks: + - id: python-check-blanket-noqa + - id: python-check-mock-methods + - id: python-use-type-annotations + - id: python-no-log-warn + - repo: https://github.com/asottile/add-trailing-comma + rev: "v3.1.0" + hooks: + - id: add-trailing-comma + - repo: https://github.com/asottile/pyupgrade + rev: "v3.19.0" + hooks: + - id: pyupgrade + args: [--py310-plus] + - repo: https://github.com/asottile/yesqa + rev: "v1.5.0" + hooks: + - id: yesqa + additional_dependencies: + - pep8-naming==0.14.1 + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.13.0" + hooks: + - id: mypy + args: [--config-file, .meta/mypy.ini] + - repo: https://github.com/psf/black-pre-commit-mirror + rev: "24.10.0" + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) + args: [--settings=.meta/isort.cfg] + - repo: https://github.com/pycqa/flake8 + rev: "7.1.1" + hooks: + - id: flake8 + additional_dependencies: + - flake8-bugbear==24.10.31 + - flake8-assert-msg==1.1.1 + - pep8-naming==0.14.1 + args: [--config, .meta/flake8.conf] diff --git a/bin/checkDocs.py b/bin/checkDocs.py index d6045b9b6..205760d7e 100755 --- a/bin/checkDocs.py +++ b/bin/checkDocs.py @@ -1,15 +1,11 @@ #!/usr/bin/env python3 - import collections -import glob import os import re -import sys - -import common as C +import common as c -_VERB_CS_PATH = f"{C.PROJ_ROOT}/src/SmiServices/ServiceVerbs.cs" +_VERB_CS_PATH = f"{c.PROJ_ROOT}/src/SmiServices/ServiceVerbs.cs" _VERB_RE = re.compile(r'\[Verb\(("\S*?")') @@ -63,7 +59,7 @@ def main() -> int: for tool_type in ("application", "service"): for tool in tools[tool_type]: - doc_path = f"{C.PROJ_ROOT}/docs/{tool_type}s/{tool}.md" + doc_path = f"{c.PROJ_ROOT}/docs/{tool_type}s/{tool}.md" if not os.path.isfile(doc_path): print(f"Missing {doc_path}") rc |= 1 diff --git a/bin/common.py b/bin/common.py index b729cee3d..a71aac724 100644 --- a/bin/common.py +++ b/bin/common.py @@ -1,22 +1,17 @@ """Common build variables and functions""" import argparse -import hashlib import functools +import hashlib import os import subprocess -from pathlib import Path -from typing import Dict -from typing import Optional -from typing import Sequence -from typing import Union +from collections.abc import Sequence -PROJ_ROOT = (Path(__file__).parent / "..").resolve() -DIST_DIR = PROJ_ROOT / "dist" -STR_LIKE = Union[str, Path] +PROJ_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) +DIST_DIR = f"{PROJ_ROOT}/dist" -def add_clean_arg(parser: argparse.ArgumentParser) -> None: +def add_clean_arg(parser: argparse.ArgumentParser) -> None: parser.add_argument( "--clean", action="store_true", @@ -24,7 +19,7 @@ def add_clean_arg(parser: argparse.ArgumentParser) -> None: ) -def add_tag_arg(parser: argparse.ArgumentParser) -> None: +def add_tag_arg(parser: argparse.ArgumentParser) -> None: parser.add_argument( "tag", help="The git tag for the release", @@ -32,13 +27,12 @@ def add_tag_arg(parser: argparse.ArgumentParser) -> None: def run( - cmd: Sequence[STR_LIKE], + cmd: Sequence[str], *, - cwd: Optional[str] = None, - env: Dict[str, str] = None, + cwd: str | None = None, + env: dict[str, str] | None = None, ) -> None: - cmd = [str(x) for x in cmd] cwd = cwd or PROJ_ROOT if env is None: env = {} @@ -47,22 +41,26 @@ def run( subprocess.check_call(cmd, cwd=cwd, env={**os.environ, **env}) -def create_checksums(dist_tag_dir: Path, product: str) -> None: - file_checksums = {x.name: _md5sum(x) for x in dist_tag_dir.iterdir()} +def create_checksums(dist_tag_dir: str, product: str) -> None: + file_checksums = { + x: _md5sum(f"{dist_tag_dir}/{x}") for x in os.listdir(dist_tag_dir) + } print("\n=== Checksums ===") - with open(dist_tag_dir / f"MD5SUM-{product}.txt", "w") as md5_file: + with open(f"{dist_tag_dir}/MD5SUM-{product}.txt", "w") as md5_file: for file_name, md5sum in file_checksums.items(): line = f"{md5sum} {file_name}\n" print(line, end="") md5_file.write(line) -def verify_md5(file_path: Path, expected_md5: str): +def verify_md5(file_path: str, expected_md5: str) -> None: actual_md5 = _md5sum(file_path) - assert expected_md5 == actual_md5 + assert ( + expected_md5 == actual_md5 + ), f"Checksum mismatch: expected={expected_md5}, actual={actual_md5}" -def _md5sum(file_path: Path) -> str: +def _md5sum(file_path: str) -> str: with open(file_path, mode="rb") as f: d = hashlib.md5() for buf in iter(functools.partial(f.read, 128), b""): @@ -81,28 +79,31 @@ def get_docker_parser() -> argparse.ArgumentParser: def start_containers( - compose_file: Path, + compose_file: str, *, - env: Dict[str, str] = None, + env: dict[str, str] | None = None, docker: str, - checks: Sequence[str] + checks: Sequence[str], ) -> None: user = ("--user", f"{os.geteuid()}:{os.getegid()}") if docker == "docker" else () - volume = f"-v{compose_file.parent}:/run" + volume = f"-v{os.path.dirname(compose_file)}:/run" if docker == "podman": volume += ":z" cmd = ( - docker, "run", + docker, + "run", "--rm", volume, *user, "safewaters/docker-lock", *( - "lock", "rewrite", - "--lockfile-name", f"{compose_file.name}.lock" - ) + "lock", + "rewrite", + "--lockfile-name", + f"{os.path.basename(compose_file)}.lock", + ), ) run(cmd) @@ -112,7 +113,8 @@ def start_containers( cmd = ( f"{docker}", "compose", - "-f", compose_file, + "-f", + compose_file, "up", "--quiet-pull", "--detach", @@ -126,7 +128,8 @@ def start_containers( for c in checks: cmd = ( "./bin/wait-for.bash", - "--timeout", "60s", + "--timeout", + "60s", f"{docker} exec {c}", ) try: @@ -136,12 +139,14 @@ def start_containers( cmd = ( f"{docker}", "compose", - "-f", compose_file, - "logs" + "-f", + compose_file, + "logs", ) run(cmd) raise + def is_ci() -> bool: ci = os.environ.get("CI", None) if ci is None: diff --git a/bin/ctp/build.py b/bin/ctp/build.py deleted file mode 100755 index 54392c718..000000000 --- a/bin/ctp/build.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import glob -import os -import shutil -import sys -from pathlib import Path -from typing import Optional -from typing import Sequence - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -import javaCommon as JC -import installLibs as L - - -def main(argv: Optional[Sequence[str]] = None) -> int: - - parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - JC.add_common_args(parser) - args, rest = parser.parse_known_args(argv) - - if args.install_libs: - rc = L.main() - if rc: - return rc - - stages = ["compile"] - if args.clean: - stages.insert(0, "clean") - - cmd = ( - JC.mvn_exe(), - "-ntp", - *stages, - "-f", (C.PROJ_ROOT / "src/common/com.smi.microservices.parent").resolve(), - *rest, - ) - C.run(cmd) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/ctp/ctp_build.py b/bin/ctp/ctp_build.py new file mode 100755 index 000000000..c6f106ba5 --- /dev/null +++ b/bin/ctp/ctp_build.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import argparse +import os +import sys +from collections.abc import Sequence + +import install_libs +import java_common + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + + +def main(argv: Sequence[str] | None = None) -> int: + + parser = argparse.ArgumentParser() + common.add_clean_arg(parser) + java_common.add_common_args(parser) + args, rest = parser.parse_known_args(argv) + + if args.install_libs: + rc = install_libs.main() + if rc: + return rc + + stages = ["compile"] + if args.clean: + stages.insert(0, "clean") + + cmd = ( + java_common.mvn_exe(), + "-ntp", + *stages, + "-f", + f"{common.PROJ_ROOT}/src/common/com.smi.microservices.parent", + *rest, + ) + common.run(cmd) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/ctp/buildTestPackage.py b/bin/ctp/ctp_build_test_package.py similarity index 63% rename from bin/ctp/buildTestPackage.py rename to bin/ctp/ctp_build_test_package.py index af307eaf7..e100727ad 100755 --- a/bin/ctp/buildTestPackage.py +++ b/bin/ctp/ctp_build_test_package.py @@ -1,28 +1,23 @@ #!/usr/bin/env python3 - import argparse -import glob import os -import shutil import sys -from pathlib import Path -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +import ctp_build +import ctp_package +import ctp_test +import java_common -import build as JB -import package as JP -import test as JT -import javaCommon as JC -import installLibs as L +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 def main() -> int: parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - C.add_tag_arg(parser) - JC.add_common_args(parser) + common.add_clean_arg(parser) + common.add_tag_arg(parser) + java_common.add_common_args(parser) parser.add_argument( "--skip-tests", action="store_true", @@ -41,17 +36,17 @@ def main() -> int: # Build and test if args.skip_tests: - rc = JB.main(build_args) + rc = ctp_build.main(build_args) else: if args.skip_integration_tests: build_args.append("-PunitTests") - rc = JT.main(build_args) + rc = ctp_test.main(build_args) if rc: return rc # Package - rc = JP.main((args.tag,)) + rc = ctp_package.main((args.tag,)) return 0 diff --git a/bin/ctp/ctp_package.py b/bin/ctp/ctp_package.py new file mode 100755 index 000000000..7a2d1e66b --- /dev/null +++ b/bin/ctp/ctp_package.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +import argparse +import glob +import os +import shutil +import sys +from collections.abc import Sequence + +import java_common + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + + +def main(argv: Sequence[str] | None = None) -> int: + + parser = argparse.ArgumentParser() + common.add_clean_arg(parser) + common.add_tag_arg(parser) + java_common.add_common_args(parser) + args, rest = parser.parse_known_args(argv) + + dist_tag_dir = f"{common.DIST_DIR}/{args.tag}" + + stages = ["package"] + + if args.clean: + stages.insert(0, "clean") + if os.path.isdir(dist_tag_dir): + shutil.rmtree(dist_tag_dir) + os.makedirs(dist_tag_dir, exist_ok=True) + + cmd = ( + java_common.mvn_exe(), + "-ntp", + *stages, + "-DskipTests", + "assembly:single@create-deployable", + "-f", + f"{common.PROJ_ROOT}/src/common/com.smi.microservices.parent", + *rest, + ) + common.run(cmd) + + zips = { + x + for x in glob.glob( + f"{common.PROJ_ROOT}/src/**/*deploy-distribution.zip", + recursive=True, + ) + } + assert 1 == len(zips), "Expected 1 zip file (CTP)" + for zip_path in zips: + shutil.copyfile( + zip_path, + f"{dist_tag_dir}/{zip_path.split('-')[0]}-{args.tag}.zip", + ) + + common.create_checksums(dist_tag_dir, "ctp") + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/ctp/ctp_start_docker_linux.py b/bin/ctp/ctp_start_docker_linux.py new file mode 100755 index 000000000..8572fd1cc --- /dev/null +++ b/bin/ctp/ctp_start_docker_linux.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + +_COMPOSE_FILE_NAME = "linux-java.yml" +_COMPOSE_FILE_PATH = f"{common.PROJ_ROOT}/utils/docker-compose/{_COMPOSE_FILE_NAME}" +assert os.path.isfile( + _COMPOSE_FILE_PATH, +), f"Compose file does not exist: {_COMPOSE_FILE_PATH}" + + +def main() -> int: + + parser = common.get_docker_parser() + args = parser.parse_args() + + docker = "podman" if args.podman else "docker" + + common.start_containers( + _COMPOSE_FILE_PATH, + docker=docker, + checks=("rabbitmq rabbitmq-diagnostics -q ping",), + ) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/ctp/ctp_stop_docker_linux.py b/bin/ctp/ctp_stop_docker_linux.py new file mode 100755 index 000000000..a3c1db247 --- /dev/null +++ b/bin/ctp/ctp_stop_docker_linux.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + +_COMPOSE_FILE_NAME = "linux-java.yml" +_COMPOSE_FILE_PATH = f"{common.PROJ_ROOT}/utils/docker-compose/{_COMPOSE_FILE_NAME}" +assert os.path.isfile( + _COMPOSE_FILE_PATH, +), f"Compose file does not exist: {_COMPOSE_FILE_PATH}" + + +def main() -> int: + + parser = common.get_docker_parser() + args = parser.parse_args() + + docker = "docker" if not args.podman else "podman" + + cmd = ( + f"{docker}-compose", + "-f", + _COMPOSE_FILE_PATH, + "down", + "--timeout", + "0", + ) + common.run(cmd) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/ctp/ctp_test.py b/bin/ctp/ctp_test.py new file mode 100755 index 000000000..c5d4b5a58 --- /dev/null +++ b/bin/ctp/ctp_test.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +import argparse +import os +import sys +from collections.abc import Sequence + +import install_libs +import java_common + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + + +def main(argv: Sequence[str] | None = None) -> int: + + parser = argparse.ArgumentParser() + common.add_clean_arg(parser) + java_common.add_common_args(parser) + args, rest = parser.parse_known_args(argv) + + if args.install_libs: + rc = install_libs.main() + if rc: + return rc + + stages = ["test"] + if args.clean: + stages.insert(0, "clean") + + cmd = ( + java_common.mvn_exe(), + "-ntp", + "-DtrimStackTrace=false", + *stages, + "-f", + f"{common.PROJ_ROOT}/src/common/com.smi.microservices.parent", + *rest, + ) + common.run(cmd) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/ctp/installLibs.py b/bin/ctp/install_libs.py similarity index 73% rename from bin/ctp/installLibs.py rename to bin/ctp/install_libs.py index 02ee33653..76275b9f5 100755 --- a/bin/ctp/installLibs.py +++ b/bin/ctp/install_libs.py @@ -1,17 +1,14 @@ #!/usr/bin/env python3 - import os import sys -from pathlib import Path - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C -import javaCommon as JC +import java_common +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common as c # noqa: E402 -_CTP_LIB_DIR = Path(f"{C.PROJ_ROOT}/lib/ctp") -assert _CTP_LIB_DIR.is_dir() +_CTP_LIB_DIR = f"{c.PROJ_ROOT}/lib/ctp" +assert os.path.isdir(_CTP_LIB_DIR), "Could not find CTP libs dir" _CTP_JARS = [ "CTP", @@ -31,9 +28,10 @@ def main() -> int: base_cmd = ( - JC.mvn_exe(), - "--quiet", "--no-transfer-progress", - "install:install-file" + java_common.mvn_exe(), + "--quiet", + "--no-transfer-progress", + "install:install-file", ) base_jar_cmd = ( @@ -43,7 +41,7 @@ def main() -> int: "-DgeneratePom=true", ) for j in _CTP_JARS: - C.run( + c.run( ( *base_jar_cmd, f"-DartifactId={j}", @@ -53,7 +51,7 @@ def main() -> int: cwd=_CTP_LIB_DIR, ) for j in _DAT_JARS: - C.run( + c.run( ( *base_jar_cmd, f"-DartifactId={j}", @@ -63,7 +61,7 @@ def main() -> int: cwd=_CTP_LIB_DIR, ) - C.run( + c.run( ( *base_cmd, "-Dfile=DAT.jar", diff --git a/bin/ctp/javaCommon.py b/bin/ctp/java_common.py similarity index 69% rename from bin/ctp/javaCommon.py rename to bin/ctp/java_common.py index 059a746e2..d0fab6dc9 100644 --- a/bin/ctp/javaCommon.py +++ b/bin/ctp/java_common.py @@ -10,8 +10,9 @@ def add_common_args( parser.add_argument( "--install-libs", action="store_true", - help="Install the CTP libraries if specified" + help="Install the CTP libraries if specified", ) + def mvn_exe() -> str: - return "mvn" if os.name == "posix" else "mvn.cmd" + return "mvn" if os.name == "posix" else "mvn.cmd" diff --git a/bin/ctp/package.py b/bin/ctp/package.py deleted file mode 100755 index 8fcc81452..000000000 --- a/bin/ctp/package.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import glob -import os -import shutil -import sys -from pathlib import Path -from typing import Optional -from typing import Sequence - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -import build as JB -import installLibs as L -import javaCommon as JC - - -def main(argv: Optional[Sequence[str]] = None) -> int: - - parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - C.add_tag_arg(parser) - JC.add_common_args(parser) - args, rest = parser.parse_known_args(argv) - - dist_tag_dir = C.DIST_DIR / args.tag - - stages = ["package"] - - if args.clean: - stages.insert(0, "clean") - if dist_tag_dir.is_dir(): - shutil.rmtree(dist_tag_dir) - dist_tag_dir.mkdir(parents=True, exist_ok=True) - - cmd = ( - JC.mvn_exe(), - "-ntp", - *stages, - "-DskipTests", - "assembly:single@create-deployable", - "-f", (C.PROJ_ROOT / "src/common/com.smi.microservices.parent").resolve(), - *rest, - ) - C.run(cmd) - - zips = { - Path(x) for x in - glob.glob( - f"{C.PROJ_ROOT}/src/**/*deploy-distribution.zip", - recursive=True, - ) - } - assert 1 == len(zips), "Expected 1 zip file (CTP)" - for zip_path in zips: - shutil.copyfile( - zip_path, - dist_tag_dir / f"{zip_path.name.split('-')[0]}-{args.tag}.zip", - ) - - C.create_checksums(dist_tag_dir, "ctp") - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/ctp/startDockerLinux.py b/bin/ctp/startDockerLinux.py deleted file mode 100755 index 1c2a43fa8..000000000 --- a/bin/ctp/startDockerLinux.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -_COMPOSE_FILE_NAME = "linux-java.yml" -_COMPOSE_FILE_PATH = (C.PROJ_ROOT / "utils/docker-compose" / _COMPOSE_FILE_NAME).resolve() -assert _COMPOSE_FILE_PATH.is_file() - - -def main() -> int: - - parser = C.get_docker_parser() - args = parser.parse_args() - - docker = "podman" if args.podman else "docker" - - C.start_containers( - _COMPOSE_FILE_PATH, - docker=docker, - checks=( - "rabbitmq rabbitmq-diagnostics -q ping", - ), - ) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/ctp/stopDockerLinux.py b/bin/ctp/stopDockerLinux.py deleted file mode 100755 index 9454d40ce..000000000 --- a/bin/ctp/stopDockerLinux.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -_COMPOSE_FILE_NAME = "linux-java.yml" -_COMPOSE_FILE_PATH = (C.PROJ_ROOT / "utils/docker-compose" / _COMPOSE_FILE_NAME).resolve() -assert _COMPOSE_FILE_PATH.is_file() - - -def main() -> int: - - parser = C.get_docker_parser() - args = parser.parse_args() - - docker = "docker" if not args.podman else "podman" - - cmd = ( - f"{docker}-compose", - "-f", _COMPOSE_FILE_PATH, - "down", - "--timeout", 0, - ) - C.run(cmd) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/ctp/test.py b/bin/ctp/test.py deleted file mode 100755 index b18cf9d74..000000000 --- a/bin/ctp/test.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import glob -import os -import shutil -import sys -from pathlib import Path -from typing import Optional -from typing import Sequence - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -import build as JB -import installLibs as L -import javaCommon as JC - - -def main(argv: Optional[Sequence[str]] = None) -> int: - - parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - JC.add_common_args(parser) - args, rest = parser.parse_known_args(argv) - - if args.install_libs: - rc = L.main() - if rc: - return rc - - stages = ["test"] - if args.clean: - stages.insert(0, "clean") - - cmd = ( - JC.mvn_exe(), - "-ntp", - "-DtrimStackTrace=false", - *stages, - "-f", (C.PROJ_ROOT / "src/common/com.smi.microservices.parent").resolve(), - *rest, - ) - C.run(cmd) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/release/createReleaseChangelog.py b/bin/release/createReleaseChangelog.py index 08238e9fd..f5fdeaf76 100755 --- a/bin/release/createReleaseChangelog.py +++ b/bin/release/createReleaseChangelog.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 - import argparse import re -from typing import Optional -from typing import Sequence +from collections.abc import Sequence -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument("tag", help="The git tag for the release") @@ -36,7 +34,8 @@ def main(argv: Optional[Sequence[str]] = None) -> int: f.write(content) print(f"Wrote {output_file}") + return 0 if __name__ == "__main__": - exit(main()) + raise SystemExit(main()) diff --git a/bin/release/updateChangelog.py b/bin/release/updateChangelog.py index 2e4d70dc7..a66366070 100755 --- a/bin/release/updateChangelog.py +++ b/bin/release/updateChangelog.py @@ -6,39 +6,29 @@ import collections import datetime import fileinput +import glob import json +import os import subprocess -import sys import urllib.request -from pathlib import Path -from typing import Dict -from typing import Optional -from typing import Sequence -from typing import Union +from collections.abc import Sequence - -_NEWS_DIR = Path("./news/") +_NEWS_DIR = "./news/" _MARKER = "" _UNRELEASED_LINK = "[unreleased]:" _ORG = "SMI" _REPO = "SmiServices" -_STR_LIKE = Union[str, Path] - -def _run(cmd: Sequence[_STR_LIKE]): +def _run(cmd: Sequence[str]) -> None: subprocess.check_call(("echo", *cmd)) subprocess.check_call(cmd) def _get_pr_author(pr_ref: int) -> str: - url = ( - f"https://api.github.com/repos/" - f"{_ORG}/{_REPO}/" - f"pulls/{pr_ref}" - ) + url = f"https://api.github.com/repos/" f"{_ORG}/{_REPO}/" f"pulls/{pr_ref}" try: resp = urllib.request.urlopen(url) except urllib.error.HTTPError as e: @@ -47,12 +37,15 @@ def _get_pr_author(pr_ref: int) -> str: return data["user"]["login"] -def _print_fragments(version: str, fragments: Dict[str, Dict[int, str]]) -> None: +def _print_fragments(version: str, fragments: dict[str, dict[int, str]]) -> None: today = datetime.datetime.today().strftime("%Y-%m-%d") print(f"## [{version[1:]}] {today}") - def _print_type_fragment(frag_type: str, fragments: Dict[str, Dict[int, str]]): + def _print_type_fragment( + frag_type: str, + fragments: dict[str, dict[int, str]], + ) -> None: print(f"\n### {frag_type.capitalize()}\n") for pr_ref in sorted(fragments[frag_type]): first, *rest = fragments[frag_type][pr_ref].splitlines() @@ -97,7 +90,7 @@ def _print_links(last_tag: str, next_tag: str) -> None: print(diff_link_str) -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( @@ -111,13 +104,13 @@ def main(argv: Optional[Sequence[str]] = None) -> int: args = parser.parse_args(argv) # Gather the news files for the next release - fragments = collections.defaultdict(dict) - fragment_files = list(_NEWS_DIR.glob("*-*.md")) + fragments: dict[str, dict[int, str]] = collections.defaultdict(dict) + fragment_files = list(glob.glob(f"{_NEWS_DIR}/*-*.md")) for fragment_file in fragment_files: with open(fragment_file) as f: contents = f.read() - pr_ref, _, frag_type = fragment_file.stem.partition("-") - fragments[frag_type][pr_ref] = contents + pr_ref, _, frag_type = os.path.splitext(fragment_file)[0].partition("-") + fragments[frag_type][int(pr_ref)] = contents # Write-out the new CHANGELOG with fileinput.FileInput("CHANGELOG.md", inplace=True) as f: @@ -134,8 +127,9 @@ def main(argv: Optional[Sequence[str]] = None) -> int: # Now delete all the news files for news_file in fragment_files: cmd = ( - "git", "rm", - news_file + "git", + "rm", + news_file, ) _run(cmd) diff --git a/bin/smi/dotnetCommon.py b/bin/smi/dotnet_common.py similarity index 89% rename from bin/smi/dotnetCommon.py rename to bin/smi/dotnet_common.py index a3a7a0894..949ee54db 100644 --- a/bin/smi/dotnetCommon.py +++ b/bin/smi/dotnet_common.py @@ -5,7 +5,7 @@ def add_args( parser: argparse.ArgumentParser, - configuration: str = "debug" + configuration: str = "debug", ) -> None: parser.add_argument( "-c", diff --git a/bin/smi/downloadRdmpCli.py b/bin/smi/downloadRdmpCli.py index ddb4f3587..ec68601cb 100755 --- a/bin/smi/downloadRdmpCli.py +++ b/bin/smi/downloadRdmpCli.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 - import argparse import os import shutil @@ -8,17 +7,15 @@ import tempfile import urllib.request import zipfile -from pathlib import Path -from typing import Sequence -from typing import Optional +from collections.abc import Sequence -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 -_RDMP_CLI_DIR = (C.PROJ_ROOT / "rdmp-cli").resolve() +_RDMP_CLI_DIR = f"{common.PROJ_ROOT}/rdmp-cli" -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( @@ -27,16 +24,16 @@ def main(argv: Optional[Sequence[str]] = None) -> int: parser.add_argument( "--clean", action="store_true", - help="Delete the file and re-download if it already exists" + help="Delete the file and re-download if it already exists", ) args = parser.parse_args(argv) if args.clean: shutil.rmtree(_RDMP_CLI_DIR) - elif _RDMP_CLI_DIR.is_dir(): + elif os.path.isdir(_RDMP_CLI_DIR): print(f"Error: {_RDMP_CLI_DIR} exists") return 1 - _RDMP_CLI_DIR.mkdir() + os.mkdir(_RDMP_CLI_DIR) platform = "linux" if os.name == "posix" else "win" url = ( @@ -45,13 +42,13 @@ def main(argv: Optional[Sequence[str]] = None) -> int: ) print(f"Downloading {url}") with tempfile.TemporaryDirectory() as tmpdir: - _file = Path(tmpdir) / f"rdmp-cli-{args.version}-x64.zip" + _file = f"{tmpdir}/rdmp-cli-{args.version}-x64.zip" urllib.request.urlretrieve(url, _file) with zipfile.ZipFile(_file) as zf: zf.extractall(path=_RDMP_CLI_DIR) - rdmp = _RDMP_CLI_DIR / ("rdmp.exe" if os.name == "nt" else "rdmp") + rdmp = f"{_RDMP_CLI_DIR}/{'rdmp.exe' if os.name == 'nt' else 'rdmp'}" st = os.stat(rdmp) os.chmod(rdmp, st.st_mode | stat.S_IXUSR | stat.S_IXGRP) diff --git a/bin/smi/downloadTessdata.py b/bin/smi/download_tessdata.py similarity index 56% rename from bin/smi/downloadTessdata.py rename to bin/smi/download_tessdata.py index cc7a6af20..109d60a11 100755 --- a/bin/smi/downloadTessdata.py +++ b/bin/smi/download_tessdata.py @@ -1,49 +1,43 @@ #!/usr/bin/env python3 - import argparse import os import sys import urllib.request -from pathlib import Path -from typing import Sequence -from typing import Optional +from collections.abc import Sequence -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 -_PATH = C.PROJ_ROOT / "data/tessdata" +_PATH = f"{common.PROJ_ROOT}/data/tessdata" _FILE = "eng.traineddata" _VERSION = "4.1.0" _MD5SUM = "57e0df3d84fed9fbf8c7a8e589f8f012" -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( "--clean", action="store_true", - help="Delete the file and re-download if it already exists" + help="Delete the file and re-download if it already exists", ) args = parser.parse_args(argv) - output_file = Path(_PATH, _FILE) - if output_file.is_file(): + output_file = f"{_PATH}/{_FILE}" + if os.path.isfile(output_file): if args.clean: os.unlink(output_file) else: print(f"{output_file} exists") - C.verify_md5(output_file, _MD5SUM) + common.verify_md5(output_file, _MD5SUM) return 0 - url = ( - "https://github.com/tesseract-ocr/tessdata/raw/" - f"{_VERSION}/{_FILE}" - ) + url = "https://github.com/tesseract-ocr/tessdata/raw/" f"{_VERSION}/{_FILE}" print(f"Downloading {url}") urllib.request.urlretrieve(url, output_file) - C.verify_md5(output_file, _MD5SUM) + common.verify_md5(output_file, _MD5SUM) return 0 diff --git a/bin/smi/build.py b/bin/smi/smi_build.py similarity index 65% rename from bin/smi/build.py rename to bin/smi/smi_build.py index a67d634b1..c18f13893 100755 --- a/bin/smi/build.py +++ b/bin/smi/smi_build.py @@ -1,22 +1,19 @@ #!/usr/bin/env python3 - import argparse import os -import platform import sys -from typing import Optional -from typing import Sequence +from collections.abc import Sequence -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +import dotnet_common as dc -import dotnetCommon as DC +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common as c # noqa: E402 -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() - DC.add_args(parser) + dc.add_args(parser) parser.add_argument( "--clean", action="store_true", @@ -24,19 +21,22 @@ def main(argv: Optional[Sequence[str]] = None) -> int: ) args = parser.parse_args(argv) + cmd: tuple[str, ...] + if args.clean: cmd = ( "dotnet", "clean", "-p:UseCurrentRuntimeIdentifier=True", - "--verbosity", "quiet", + "--verbosity", + "quiet", "--nologo", ) - C.run(cmd) + c.run(cmd) # NOTE This isn't necessarily needed, but the lockfile processing isn't # otherwise transparent in the build output - if C.is_ci(): + if c.is_ci(): cmd = ( "dotnet", "restore", @@ -46,19 +46,21 @@ def main(argv: Optional[Sequence[str]] = None) -> int: "--locked-mode", "--force", ) - C.run(cmd) + c.run(cmd) cmd = ( "dotnet", "build", "-warnaserror", "--use-current-runtime", - "--configuration", args.configuration, - "--no-restore" if C.is_ci() else "", - "--verbosity", "quiet", + "--configuration", + args.configuration, + "--no-restore" if c.is_ci() else "", + "--verbosity", + "quiet", "--nologo", ) - C.run(cmd) + c.run(cmd) return 0 diff --git a/bin/smi/buildTestPackage.py b/bin/smi/smi_build_test_package.py similarity index 53% rename from bin/smi/buildTestPackage.py rename to bin/smi/smi_build_test_package.py index 665ef71d7..3534c9626 100755 --- a/bin/smi/buildTestPackage.py +++ b/bin/smi/smi_build_test_package.py @@ -1,24 +1,23 @@ #!/usr/bin/env python3 - import argparse import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +import dotnet_common +import smi_build +import smi_package +import smi_test -import dotnetCommon as DC -import build as DB -import package as DP -import test as DT +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 def main() -> int: parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - C.add_tag_arg(parser) - DC.add_args(parser, "release") + common.add_clean_arg(parser) + common.add_tag_arg(parser) + dotnet_common.add_args(parser, "release") parser.add_argument( "--skip-tests", action="store_true", @@ -32,29 +31,33 @@ def main() -> int: cfg_args = ("-c", args.configuration) # Build - build_args = [*cfg_args,] + build_args = [*cfg_args] if args.clean: build_args.append("--clean") - rc = DB.main(build_args) + rc = smi_build.main(build_args) if rc: return rc # Test if not args.skip_tests: - rc = DT.main(( - *cfg_args, - "--no-coverage" if args.no_coverage else "", - "--no-build", - )) + rc = smi_test.main( + ( + *cfg_args, + "--no-coverage" if args.no_coverage else "", + "--no-build", + ), + ) if rc: return rc # Package - rc = DP.main(( - *cfg_args, - "--no-build", - args.tag, - )) + rc = smi_package.main( + ( + *cfg_args, + "--no-build", + args.tag, + ), + ) return rc diff --git a/bin/smi/package.py b/bin/smi/smi_package.py similarity index 60% rename from bin/smi/package.py rename to bin/smi/smi_package.py index d4d91c328..1b2c60fe6 100755 --- a/bin/smi/package.py +++ b/bin/smi/smi_package.py @@ -1,17 +1,14 @@ #!/usr/bin/env python3 - import argparse import os -import platform import shutil import sys -from typing import Optional -from typing import Sequence +from collections.abc import Sequence -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +import dotnet_common -import dotnetCommon as DC +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 _LINUX = "linux" _WINDOWS = "win" @@ -25,50 +22,54 @@ def runtime_platform() -> str: raise ValueError(os.name) -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() - C.add_clean_arg(parser) - C.add_tag_arg(parser) - DC.add_args(parser) + common.add_clean_arg(parser) + common.add_tag_arg(parser) + dotnet_common.add_args(parser) parser.add_argument( "--no-build", action="store_true", ) args = parser.parse_args(argv) - dist_tag_dir = C.DIST_DIR / args.tag + dist_tag_dir = f"{common.DIST_DIR}/{args.tag}" - if args.clean and dist_tag_dir.is_dir(): + if args.clean and os.path.isdir(dist_tag_dir): shutil.rmtree(dist_tag_dir) - dist_tag_dir.mkdir(parents=True, exist_ok=True) + os.makedirs(dist_tag_dir, exist_ok=True) platform = runtime_platform() rid = f"{platform}-x64" smi_services_output_dir = f"smi-services-{args.tag}-{rid}" - cmd = ( + cmd: tuple[str, ...] = ( "dotnet", "publish", "-warnaserror", "--use-current-runtime", - "--configuration", args.configuration, + "--configuration", + args.configuration, "--no-build" if args.no_build else "", "-p:PublishTrimmed=false", "--self-contained", - "--output", dist_tag_dir / smi_services_output_dir, - "--verbosity", "quiet", + "--output", + f"{dist_tag_dir}/{smi_services_output_dir}", + "--verbosity", + "quiet", "--nologo", "src/SmiServices", ) - C.run(cmd) + common.run(cmd) if platform == _LINUX: cmd = ( "tar", - "-C", dist_tag_dir, + "-C", + dist_tag_dir, "-czf", - dist_tag_dir / f"{smi_services_output_dir}.tgz", + f"{dist_tag_dir}/{smi_services_output_dir}.tgz", smi_services_output_dir, ) elif platform == _WINDOWS: @@ -80,17 +81,17 @@ def main(argv: Optional[Sequence[str]] = None) -> int: "-tzip", "-mx9", "-r", - dist_tag_dir / f"{smi_services_output_dir}.zip", + f"{dist_tag_dir}/{smi_services_output_dir}.zip", smi_services_output_dir, ) else: print(f"Error: No case for platform {platform}", file=sys.stderr) return 1 - C.run(cmd) - shutil.rmtree(dist_tag_dir / smi_services_output_dir) + common.run(cmd) + shutil.rmtree(f"{dist_tag_dir}/{smi_services_output_dir}") - C.create_checksums(dist_tag_dir, "smiservices") + common.create_checksums(dist_tag_dir, "smiservices") return 0 diff --git a/bin/smi/startDockerLinux.py b/bin/smi/smi_start_docker_linux.py similarity index 65% rename from bin/smi/startDockerLinux.py rename to bin/smi/smi_start_docker_linux.py index 748a11961..7f8783edb 100755 --- a/bin/smi/startDockerLinux.py +++ b/bin/smi/smi_start_docker_linux.py @@ -1,21 +1,22 @@ #!/usr/bin/env python3 - import os import platform import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 _PLAT = "-arm" if platform.processor() == "arm" else "" _COMPOSE_FILE_NAME = f"linux-dotnet{_PLAT}.yml" -_COMPOSE_FILE_PATH = (C.PROJ_ROOT / "utils/docker-compose" / _COMPOSE_FILE_NAME).resolve() -assert _COMPOSE_FILE_PATH.is_file() +_COMPOSE_FILE_PATH = f"{common.PROJ_ROOT}/utils/docker-compose/{_COMPOSE_FILE_NAME}" +assert os.path.isfile( + _COMPOSE_FILE_PATH, +), f"Compose file does not exist: {_COMPOSE_FILE_PATH}" def main() -> int: - parser = C.get_docker_parser() + parser = common.get_docker_parser() parser.add_argument( "db_password", ) @@ -23,7 +24,7 @@ def main() -> int: docker = "podman" if args.podman else "docker" - C.start_containers( + common.start_containers( _COMPOSE_FILE_PATH, docker=docker, env={ @@ -40,11 +41,14 @@ def main() -> int: # Start MongoDB replication cmd = ( - docker, "exec", + docker, + "exec", "mongodb", - "/usr/bin/mongo", "--eval", 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27017"}]})', + "/usr/bin/mongo", + "--eval", + 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27017"}]})', ) - C.run(cmd) + common.run(cmd) return 0 diff --git a/bin/smi/smi_stop_docker_linux.py b/bin/smi/smi_stop_docker_linux.py new file mode 100755 index 000000000..1f876cac1 --- /dev/null +++ b/bin/smi/smi_stop_docker_linux.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import os +import platform +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + +_PLATFORM = "-arm" if platform.processor() == "arm" else "" +_COMPOSE_FILE_NAME = f"linux-dotnet{_PLATFORM}.yml" +_COMPOSE_FILE_PATH = f"{common.PROJ_ROOT}/utils/docker-compose/{_COMPOSE_FILE_NAME}" +assert os.path.isfile( + _COMPOSE_FILE_PATH, +), f"Compose file does not exist: {_COMPOSE_FILE_PATH}" + + +def main() -> int: + + parser = common.get_docker_parser() + args = parser.parse_args() + + docker = "docker" if not args.podman else "podman" + + cmd = ( + f"{docker}-compose", + "-f", + _COMPOSE_FILE_PATH, + "down", + "--timeout", + "0", + ) + common.run(cmd) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/smi/smi_test.py b/bin/smi/smi_test.py new file mode 100755 index 000000000..c7d4b809c --- /dev/null +++ b/bin/smi/smi_test.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import argparse +import glob +import json +import os +import shutil +import sys +from collections.abc import Sequence + +import dotnet_common +import download_tessdata +import smi_build + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 + + +def main(argv: Sequence[str] | None = None) -> int: + + parser = argparse.ArgumentParser() + dotnet_common.add_args(parser) + parser.add_argument( + "--no-build", + action="store_true", + ) + parser.add_argument( + "--no-coverage", + action="store_true", + ) + group = parser.add_mutually_exclusive_group() + group.add_argument( + "--test", + nargs=1, + help="Run a specific test class", + ) + group.add_argument( + "--unit-only", + action="store_true", + help="Run unit tests only", + ) + args, _ = parser.parse_known_args(argv) + + rc = download_tessdata.main([]) + if rc: + return rc + + if not args.no_build: + rc = smi_build.main(("--configuration", args.configuration)) + if rc: + return rc + + with open(f"{common.PROJ_ROOT}/global.json") as f: + global_json = json.load(f) + sdk_version_major = global_json["sdk"]["version"].split(".")[0] + + net_glob = { + x + for x in glob.glob( + f"{common.PROJ_ROOT}/**/net{sdk_version_major}", + recursive=True, + ) + } + for build_dir in net_glob: + try: + os.symlink( + f"{common.PROJ_ROOT}/data/microserviceConfigs/default.yaml", + f"{build_dir}/default.yaml", + ) + except FileExistsError: + pass + + cov_dir = f"{common.PROJ_ROOT}/coverage" + if not args.no_coverage: + if os.path.isdir(cov_dir): + shutil.rmtree(cov_dir) + + cmd = ("dotnet", "tool", "restore") + common.run(cmd) + + filter: tuple[str, ...] = ("--filter", args.test[0]) if args.test else () + unit_only = ( + ("--filter", "FullyQualifiedName!~SmiServices.IntegrationTests") + if args.unit_only + else () + ) + cmd = ( + "dotnet", + "dotnet-coverage", + "collect", + "--settings", + "coverage.settings", + "--", + "dotnet", + "test", + "-p:UseCurrentRuntimeIdentifier=True", + "-warnaserror", + "--configuration", + args.configuration, + "--no-build" if args.no_build else "", + *unit_only, + *filter, + ) + common.run(cmd) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/bin/smi/stopDockerLinux.py b/bin/smi/stopDockerLinux.py deleted file mode 100755 index de7ed1ca6..000000000 --- a/bin/smi/stopDockerLinux.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 - -import os -import platform -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -_PLATFORM = "-arm" if platform.processor() == "arm" else "" -_COMPOSE_FILE_NAME = f"linux-dotnet{_PLAT}.yml" -_COMPOSE_FILE_PATH = (C.PROJ_ROOT / "utils/docker-compose" / _COMPOSE_FILE_NAME).resolve() -assert _COMPOSE_FILE_PATH.is_file() - - -def main() -> int: - - parser = C.get_docker_parser() - args = parser.parse_args() - - docker = "docker" if not args.podman else "podman" - - cmd = ( - f"{docker}-compose", - "-f", _COMPOSE_FILE_PATH, - "down", - "--timeout", 0, - ) - C.run(cmd) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/smi/test.py b/bin/smi/test.py deleted file mode 100755 index 732889e57..000000000 --- a/bin/smi/test.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import glob -import json -import os -import platform -import shutil -import subprocess -import sys -from pathlib import Path -from typing import Optional -from typing import Sequence - -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C - -import build as DB -import dotnetCommon as DC -import downloadTessdata - - -def main(argv: Optional[Sequence[str]] = None) -> int: - - parser = argparse.ArgumentParser() - DC.add_args(parser) - parser.add_argument( - "--no-build", - action="store_true", - ) - parser.add_argument( - "--no-coverage", - action="store_true", - ) - group = parser.add_mutually_exclusive_group() - group.add_argument( - "--test", - nargs=1, - help="Run a specific test class", - ) - group.add_argument( - "--unit-only", - action="store_true", - help="Run unit tests only" - ) - args, _ = parser.parse_known_args(argv) - - rc = downloadTessdata.main([]) - if rc: - return rc - - if not args.no_build: - rc = DB.main(("--configuration", args.configuration)) - if rc: - return rc - - with open(C.PROJ_ROOT / "global.json") as f: - global_json = json.load(f) - sdk_version_major = global_json["sdk"]["version"].split(".")[0] - - netX_glob = { - Path(x) for x in - glob.glob(f"{C.PROJ_ROOT}/**/net{sdk_version_major}", recursive=True) - } - for build_dir in netX_glob: - try: - os.symlink( - Path(f"{C.PROJ_ROOT}/data/microserviceConfigs/default.yaml").resolve(), - build_dir / "default.yaml", - ) - except FileExistsError: - pass - - cov_dir = C.PROJ_ROOT / "coverage" - if not args.no_coverage: - if cov_dir.is_dir(): - shutil.rmtree(cov_dir) - - cmd = ("dotnet", "tool", "restore") - C.run(cmd) - - f = ("--filter", args.test[0]) if args.test else () - unit_only = ("--filter", "FullyQualifiedName!~SmiServices.IntegrationTests") if args.unit_only else () - cmd = ( - "dotnet", "dotnet-coverage", "collect", - "--settings", "coverage.settings", - "--", - "dotnet", "test", - "-p:UseCurrentRuntimeIdentifier=True", - "-warnaserror", - "--configuration", args.configuration, - "--no-build" if args.no_build else "", - *unit_only, - *f, - ) - C.run(cmd) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/bin/smi/writeDatabaseStrings.py b/bin/smi/writeDatabaseStrings.py index 6bcbce80a..e36047478 100755 --- a/bin/smi/writeDatabaseStrings.py +++ b/bin/smi/writeDatabaseStrings.py @@ -1,17 +1,20 @@ #!/usr/bin/env python3 - import argparse import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import common as C +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +import common # noqa: E402 -_RELATIONAL_YAML = (C.PROJ_ROOT / "tests/SmiServices.UnitTests/RelationalDatabases.yaml").resolve() -assert _RELATIONAL_YAML.is_file() +_RELATIONAL_YAML = ( + f"{common.PROJ_ROOT}/tests/SmiServices.UnitTests/RelationalDatabases.yaml" +) +assert os.path.isfile(_RELATIONAL_YAML), f"YAML file does not exist: {_RELATIONAL_YAML}" -_TEST_DBS_TXT = (C.PROJ_ROOT / "tests/SmiServices.UnitTests/TestDatabases.txt").resolve() -assert _TEST_DBS_TXT.is_file() +_TEST_DBS_TXT = f"{common.PROJ_ROOT}/tests/SmiServices.UnitTests/TestDatabases.txt" +assert os.path.isfile( + _TEST_DBS_TXT, +), f"Test databases file does not exist: {_TEST_DBS_TXT}" def main() -> int: @@ -31,11 +34,16 @@ def main() -> int: if "localdb" in args.mssql_server: f.write(f"SqlServer: 'Server={args.mssql_server};'\n") else: - f.write(f"SqlServer: 'Server={args.mssql_server};User Id=sa;Password={args.db_password};TrustServerCertificate=true;'\n") + f.write( + f"SqlServer: 'Server={args.mssql_server};User Id=sa;" + f"Password={args.db_password};TrustServerCertificate=true;'\n", + ) # NOTE(rkm 2022-02-27) We don't run MySQL in Windows in GitHub actions - if not (os.name == "nt" and C.is_ci()): - f.write(f"MySql: 'server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None'\n") + if not (os.name == "nt" and common.is_ci()): + f.write( + f"MySql: 'server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None'\n", + ) with open(_RELATIONAL_YAML) as f: print(f"{_RELATIONAL_YAML}:") @@ -46,8 +54,10 @@ def main() -> int: f.write("Prefix: TEST_\n") f.write("Username: sa\n") f.write(f"Password: {args.db_password}\n") - if not (os.name == "nt" and C.is_ci()): - f.write(f"MySql: server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None\n") + if not (os.name == "nt" and common.is_ci()): + f.write( + f"MySql: server=127.0.0.1;Uid=root;Pwd={args.db_password};sslmode=None\n", + ) with open(_TEST_DBS_TXT) as f: print(f"{_TEST_DBS_TXT}:") From 36aacb3675ebb5c9ad4be4be9a60e5282d5f1649 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 14:40:39 +0000 Subject: [PATCH 15/35] bump python version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f1e32710..d678c2ec1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ env: java-version: 11 java-distribution: temurin # python - python-version: 3.6 + python-version: 3.10 jobs: init: From 76b67d64feca8116ff9581b95d6fd455bc8870ba Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 14:47:47 +0000 Subject: [PATCH 16/35] bump image version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d678c2ec1..4f534705b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ env: jobs: init: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 outputs: matrix: ${{ steps.matrix.outputs.matrix }} build_ref: ${{ steps.build_ref.outputs.build_ref }} From 4cc8bdb52ebfbe9bf017798990b2ae631121affe Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 15:17:55 +0000 Subject: [PATCH 17/35] add explicit python version --- .github/workflows/codeql.yml | 6 ++++++ .github/workflows/main.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f6986c2eb..a06edf90a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -10,6 +10,9 @@ on: schedule: - cron: "0 5 * * *" +env: + python-version: 3.10 + jobs: analyze: name: Analyze @@ -23,6 +26,9 @@ jobs: matrix: language: ["csharp", "java", "python"] steps: + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.python-version }} - name: Checkout repository uses: actions/checkout@v4 - name: Initialize CodeQL diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f534705b..b052cdcbd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,9 @@ jobs: matrix: ${{ steps.matrix.outputs.matrix }} build_ref: ${{ steps.build_ref.outputs.build_ref }} steps: + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.python-version }} - name: checkout uses: actions/checkout@v4 - name: set matrix @@ -59,6 +62,9 @@ jobs: - name: "[linux] enable disk caching" if: ${{ matrix.os == 'linux' }} run: sudo apt-get install -y libeatmydata1 + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.python-version }} - name: checkout uses: actions/checkout@v4 - name: setup .NET From e5f23ac4fced366827550bda51934033c764a731 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 15:22:32 +0000 Subject: [PATCH 18/35] yaml... --- .github/workflows/codeql.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a06edf90a..13ee9fa7e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,7 +11,7 @@ on: - cron: "0 5 * * *" env: - python-version: 3.10 + python-version: "3.10" jobs: analyze: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b052cdcbd..8c78ef262 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ env: java-version: 11 java-distribution: temurin # python - python-version: 3.10 + python-version: "3.10" jobs: init: From 44c33716314be0fc1e4f87915abd796fb59f3021 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 15:46:25 +0000 Subject: [PATCH 19/35] fixup ctp package script --- bin/ctp/ctp_package.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/ctp/ctp_package.py b/bin/ctp/ctp_package.py index 7a2d1e66b..b1fb9bf37 100755 --- a/bin/ctp/ctp_package.py +++ b/bin/ctp/ctp_package.py @@ -42,19 +42,18 @@ def main(argv: Sequence[str] | None = None) -> int: ) common.run(cmd) - zips = { + zips = tuple( x for x in glob.glob( f"{common.PROJ_ROOT}/src/**/*deploy-distribution.zip", recursive=True, ) - } + ) assert 1 == len(zips), "Expected 1 zip file (CTP)" - for zip_path in zips: - shutil.copyfile( - zip_path, - f"{dist_tag_dir}/{zip_path.split('-')[0]}-{args.tag}.zip", - ) + shutil.copyfile( + zips[0], + f"{dist_tag_dir}/{os.path.basename(zips[0]).split('-')[0]}-{args.tag}.zip", + ) common.create_checksums(dist_tag_dir, "ctp") From 05ffb66e1eb7268c58f4987890f7124675a8fa0b Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 16:09:11 +0000 Subject: [PATCH 20/35] use setup-pyton for ctp build --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c78ef262..513f983b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,6 +132,9 @@ jobs: matrix: ${{ fromJson(needs.init.outputs.matrix) }} runs-on: ${{ matrix.image }} steps: + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.python-version }} - name: "[linux] enable disk caching" if: ${{ matrix.os == 'linux' }} run: sudo apt-get install -y libeatmydata1 From 96ed43faa9116c81d2345ed5b74b5525ca198b79 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 16:09:33 +0000 Subject: [PATCH 21/35] bump image version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 513f983b4..b69cb0a36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -164,7 +164,7 @@ jobs: upload-to-release: if: contains(github.ref, 'refs/tags/v') needs: [init, smi, ctp] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: "[linux] enable disk caching" run: sudo apt-get install -y libeatmydata1 From 83ce3f990c3267d234b5bbe171957a444679f986 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sat, 23 Nov 2024 16:23:40 +0000 Subject: [PATCH 22/35] add news file --- news/2022-meta.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2022-meta.md diff --git a/news/2022-meta.md b/news/2022-meta.md new file mode 100644 index 000000000..7ebc5d57a --- /dev/null +++ b/news/2022-meta.md @@ -0,0 +1 @@ +Add pre-commit python hooks & tidy helper scripts From 30ff8b4ecba5a34bba38a3019daa837e47ab6acd Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 12:51:11 +0000 Subject: [PATCH 23/35] centralise test logging setup into LoggingFixture --- .../Applications/ExtractImages/ExtractImagesHostTests.cs | 1 - .../Common/HeaderPreservationTest.cs | 1 - .../Common/Messaging/RabbitMQBrokerTests.cs | 1 - .../Common/MongoDB/MongoQueryParserTests.cs | 1 - tests/SmiServices.IntegrationTests/FixtureSetup.cs | 2 ++ .../FromCataloguesExtractionRequestFulfillerTests.cs | 1 - .../Microservices/CohortPackager/CohortPackagerHostTest.cs | 1 - .../Microservices/CohortPackager/ProgramTests.cs | 1 - .../Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs | 1 - .../DicomRelationalMapper/DicomRelationalMapperTests.cs | 1 - .../DicomRelationalMapper/MicroservicesIntegrationTest.cs | 3 --- .../Microservices/FileCopier/FileCopierHostTest.cs | 1 - .../Microservices/IdentifierMapper/IdentifierMapperTests.cs | 2 -- .../Microservices/IsIdentifiable/IsIdentifiableHostTests.cs | 1 - .../MongoDBPopulator/Processing/ImageMessageProcessorTests.cs | 2 -- .../MongoDBPopulator/Processing/MessageProcessorTests.cs | 2 -- .../Processing/SeriesMessageProcessorTests.cs | 2 -- .../DicomDirectoryProcessor/AccessionDirectoryListerTest.cs | 1 - .../DicomDirectoryProcessor/DicomDirectoryFinderTest.cs | 1 - .../DicomDirectoryProcessor/PacsDirectoryFinderTests.cs | 1 - .../DicomDirectoryProcessor/ZipDicomDirectoryFinderTests.cs | 1 - .../Applications/DynamicRulesTester/ProgramTests.cs | 1 - .../Applications/ExtractImages/CohortCsvParserTests.cs | 1 - .../ExtractImages/ExtractImagesCliOptionsTests.cs | 1 - .../ExtractImages/ExtractionMessageSenderTests.cs | 1 - tests/SmiServices.UnitTests/Common/EquTests.cs | 1 - tests/SmiServices.UnitTests/Common/LoggingTests.cs | 1 - .../Common/Messages/ExtractedFileStatusMessageTests.cs | 1 - .../Common/Messages/MessageHeaderTest.cs | 1 - .../Common/Messaging/ExponentialBackoffProviderTests.cs | 1 - .../Common/Messaging/ProducerModelTests.cs | 1 - .../Common/Messaging/StaticBackoffProviderTests.cs | 1 - tests/SmiServices.UnitTests/Common/Options/SmiCliInitTests.cs | 1 - tests/SmiServices.UnitTests/Common/TestClassTemplate.cs | 1 - tests/SmiServices.UnitTests/FixtureSetup.cs | 2 ++ .../{Common/TestLogger.cs => LoggerFixture.cs} | 4 ++-- .../RequestFulfillers/Dynamic/DynamicRejectorTests.cs | 1 - .../Execution/RequestFulfillers/QueryToExecuteResultTest.cs | 1 - .../Messaging/ExtractionRequestQueueConsumerTest.cs | 1 - .../CohortExtractor/NoSuffixProjectPathResolverTests.cs | 1 - .../StudySeriesOriginalFilenameProjectPathResolverTests.cs | 1 - .../CohortExtractor/StudySeriesSOPProjectPathResolverTests.cs | 1 - .../ExtractJobStorage/CompletedExtractJobInfoTest.cs | 1 - .../Execution/ExtractJobStorage/ExtractJobInfoTest.cs | 1 - .../Execution/ExtractJobStorage/ExtractJobStoreTest.cs | 1 - .../ExtractionIdentifierRejectionInfoTest.cs | 1 - .../Execution/ExtractJobStorage/FileAnonFailureInfoTest.cs | 1 - .../MongoDB/MongoExtractJobInfoExtensionsTest.cs | 1 - .../ExtractJobStorage/MongoDB/MongoExtractJobStoreTest.cs | 1 - .../MongoDB/ObjectModel/MongoCompletedExtractJobDocTest.cs | 1 - .../MongoDB/ObjectModel/MongoExpectedFilesDocTest.cs | 1 - .../MongoDB/ObjectModel/MongoExtractJobDocTest.cs | 1 - .../ObjectModel/MongoExtractionMessageHeaderDocTest.cs | 1 - .../MongoDB/ObjectModel/MongoFileStatusDocTest.cs | 1 - .../ExtractJobStorage/VerificationFailureInfoTest.cs | 1 - .../Execution/JobProcessing/ExtractJobWatcherTest.cs | 1 - .../JobProcessing/Notifying/JobCompleteNotifierFactoryTest.cs | 1 - .../Execution/JobProcessing/Reporting/JobReporterTests.cs | 1 - .../Messaging/AnonFailedMessageConsumerTests.cs | 1 - .../Messaging/AnonVerificationMessageConsumerTests.cs | 1 - .../Messaging/CohortPackagerControlMessageHandlerTests.cs | 1 - .../Messaging/ExtractFileCollectionMessageConsumerTests.cs | 1 - .../Messaging/ExtractionRequestInfoMessageConsumerTests.cs | 1 - .../DicomAnonymiser/Anonymisers/AnonymiserFactoryTests.cs | 1 - .../DicomAnonymiser/DicomAnonymiserConsumerTests.cs | 1 - .../Microservices/FileCopier/FileCopierTest.cs | 2 -- .../Microservices/FileCopier/FileCopyQueueConsumerTest.cs | 1 - .../IsIdentifiable/IsIdentifiableQueueConsumerTests.cs | 1 - .../Processing/ImageMessageProcessorTests_NoMongo.cs | 1 - tests/SmiServices.UnitTests/ProgramTests.cs | 1 - tests/SmiServices.UnitTests/ServiceVerbsTests.cs | 1 - 71 files changed, 6 insertions(+), 77 deletions(-) rename tests/SmiServices.UnitTests/{Common/TestLogger.cs => LoggerFixture.cs} (93%) diff --git a/tests/SmiServices.IntegrationTests/Applications/ExtractImages/ExtractImagesHostTests.cs b/tests/SmiServices.IntegrationTests/Applications/ExtractImages/ExtractImagesHostTests.cs index 12a92b3e1..7062896d6 100644 --- a/tests/SmiServices.IntegrationTests/Applications/ExtractImages/ExtractImagesHostTests.cs +++ b/tests/SmiServices.IntegrationTests/Applications/ExtractImages/ExtractImagesHostTests.cs @@ -23,7 +23,6 @@ public class ExtractImagesHostTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.IntegrationTests/Common/HeaderPreservationTest.cs b/tests/SmiServices.IntegrationTests/Common/HeaderPreservationTest.cs index 488070bdd..4961aa5da 100644 --- a/tests/SmiServices.IntegrationTests/Common/HeaderPreservationTest.cs +++ b/tests/SmiServices.IntegrationTests/Common/HeaderPreservationTest.cs @@ -15,7 +15,6 @@ public class HeaderPreservationTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs b/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs index 435e6a2bb..3e0d50792 100644 --- a/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs +++ b/tests/SmiServices.IntegrationTests/Common/Messaging/RabbitMQBrokerTests.cs @@ -32,7 +32,6 @@ public class RabbitMQBrokerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); _testOptions = new GlobalOptionsFactory().Load(nameof(RabbitMQBrokerTests)); _testProducerOptions = new ProducerOptions diff --git a/tests/SmiServices.IntegrationTests/Common/MongoDB/MongoQueryParserTests.cs b/tests/SmiServices.IntegrationTests/Common/MongoDB/MongoQueryParserTests.cs index d8f8996c4..bba6798e5 100644 --- a/tests/SmiServices.IntegrationTests/Common/MongoDB/MongoQueryParserTests.cs +++ b/tests/SmiServices.IntegrationTests/Common/MongoDB/MongoQueryParserTests.cs @@ -22,7 +22,6 @@ public class MongoQueryParserTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); GlobalOptions globalOptions = new GlobalOptionsFactory().Load(nameof(MongoQueryParserTests)); _mongoOptions = globalOptions.MongoDatabases!.DicomStoreOptions!; diff --git a/tests/SmiServices.IntegrationTests/FixtureSetup.cs b/tests/SmiServices.IntegrationTests/FixtureSetup.cs index 9bd482432..bfcaccf59 100644 --- a/tests/SmiServices.IntegrationTests/FixtureSetup.cs +++ b/tests/SmiServices.IntegrationTests/FixtureSetup.cs @@ -9,6 +9,8 @@ internal class FixtureSetup [OneTimeSetUp] public void OneTimeSetUp() { + UnitTests.LoggerFixture.Setup(); + MessageHeader.CurrentProgramName = nameof(IntegrationTests); } } diff --git a/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs b/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs index 714ae948d..ebba32ccd 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/CohortExtractor/FromCataloguesExtractionRequestFulfillerTests.cs @@ -30,7 +30,6 @@ protected override void SetUp() { base.SetUp(); - TestLogger.Setup(); } diff --git a/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/CohortPackagerHostTest.cs b/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/CohortPackagerHostTest.cs index 0ea1c9d12..5a45896bd 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/CohortPackagerHostTest.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/CohortPackagerHostTest.cs @@ -31,7 +31,6 @@ public class CohortPackagerHostTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/ProgramTests.cs b/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/ProgramTests.cs index ef31773fc..24de4579c 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/ProgramTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/CohortPackager/ProgramTests.cs @@ -25,7 +25,6 @@ internal class ProgramTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs index 59eaad551..ade5cf82e 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs @@ -34,7 +34,6 @@ public class DicomAnonymiserHostTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/DicomRelationalMapperTests.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/DicomRelationalMapperTests.cs index 7ff66365e..d938a7192 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/DicomRelationalMapperTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/DicomRelationalMapperTests.cs @@ -37,7 +37,6 @@ public void Setup() _helper = new DicomRelationalMapperTestHelper(); _helper.SetupSuite(db, RepositoryLocator, _globals, typeof(DicomDatasetCollectionSource)); - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs index 8d44a1897..a6c29912d 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomRelationalMapper/MicroservicesIntegrationTest.cs @@ -55,8 +55,6 @@ public class MicroservicesIntegrationTest : DatabaseTests private void SetupSuite(DiscoveredDatabase server, bool persistentRaw = false, string? modalityPrefix = null) { - TestLogger.Setup(); - _globals = new GlobalOptionsFactory().Load(nameof(MicroservicesIntegrationTest)); _globals.UseTestValues( @@ -422,7 +420,6 @@ public void IntegrationTest_BumpyRide(DatabaseType databaseType) } private void RunTest(DirectoryInfo dir, int numberOfExpectedRows, Action? adjustFileSystemOptions = null) { - TestLogger.Setup(); var logger = LogManager.GetLogger("MicroservicesIntegrationTest"); _globals.FileSystemOptions!.FileSystemRoot = TestContext.CurrentContext.TestDirectory; diff --git a/tests/SmiServices.IntegrationTests/Microservices/FileCopier/FileCopierHostTest.cs b/tests/SmiServices.IntegrationTests/Microservices/FileCopier/FileCopierHostTest.cs index a554d5ab2..0762a35a9 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/FileCopier/FileCopierHostTest.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/FileCopier/FileCopierHostTest.cs @@ -21,7 +21,6 @@ public class FileCopierHostTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.IntegrationTests/Microservices/IdentifierMapper/IdentifierMapperTests.cs b/tests/SmiServices.IntegrationTests/Microservices/IdentifierMapper/IdentifierMapperTests.cs index 63147c639..bb540a0bf 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/IdentifierMapper/IdentifierMapperTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/IdentifierMapper/IdentifierMapperTests.cs @@ -590,8 +590,6 @@ private static DicomFileMessage GetTestDicomFileMessage(Test testCase = Test.Nor [Test] public void TestIdentifierSwap_ControlQueueRefresh() { - TestLogger.Setup(); - var mockSwapper = new Mock(); diff --git a/tests/SmiServices.IntegrationTests/Microservices/IsIdentifiable/IsIdentifiableHostTests.cs b/tests/SmiServices.IntegrationTests/Microservices/IsIdentifiable/IsIdentifiableHostTests.cs index 31c23f5a9..6d8171ccc 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/IsIdentifiable/IsIdentifiableHostTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/IsIdentifiable/IsIdentifiableHostTests.cs @@ -15,7 +15,6 @@ public class IsIdentifiableHostTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } /// diff --git a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/ImageMessageProcessorTests.cs b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/ImageMessageProcessorTests.cs index d68f877ec..e9084ffd8 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/ImageMessageProcessorTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/ImageMessageProcessorTests.cs @@ -29,8 +29,6 @@ public class ImageMessageProcessorTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); - _helper = new MongoDbPopulatorTestHelper(); _helper.SetupSuite(); } diff --git a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/MessageProcessorTests.cs b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/MessageProcessorTests.cs index 44bcd8327..89329a7a4 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/MessageProcessorTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/MessageProcessorTests.cs @@ -20,8 +20,6 @@ public class MessageProcessorTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); - _helper = new MongoDbPopulatorTestHelper(); _helper.SetupSuite(); } diff --git a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/SeriesMessageProcessorTests.cs b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/SeriesMessageProcessorTests.cs index ddfd66947..b04c7f6f4 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/SeriesMessageProcessorTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/MongoDBPopulator/Processing/SeriesMessageProcessorTests.cs @@ -29,8 +29,6 @@ public class SeriesMessageProcessorTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); - _helper = new MongoDbPopulatorTestHelper(); _helper.SetupSuite(); } diff --git a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/AccessionDirectoryListerTest.cs b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/AccessionDirectoryListerTest.cs index 361c232dc..77c701e35 100644 --- a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/AccessionDirectoryListerTest.cs +++ b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/AccessionDirectoryListerTest.cs @@ -21,7 +21,6 @@ public class AccessionDirectoryListerTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } private static string GetListContent() diff --git a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/DicomDirectoryFinderTest.cs b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/DicomDirectoryFinderTest.cs index 2a3bb4cf2..76667bcf8 100644 --- a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/DicomDirectoryFinderTest.cs +++ b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/DicomDirectoryFinderTest.cs @@ -20,7 +20,6 @@ public class DicomDirectoryFinderTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/PacsDirectoryFinderTests.cs b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/PacsDirectoryFinderTests.cs index 71fccf083..d07d965e2 100644 --- a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/PacsDirectoryFinderTests.cs +++ b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/PacsDirectoryFinderTests.cs @@ -17,7 +17,6 @@ public class PacsDirectoryFinderTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/ZipDicomDirectoryFinderTests.cs b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/ZipDicomDirectoryFinderTests.cs index 35d3ebb01..831196bd2 100644 --- a/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/ZipDicomDirectoryFinderTests.cs +++ b/tests/SmiServices.UnitTests/Applications/DicomDirectoryProcessor/ZipDicomDirectoryFinderTests.cs @@ -20,7 +20,6 @@ public class ZipDicomDirectoryFinderTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Applications/DynamicRulesTester/ProgramTests.cs b/tests/SmiServices.UnitTests/Applications/DynamicRulesTester/ProgramTests.cs index e2975168e..0dbe04e06 100644 --- a/tests/SmiServices.UnitTests/Applications/DynamicRulesTester/ProgramTests.cs +++ b/tests/SmiServices.UnitTests/Applications/DynamicRulesTester/ProgramTests.cs @@ -20,7 +20,6 @@ public class ProgramTests public void OneTimeSetUp() { SmiCliInit.InitSmiLogging = false; - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Applications/ExtractImages/CohortCsvParserTests.cs b/tests/SmiServices.UnitTests/Applications/ExtractImages/CohortCsvParserTests.cs index b35826827..42481238d 100644 --- a/tests/SmiServices.UnitTests/Applications/ExtractImages/CohortCsvParserTests.cs +++ b/tests/SmiServices.UnitTests/Applications/ExtractImages/CohortCsvParserTests.cs @@ -16,7 +16,6 @@ public class CohortCsvParserTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractImagesCliOptionsTests.cs b/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractImagesCliOptionsTests.cs index 20e9b7f1c..65af19c4b 100644 --- a/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractImagesCliOptionsTests.cs +++ b/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractImagesCliOptionsTests.cs @@ -15,7 +15,6 @@ public class ExtractImagesCliOptionsTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractionMessageSenderTests.cs b/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractionMessageSenderTests.cs index 78c266fc5..c877edac8 100644 --- a/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractionMessageSenderTests.cs +++ b/tests/SmiServices.UnitTests/Applications/ExtractImages/ExtractionMessageSenderTests.cs @@ -24,7 +24,6 @@ public class ExtractionMessageSenderTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/EquTests.cs b/tests/SmiServices.UnitTests/Common/EquTests.cs index 82adb1592..3f3a5d680 100644 --- a/tests/SmiServices.UnitTests/Common/EquTests.cs +++ b/tests/SmiServices.UnitTests/Common/EquTests.cs @@ -12,7 +12,6 @@ public class EquTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/LoggingTests.cs b/tests/SmiServices.UnitTests/Common/LoggingTests.cs index 77cbea108..839c722d2 100644 --- a/tests/SmiServices.UnitTests/Common/LoggingTests.cs +++ b/tests/SmiServices.UnitTests/Common/LoggingTests.cs @@ -13,7 +13,6 @@ class LoggingTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/Messages/ExtractedFileStatusMessageTests.cs b/tests/SmiServices.UnitTests/Common/Messages/ExtractedFileStatusMessageTests.cs index ba45a00db..94e4ddd19 100644 --- a/tests/SmiServices.UnitTests/Common/Messages/ExtractedFileStatusMessageTests.cs +++ b/tests/SmiServices.UnitTests/Common/Messages/ExtractedFileStatusMessageTests.cs @@ -10,7 +10,6 @@ public class ExtractedFileStatusMessageTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/Messages/MessageHeaderTest.cs b/tests/SmiServices.UnitTests/Common/Messages/MessageHeaderTest.cs index d5d42240e..b7e04c2b8 100644 --- a/tests/SmiServices.UnitTests/Common/Messages/MessageHeaderTest.cs +++ b/tests/SmiServices.UnitTests/Common/Messages/MessageHeaderTest.cs @@ -23,7 +23,6 @@ public class MessageHeaderTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/Messaging/ExponentialBackoffProviderTests.cs b/tests/SmiServices.UnitTests/Common/Messaging/ExponentialBackoffProviderTests.cs index 3c2e978e6..9a7e70608 100644 --- a/tests/SmiServices.UnitTests/Common/Messaging/ExponentialBackoffProviderTests.cs +++ b/tests/SmiServices.UnitTests/Common/Messaging/ExponentialBackoffProviderTests.cs @@ -9,7 +9,6 @@ internal class ExponentialBackoffProviderTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Common/Messaging/ProducerModelTests.cs b/tests/SmiServices.UnitTests/Common/Messaging/ProducerModelTests.cs index 0d711e697..f551b2755 100644 --- a/tests/SmiServices.UnitTests/Common/Messaging/ProducerModelTests.cs +++ b/tests/SmiServices.UnitTests/Common/Messaging/ProducerModelTests.cs @@ -15,7 +15,6 @@ private class TestMessage : IMessage { } [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Common/Messaging/StaticBackoffProviderTests.cs b/tests/SmiServices.UnitTests/Common/Messaging/StaticBackoffProviderTests.cs index 6777fb183..656c21ba2 100644 --- a/tests/SmiServices.UnitTests/Common/Messaging/StaticBackoffProviderTests.cs +++ b/tests/SmiServices.UnitTests/Common/Messaging/StaticBackoffProviderTests.cs @@ -8,7 +8,6 @@ internal class StaticBackoffProviderTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [Test] diff --git a/tests/SmiServices.UnitTests/Common/Options/SmiCliInitTests.cs b/tests/SmiServices.UnitTests/Common/Options/SmiCliInitTests.cs index 753b1c568..b0409e873 100644 --- a/tests/SmiServices.UnitTests/Common/Options/SmiCliInitTests.cs +++ b/tests/SmiServices.UnitTests/Common/Options/SmiCliInitTests.cs @@ -13,7 +13,6 @@ public class SmiCliInitTests public void OneTimeSetUp() { SmiCliInit.InitSmiLogging = false; - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Common/TestClassTemplate.cs b/tests/SmiServices.UnitTests/Common/TestClassTemplate.cs index 152c32365..22ba6e2d3 100644 --- a/tests/SmiServices.UnitTests/Common/TestClassTemplate.cs +++ b/tests/SmiServices.UnitTests/Common/TestClassTemplate.cs @@ -20,7 +20,6 @@ public class TestClassTemplate [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/FixtureSetup.cs b/tests/SmiServices.UnitTests/FixtureSetup.cs index a45bbde5e..488fb52fb 100644 --- a/tests/SmiServices.UnitTests/FixtureSetup.cs +++ b/tests/SmiServices.UnitTests/FixtureSetup.cs @@ -9,6 +9,8 @@ internal class FixtureSetup [OneTimeSetUp] public void OneTimeSetUp() { + LoggerFixture.Setup(); + MessageHeader.CurrentProgramName = nameof(UnitTests); } } diff --git a/tests/SmiServices.UnitTests/Common/TestLogger.cs b/tests/SmiServices.UnitTests/LoggerFixture.cs similarity index 93% rename from tests/SmiServices.UnitTests/Common/TestLogger.cs rename to tests/SmiServices.UnitTests/LoggerFixture.cs index a5156bafa..3ae3d162c 100644 --- a/tests/SmiServices.UnitTests/Common/TestLogger.cs +++ b/tests/SmiServices.UnitTests/LoggerFixture.cs @@ -2,9 +2,9 @@ using NLog.Config; using NLog.Targets; -namespace SmiServices.UnitTests.Common +namespace SmiServices.UnitTests { - public static class TestLogger + public static class LoggerFixture { private const string TestLoggerName = "TestLogger"; diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/Dynamic/DynamicRejectorTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/Dynamic/DynamicRejectorTests.cs index 00e3d9588..beb9e6733 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/Dynamic/DynamicRejectorTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/Dynamic/DynamicRejectorTests.cs @@ -14,7 +14,6 @@ public class DynamicRejectorTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/QueryToExecuteResultTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/QueryToExecuteResultTest.cs index c510341d1..ddffd6caa 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/QueryToExecuteResultTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Execution/RequestFulfillers/QueryToExecuteResultTest.cs @@ -13,7 +13,6 @@ public class QueryToExecuteResultTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Messaging/ExtractionRequestQueueConsumerTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Messaging/ExtractionRequestQueueConsumerTest.cs index 32f208831..116f3651e 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Messaging/ExtractionRequestQueueConsumerTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/Messaging/ExtractionRequestQueueConsumerTest.cs @@ -27,7 +27,6 @@ public class ExtractionRequestQueueConsumerTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/NoSuffixProjectPathResolverTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/NoSuffixProjectPathResolverTests.cs index 1b002128b..3a646e1c9 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/NoSuffixProjectPathResolverTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/NoSuffixProjectPathResolverTests.cs @@ -15,7 +15,6 @@ public class NoSuffixProjectPathResolverTests [SetUp] public void SetUp() { - TestLogger.Setup(); _fileSystem = new MockFileSystem(); } diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesOriginalFilenameProjectPathResolverTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesOriginalFilenameProjectPathResolverTests.cs index dc6358665..400a675db 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesOriginalFilenameProjectPathResolverTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesOriginalFilenameProjectPathResolverTests.cs @@ -19,7 +19,6 @@ public class StudySeriesOriginalFilenameProjectPathResolverTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesSOPProjectPathResolverTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesSOPProjectPathResolverTests.cs index 8018abf9e..5338b1409 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesSOPProjectPathResolverTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortExtractor/StudySeriesSOPProjectPathResolverTests.cs @@ -19,7 +19,6 @@ public class StudySeriesSOPProjectPathResolverTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); _requestMessage = new ExtractionRequestMessage { diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/CompletedExtractJobInfoTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/CompletedExtractJobInfoTest.cs index 2df1dddb0..08f172828 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/CompletedExtractJobInfoTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/CompletedExtractJobInfoTest.cs @@ -14,7 +14,6 @@ public class CompletedExtractJobInfoTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobInfoTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobInfoTest.cs index 57f00cf4a..ec362b572 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobInfoTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobInfoTest.cs @@ -15,7 +15,6 @@ public class ExtractJobInfoTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobStoreTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobStoreTest.cs index af8db1b73..33c50da44 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobStoreTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractJobStoreTest.cs @@ -19,7 +19,6 @@ public class ExtractJobStoreTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractionIdentifierRejectionInfoTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractionIdentifierRejectionInfoTest.cs index 5f6b0dc6e..b87948f67 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractionIdentifierRejectionInfoTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/ExtractionIdentifierRejectionInfoTest.cs @@ -14,7 +14,6 @@ public class ExtractionIdentifierRejectionInfoTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/FileAnonFailureInfoTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/FileAnonFailureInfoTest.cs index aa3ab5f4c..621f2ea35 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/FileAnonFailureInfoTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/FileAnonFailureInfoTest.cs @@ -13,7 +13,6 @@ public class FileAnonFailureInfoTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobInfoExtensionsTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobInfoExtensionsTest.cs index 6b906e894..674d0398d 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobInfoExtensionsTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobInfoExtensionsTest.cs @@ -26,7 +26,6 @@ public class MongoExtractJobInfoExtensionsTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobStoreTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobStoreTest.cs index 14a91c73b..69d2a3bf6 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobStoreTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/MongoExtractJobStoreTest.cs @@ -31,7 +31,6 @@ public class MongoExtractJobStoreTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoCompletedExtractJobDocTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoCompletedExtractJobDocTest.cs index e24c0e4c7..655e19bf1 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoCompletedExtractJobDocTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoCompletedExtractJobDocTest.cs @@ -36,7 +36,6 @@ public class MongoCompletedExtractJobDocTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExpectedFilesDocTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExpectedFilesDocTest.cs index 82de5bec4..874f29828 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExpectedFilesDocTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExpectedFilesDocTest.cs @@ -28,7 +28,6 @@ public class MongoExpectedFilesDocTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractJobDocTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractJobDocTest.cs index 6d4a87ae5..5581308ba 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractJobDocTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractJobDocTest.cs @@ -28,7 +28,6 @@ public class MongoExtractJobDocTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractionMessageHeaderDocTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractionMessageHeaderDocTest.cs index 7d4cdc16f..c1146a06f 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractionMessageHeaderDocTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoExtractionMessageHeaderDocTest.cs @@ -16,7 +16,6 @@ public class MongoExtractionMessageHeaderDocTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoFileStatusDocTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoFileStatusDocTest.cs index eb86414cc..bd58d2761 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoFileStatusDocTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/MongoDB/ObjectModel/MongoFileStatusDocTest.cs @@ -26,7 +26,6 @@ public class MongoFileStatusDocTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/VerificationFailureInfoTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/VerificationFailureInfoTest.cs index 568c8cf75..17808af74 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/VerificationFailureInfoTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/ExtractJobStorage/VerificationFailureInfoTest.cs @@ -13,7 +13,6 @@ public class VerificationFailureInfoTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/ExtractJobWatcherTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/ExtractJobWatcherTest.cs index ebe266e91..94ab30018 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/ExtractJobWatcherTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/ExtractJobWatcherTest.cs @@ -19,7 +19,6 @@ public class ExtractJobWatcherTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Notifying/JobCompleteNotifierFactoryTest.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Notifying/JobCompleteNotifierFactoryTest.cs index b2d751569..7034fbd75 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Notifying/JobCompleteNotifierFactoryTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Notifying/JobCompleteNotifierFactoryTest.cs @@ -13,7 +13,6 @@ public class JobCompleteNotifierFactoryTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Reporting/JobReporterTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Reporting/JobReporterTests.cs index cdad138ed..450fa86d7 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Reporting/JobReporterTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Execution/JobProcessing/Reporting/JobReporterTests.cs @@ -27,7 +27,6 @@ public JobReporterTests(string newLine) [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonFailedMessageConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonFailedMessageConsumerTests.cs index d41c4c7df..87f283c5b 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonFailedMessageConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonFailedMessageConsumerTests.cs @@ -17,7 +17,6 @@ internal class AnonFailedMessageConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonVerificationMessageConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonVerificationMessageConsumerTests.cs index 766891e28..26fdbeee7 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonVerificationMessageConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/AnonVerificationMessageConsumerTests.cs @@ -25,7 +25,6 @@ internal class AnonVerificationMessageConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/CohortPackagerControlMessageHandlerTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/CohortPackagerControlMessageHandlerTests.cs index e2dbe2acd..296e765f2 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/CohortPackagerControlMessageHandlerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/CohortPackagerControlMessageHandlerTests.cs @@ -13,7 +13,6 @@ internal class CohortPackagerControlMessageHandlerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractFileCollectionMessageConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractFileCollectionMessageConsumerTests.cs index f588c0f93..983b6e1c3 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractFileCollectionMessageConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractFileCollectionMessageConsumerTests.cs @@ -17,7 +17,6 @@ internal class ExtractFileCollectionMessageConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractionRequestInfoMessageConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractionRequestInfoMessageConsumerTests.cs index b4238cd51..339a64fc4 100644 --- a/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractionRequestInfoMessageConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/CohortPackager/Messaging/ExtractionRequestInfoMessageConsumerTests.cs @@ -17,7 +17,6 @@ internal class ExtractionRequestInfoMessageConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/Anonymisers/AnonymiserFactoryTests.cs b/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/Anonymisers/AnonymiserFactoryTests.cs index 97f9f8633..2cef2ca5b 100644 --- a/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/Anonymisers/AnonymiserFactoryTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/Anonymisers/AnonymiserFactoryTests.cs @@ -13,7 +13,6 @@ public class AnonymiserFactoryTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/DicomAnonymiserConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/DicomAnonymiserConsumerTests.cs index e99dcac6e..d4e47a3da 100644 --- a/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/DicomAnonymiserConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/DicomAnonymiser/DicomAnonymiserConsumerTests.cs @@ -35,7 +35,6 @@ public class DicomAnonymiserConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopierTest.cs b/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopierTest.cs index a68141666..187748000 100644 --- a/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopierTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopierTest.cs @@ -27,8 +27,6 @@ public class FileCopierTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); - _options = new FileCopierOptions { NoVerifyRoutingKey = "noverify", diff --git a/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopyQueueConsumerTest.cs b/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopyQueueConsumerTest.cs index d1fd55d15..180d20e6a 100644 --- a/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopyQueueConsumerTest.cs +++ b/tests/SmiServices.UnitTests/Microservices/FileCopier/FileCopyQueueConsumerTest.cs @@ -22,7 +22,6 @@ public class FileCopyQueueConsumerTest [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/IsIdentifiable/IsIdentifiableQueueConsumerTests.cs b/tests/SmiServices.UnitTests/Microservices/IsIdentifiable/IsIdentifiableQueueConsumerTests.cs index 1cd693bf2..bb1ca7927 100644 --- a/tests/SmiServices.UnitTests/Microservices/IsIdentifiable/IsIdentifiableQueueConsumerTests.cs +++ b/tests/SmiServices.UnitTests/Microservices/IsIdentifiable/IsIdentifiableQueueConsumerTests.cs @@ -36,7 +36,6 @@ public class IsIdentifiableQueueConsumerTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/Microservices/MongoDbPopulator/Execution/Processing/ImageMessageProcessorTests_NoMongo.cs b/tests/SmiServices.UnitTests/Microservices/MongoDbPopulator/Execution/Processing/ImageMessageProcessorTests_NoMongo.cs index 38df8869e..db1b6c372 100644 --- a/tests/SmiServices.UnitTests/Microservices/MongoDbPopulator/Execution/Processing/ImageMessageProcessorTests_NoMongo.cs +++ b/tests/SmiServices.UnitTests/Microservices/MongoDbPopulator/Execution/Processing/ImageMessageProcessorTests_NoMongo.cs @@ -25,7 +25,6 @@ public class ImageMessageProcessorTests_NoMongo [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [SetUp] diff --git a/tests/SmiServices.UnitTests/ProgramTests.cs b/tests/SmiServices.UnitTests/ProgramTests.cs index 0b8b7aaf5..92719d30a 100644 --- a/tests/SmiServices.UnitTests/ProgramTests.cs +++ b/tests/SmiServices.UnitTests/ProgramTests.cs @@ -20,7 +20,6 @@ public class ProgramTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] diff --git a/tests/SmiServices.UnitTests/ServiceVerbsTests.cs b/tests/SmiServices.UnitTests/ServiceVerbsTests.cs index 8c28a775a..bdafd5157 100644 --- a/tests/SmiServices.UnitTests/ServiceVerbsTests.cs +++ b/tests/SmiServices.UnitTests/ServiceVerbsTests.cs @@ -22,7 +22,6 @@ public class ServiceVerbsTests [OneTimeSetUp] public void OneTimeSetUp() { - TestLogger.Setup(); } [OneTimeTearDown] From 3489779e875b3c0e930befa109f51940ca8814b7 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 13:03:07 +0000 Subject: [PATCH 24/35] add news file --- news/2023-change.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2023-change.md diff --git a/news/2023-change.md b/news/2023-change.md new file mode 100644 index 000000000..5c11b50f3 --- /dev/null +++ b/news/2023-change.md @@ -0,0 +1 @@ +Centralise test logging setup into LoggingFixture From 6bf1b88d169053a68cabe56969693db47aa5bbab Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 13:50:26 +0000 Subject: [PATCH 25/35] target net9.0 / C# 13.0 --- Directory.Build.props | 4 ++-- src/SmiServices/packages.lock.json | 22 ++++++++++--------- .../packages.lock.json | 22 ++++++++++--------- .../SmiServices.UnitTests/packages.lock.json | 22 ++++++++++--------- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a8307ca2c..5b477b855 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ false false false - 12.0 + 13.0 true enable true @@ -18,7 +18,7 @@ win-x64 none true - net8.0 + net9.0 true true diff --git a/src/SmiServices/packages.lock.json b/src/SmiServices/packages.lock.json index 93e9bf137..2469577bf 100644 --- a/src/SmiServices/packages.lock.json +++ b/src/SmiServices/packages.lock.json @@ -1,7 +1,7 @@ { "version": 2, "dependencies": { - "net8.0": { + "net9.0": { "CommandLineParser": { "type": "Direct", "requested": "[2.9.1, )", @@ -484,8 +484,7 @@ "resolved": "9.0.0", "contentHash": "g0UfujELzlLbHoVG8kPKVBaW470Ewi+jnptGS9KUi6jcb+k2StujtK3m26DFSGGwQ/+bVgZfsWqNzlP6YOejvw==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0", - "System.Diagnostics.DiagnosticSource": "9.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0" } }, "Microsoft.Extensions.Options": { @@ -736,8 +735,11 @@ }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", - "resolved": "9.0.0", - "contentHash": "ddppcFpnbohLWdYKr/ZeLZHmmI+DXFgZ3Snq+/E7SwcdW4UnvxmaugkwGywvGVWkHPGCSZjCP+MLzu23AL5SDw==" + "resolved": "6.0.1", + "contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } }, "System.Diagnostics.EventLog": { "type": "Transitive", @@ -1046,7 +1048,7 @@ } } }, - "net8.0/linux-x64": { + "net9.0/linux-x64": { "System.Private.Uri": { "type": "Direct", "requested": "[4.3.2, )", @@ -1220,7 +1222,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1545,7 +1547,7 @@ } } }, - "net8.0/osx-arm64": { + "net9.0/osx-arm64": { "System.Private.Uri": { "type": "Direct", "requested": "[4.3.2, )", @@ -1719,7 +1721,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -2044,7 +2046,7 @@ } } }, - "net8.0/win-x64": { + "net9.0/win-x64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", diff --git a/tests/SmiServices.IntegrationTests/packages.lock.json b/tests/SmiServices.IntegrationTests/packages.lock.json index 909e05624..d034330c1 100644 --- a/tests/SmiServices.IntegrationTests/packages.lock.json +++ b/tests/SmiServices.IntegrationTests/packages.lock.json @@ -1,7 +1,7 @@ { "version": 2, "dependencies": { - "net8.0": { + "net9.0": { "HIC.BadMedicine.Dicom": { "type": "Direct", "requested": "[0.1.1, )", @@ -349,8 +349,7 @@ "resolved": "9.0.0", "contentHash": "g0UfujELzlLbHoVG8kPKVBaW470Ewi+jnptGS9KUi6jcb+k2StujtK3m26DFSGGwQ/+bVgZfsWqNzlP6YOejvw==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0", - "System.Diagnostics.DiagnosticSource": "9.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0" } }, "Microsoft.Extensions.Options": { @@ -626,8 +625,11 @@ }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", - "resolved": "9.0.0", - "contentHash": "ddppcFpnbohLWdYKr/ZeLZHmmI+DXFgZ3Snq+/E7SwcdW4UnvxmaugkwGywvGVWkHPGCSZjCP+MLzu23AL5SDw==" + "resolved": "6.0.1", + "contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } }, "System.Diagnostics.EventLog": { "type": "Transitive", @@ -1211,7 +1213,7 @@ "contentHash": "iKVYog7JNiFOTr4gMHSjCqrGFD2NyABUHgSkRq9XR8A2+fsWepSWTpjHAOnKo1LVAHjy33o6I0u6lo5Ng0NtAw==" } }, - "net8.0/linux-x64": { + "net9.0/linux-x64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", @@ -1374,7 +1376,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1710,7 +1712,7 @@ } } }, - "net8.0/osx-arm64": { + "net9.0/osx-arm64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", @@ -1873,7 +1875,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -2209,7 +2211,7 @@ } } }, - "net8.0/win-x64": { + "net9.0/win-x64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", diff --git a/tests/SmiServices.UnitTests/packages.lock.json b/tests/SmiServices.UnitTests/packages.lock.json index f10661abe..aab36326b 100644 --- a/tests/SmiServices.UnitTests/packages.lock.json +++ b/tests/SmiServices.UnitTests/packages.lock.json @@ -1,7 +1,7 @@ { "version": 2, "dependencies": { - "net8.0": { + "net9.0": { "HIC.BadMedicine.Dicom": { "type": "Direct", "requested": "[0.1.1, )", @@ -349,8 +349,7 @@ "resolved": "9.0.0", "contentHash": "g0UfujELzlLbHoVG8kPKVBaW470Ewi+jnptGS9KUi6jcb+k2StujtK3m26DFSGGwQ/+bVgZfsWqNzlP6YOejvw==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0", - "System.Diagnostics.DiagnosticSource": "9.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0" } }, "Microsoft.Extensions.Options": { @@ -626,8 +625,11 @@ }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", - "resolved": "9.0.0", - "contentHash": "ddppcFpnbohLWdYKr/ZeLZHmmI+DXFgZ3Snq+/E7SwcdW4UnvxmaugkwGywvGVWkHPGCSZjCP+MLzu23AL5SDw==" + "resolved": "6.0.1", + "contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } }, "System.Diagnostics.EventLog": { "type": "Transitive", @@ -1196,7 +1198,7 @@ "contentHash": "iKVYog7JNiFOTr4gMHSjCqrGFD2NyABUHgSkRq9XR8A2+fsWepSWTpjHAOnKo1LVAHjy33o6I0u6lo5Ng0NtAw==" } }, - "net8.0/linux-x64": { + "net9.0/linux-x64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", @@ -1359,7 +1361,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1695,7 +1697,7 @@ } } }, - "net8.0/osx-arm64": { + "net9.0/osx-arm64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", @@ -1858,7 +1860,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" + "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -2194,7 +2196,7 @@ } } }, - "net8.0/win-x64": { + "net9.0/win-x64": { "Magick.NET-Q16-AnyCPU": { "type": "Transitive", "resolved": "13.9.1", From b139ff28094479b8dedfedef26e2ca45a8e1c0a4 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 13:51:52 +0000 Subject: [PATCH 26/35] add news file --- news/2024-feature.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2024-feature.md diff --git a/news/2024-feature.md b/news/2024-feature.md new file mode 100644 index 000000000..2f724b4ae --- /dev/null +++ b/news/2024-feature.md @@ -0,0 +1 @@ +Target net9.0 / C# 13.0 From 982c2fb7ca38bbe773ece6d15322a8614a503d05 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 14:04:21 +0000 Subject: [PATCH 27/35] regenerate lockfiles --- src/SmiServices/packages.lock.json | 4 ++-- tests/SmiServices.IntegrationTests/packages.lock.json | 4 ++-- tests/SmiServices.UnitTests/packages.lock.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SmiServices/packages.lock.json b/src/SmiServices/packages.lock.json index 2469577bf..ea551da2f 100644 --- a/src/SmiServices/packages.lock.json +++ b/src/SmiServices/packages.lock.json @@ -1222,7 +1222,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1721,7 +1721,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", diff --git a/tests/SmiServices.IntegrationTests/packages.lock.json b/tests/SmiServices.IntegrationTests/packages.lock.json index d034330c1..e9deb5474 100644 --- a/tests/SmiServices.IntegrationTests/packages.lock.json +++ b/tests/SmiServices.IntegrationTests/packages.lock.json @@ -1376,7 +1376,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1875,7 +1875,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", diff --git a/tests/SmiServices.UnitTests/packages.lock.json b/tests/SmiServices.UnitTests/packages.lock.json index aab36326b..06357c5ee 100644 --- a/tests/SmiServices.UnitTests/packages.lock.json +++ b/tests/SmiServices.UnitTests/packages.lock.json @@ -1361,7 +1361,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -1860,7 +1860,7 @@ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", - "contentHash": "T5NvFgmHX0WH4c7lP72krsnk+IJI10vJf2j2twGE+5QBRA4RyRAgD+ZjEgdmpLOjW4B+nZGaadewTCUcR899OQ==" + "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" }, "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", From 863bf24826a4974b085d2e5af715346f9637ae3a Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 14:24:15 +0000 Subject: [PATCH 28/35] add DisableImplicitNuGetFallbackFolder --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 5b477b855..97d32c4ed 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,6 +4,7 @@ false true full + true false false false From 60b6f24d5dca5dd931feed7c39a8957448343a25 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Sun, 24 Nov 2024 14:24:35 +0000 Subject: [PATCH 29/35] add news file --- news/2025-bugfix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2025-bugfix.md diff --git a/news/2025-bugfix.md b/news/2025-bugfix.md new file mode 100644 index 000000000..8ca7af847 --- /dev/null +++ b/news/2025-bugfix.md @@ -0,0 +1 @@ +Add `DisableImplicitNuGetFallbackFolder` to work around https://github.com/NuGet/Home/issues/7921 From c81e0950d0a6b742a8050cfb66c3e03e170569d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 03:07:12 +0000 Subject: [PATCH 30/35] Bump codecov/codecov-action from 5.0.4 to 5.0.7 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.4 to 5.0.7. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v5.0.4...v5.0.7) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b69cb0a36..c201a1b19 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,7 +107,7 @@ jobs: "$cov" - name: upload coverage to codecov if: ${{ matrix.os == 'linux' }} - uses: codecov/codecov-action@v5.0.4 + uses: codecov/codecov-action@v5.0.7 with: token: ${{ secrets.CODECOV_TOKEN }} directory: coverage/ From 328b4fc8fc213d9f4b974b33cf3e97644379b0cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 03:10:46 +0000 Subject: [PATCH 31/35] Bump YamlDotNet from 16.2.0 to 16.2.1 Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 16.2.0 to 16.2.1. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](https://github.com/aaubry/YamlDotNet/compare/v16.2.0...v16.2.1) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- src/SmiServices/packages.lock.json | 6 +++--- tests/SmiServices.IntegrationTests/packages.lock.json | 8 ++++---- tests/SmiServices.UnitTests/packages.lock.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index ceea54f3c..3a95ebc82 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -30,7 +30,7 @@ - + diff --git a/src/SmiServices/packages.lock.json b/src/SmiServices/packages.lock.json index ea551da2f..1576503d9 100644 --- a/src/SmiServices/packages.lock.json +++ b/src/SmiServices/packages.lock.json @@ -229,9 +229,9 @@ }, "YamlDotNet": { "type": "Direct", - "requested": "[16.2.0, )", - "resolved": "16.2.0", - "contentHash": "iKVYog7JNiFOTr4gMHSjCqrGFD2NyABUHgSkRq9XR8A2+fsWepSWTpjHAOnKo1LVAHjy33o6I0u6lo5Ng0NtAw==" + "requested": "[16.2.1, )", + "resolved": "16.2.1", + "contentHash": "im6zTVgesjcfTRfuMpnx51Rg2svWenp/3q5XBfcIzgj8PNIkkSD2xEl9HWcVi2SaJPP9XcXUdzed9gSDEuf1TA==" }, "AWSSDK.Core": { "type": "Transitive", diff --git a/tests/SmiServices.IntegrationTests/packages.lock.json b/tests/SmiServices.IntegrationTests/packages.lock.json index e9deb5474..aaee5e355 100644 --- a/tests/SmiServices.IntegrationTests/packages.lock.json +++ b/tests/SmiServices.IntegrationTests/packages.lock.json @@ -908,7 +908,7 @@ "StackExchange.Redis": "[2.8.16, )", "System.IO.Abstractions": "[21.1.3, )", "System.Private.Uri": "[4.3.2, )", - "YamlDotNet": "[16.2.0, )" + "YamlDotNet": "[16.2.1, )" } }, "smiservices.unittests": { @@ -1208,9 +1208,9 @@ }, "YamlDotNet": { "type": "CentralTransitive", - "requested": "[16.2.0, )", - "resolved": "16.2.0", - "contentHash": "iKVYog7JNiFOTr4gMHSjCqrGFD2NyABUHgSkRq9XR8A2+fsWepSWTpjHAOnKo1LVAHjy33o6I0u6lo5Ng0NtAw==" + "requested": "[16.2.1, )", + "resolved": "16.2.1", + "contentHash": "im6zTVgesjcfTRfuMpnx51Rg2svWenp/3q5XBfcIzgj8PNIkkSD2xEl9HWcVi2SaJPP9XcXUdzed9gSDEuf1TA==" } }, "net9.0/linux-x64": { diff --git a/tests/SmiServices.UnitTests/packages.lock.json b/tests/SmiServices.UnitTests/packages.lock.json index 06357c5ee..8e91e5860 100644 --- a/tests/SmiServices.UnitTests/packages.lock.json +++ b/tests/SmiServices.UnitTests/packages.lock.json @@ -908,7 +908,7 @@ "StackExchange.Redis": "[2.8.16, )", "System.IO.Abstractions": "[21.1.3, )", "System.Private.Uri": "[4.3.2, )", - "YamlDotNet": "[16.2.0, )" + "YamlDotNet": "[16.2.1, )" } }, "CommandLineParser": { @@ -1193,9 +1193,9 @@ }, "YamlDotNet": { "type": "CentralTransitive", - "requested": "[16.2.0, )", - "resolved": "16.2.0", - "contentHash": "iKVYog7JNiFOTr4gMHSjCqrGFD2NyABUHgSkRq9XR8A2+fsWepSWTpjHAOnKo1LVAHjy33o6I0u6lo5Ng0NtAw==" + "requested": "[16.2.1, )", + "resolved": "16.2.1", + "contentHash": "im6zTVgesjcfTRfuMpnx51Rg2svWenp/3q5XBfcIzgj8PNIkkSD2xEl9HWcVi2SaJPP9XcXUdzed9gSDEuf1TA==" } }, "net9.0/linux-x64": { From 080cb82aa25bc027dc4bc1dfaaecbd168ca6f250 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 03:44:11 +0000 Subject: [PATCH 32/35] Bump com.fasterxml.jackson.core:jackson-databind Bumps [com.fasterxml.jackson.core:jackson-databind](https://github.com/FasterXML/jackson) from 2.18.1 to 2.18.2. - [Commits](https://github.com/FasterXML/jackson/commits) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/common/com.smi.microservices.parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/com.smi.microservices.parent/pom.xml b/src/common/com.smi.microservices.parent/pom.xml index 3cd1a1e3d..8314e55bf 100644 --- a/src/common/com.smi.microservices.parent/pom.xml +++ b/src/common/com.smi.microservices.parent/pom.xml @@ -223,7 +223,7 @@ com.fasterxml.jackson.core jackson-databind - 2.18.1 + 2.18.2 From 9ec0e13aed8886c2142ed5ca2b945ff6d514fdb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 03:44:20 +0000 Subject: [PATCH 33/35] Bump com.fasterxml.jackson.dataformat:jackson-dataformat-yaml Bumps [com.fasterxml.jackson.dataformat:jackson-dataformat-yaml](https://github.com/FasterXML/jackson-dataformats-text) from 2.18.1 to 2.18.2. - [Commits](https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.18.1...jackson-dataformats-text-2.18.2) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/common/com.smi.microservices.parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/com.smi.microservices.parent/pom.xml b/src/common/com.smi.microservices.parent/pom.xml index 3cd1a1e3d..63c67323e 100644 --- a/src/common/com.smi.microservices.parent/pom.xml +++ b/src/common/com.smi.microservices.parent/pom.xml @@ -217,7 +217,7 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.18.1 + 2.18.2 From 75d290033cd0b7c42e36585ef81e1fcfc6722375 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:17:04 +0000 Subject: [PATCH 34/35] Bump StackExchange.Redis from 2.8.16 to 2.8.22 (#2029) --- Directory.Packages.props | 2 +- src/SmiServices/packages.lock.json | 6 +++--- tests/SmiServices.IntegrationTests/packages.lock.json | 8 ++++---- tests/SmiServices.UnitTests/packages.lock.json | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3a95ebc82..98ad946cd 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -25,7 +25,7 @@ - + diff --git a/src/SmiServices/packages.lock.json b/src/SmiServices/packages.lock.json index 1576503d9..dbdfbb687 100644 --- a/src/SmiServices/packages.lock.json +++ b/src/SmiServices/packages.lock.json @@ -199,9 +199,9 @@ }, "StackExchange.Redis": { "type": "Direct", - "requested": "[2.8.16, )", - "resolved": "2.8.16", - "contentHash": "WaoulkOqOC9jHepca3JZKFTqndCWab5uYS7qCzmiQDlrTkFaDN7eLSlEfHycBxipRnQY9ppZM7QSsWAwUEGblw==", + "requested": "[2.8.22, )", + "resolved": "2.8.22", + "contentHash": "GRA97f4cHYxBI/fKOfgs3GyKklc5is6YKM2yWbkiCZGR/JKsXIo0sRJSSeJabriJAZkKFthM0rXnULFfSbs0KA==", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "6.0.0", "Pipelines.Sockets.Unofficial": "2.2.8" diff --git a/tests/SmiServices.IntegrationTests/packages.lock.json b/tests/SmiServices.IntegrationTests/packages.lock.json index aaee5e355..1571b3446 100644 --- a/tests/SmiServices.IntegrationTests/packages.lock.json +++ b/tests/SmiServices.IntegrationTests/packages.lock.json @@ -905,7 +905,7 @@ "NLog": "[5.3.4, )", "Newtonsoft.Json": "[13.0.3, )", "RabbitMQ.Client": "[6.8.1, )", - "StackExchange.Redis": "[2.8.16, )", + "StackExchange.Redis": "[2.8.22, )", "System.IO.Abstractions": "[21.1.3, )", "System.Private.Uri": "[4.3.2, )", "YamlDotNet": "[16.2.1, )" @@ -1152,9 +1152,9 @@ }, "StackExchange.Redis": { "type": "CentralTransitive", - "requested": "[2.8.16, )", - "resolved": "2.8.16", - "contentHash": "WaoulkOqOC9jHepca3JZKFTqndCWab5uYS7qCzmiQDlrTkFaDN7eLSlEfHycBxipRnQY9ppZM7QSsWAwUEGblw==", + "requested": "[2.8.22, )", + "resolved": "2.8.22", + "contentHash": "GRA97f4cHYxBI/fKOfgs3GyKklc5is6YKM2yWbkiCZGR/JKsXIo0sRJSSeJabriJAZkKFthM0rXnULFfSbs0KA==", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "6.0.0", "Pipelines.Sockets.Unofficial": "2.2.8" diff --git a/tests/SmiServices.UnitTests/packages.lock.json b/tests/SmiServices.UnitTests/packages.lock.json index 8e91e5860..a2e0de5ba 100644 --- a/tests/SmiServices.UnitTests/packages.lock.json +++ b/tests/SmiServices.UnitTests/packages.lock.json @@ -905,7 +905,7 @@ "NLog": "[5.3.4, )", "Newtonsoft.Json": "[13.0.3, )", "RabbitMQ.Client": "[6.8.1, )", - "StackExchange.Redis": "[2.8.16, )", + "StackExchange.Redis": "[2.8.22, )", "System.IO.Abstractions": "[21.1.3, )", "System.Private.Uri": "[4.3.2, )", "YamlDotNet": "[16.2.1, )" @@ -1137,9 +1137,9 @@ }, "StackExchange.Redis": { "type": "CentralTransitive", - "requested": "[2.8.16, )", - "resolved": "2.8.16", - "contentHash": "WaoulkOqOC9jHepca3JZKFTqndCWab5uYS7qCzmiQDlrTkFaDN7eLSlEfHycBxipRnQY9ppZM7QSsWAwUEGblw==", + "requested": "[2.8.22, )", + "resolved": "2.8.22", + "contentHash": "GRA97f4cHYxBI/fKOfgs3GyKklc5is6YKM2yWbkiCZGR/JKsXIo0sRJSSeJabriJAZkKFthM0rXnULFfSbs0KA==", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "6.0.0", "Pipelines.Sockets.Unofficial": "2.2.8" From 70bd684b1c95cb96f3b93ae72fbdf94b4bb5ec99 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:19:59 +0000 Subject: [PATCH 35/35] Bump RabbitMQ.Client from 6.8.1 to 7.0.0 Bumps [RabbitMQ.Client](https://github.com/rabbitmq/rabbitmq-dotnet-client) from 6.8.1 to 7.0.0. - [Release notes](https://github.com/rabbitmq/rabbitmq-dotnet-client/releases) - [Changelog](https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/rabbitmq/rabbitmq-dotnet-client/compare/v6.8.1...v7.0.0) --- updated-dependencies: - dependency-name: RabbitMQ.Client dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- src/SmiServices/packages.lock.json | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 98ad946cd..3bfe2da8f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,7 +23,7 @@ - + diff --git a/src/SmiServices/packages.lock.json b/src/SmiServices/packages.lock.json index dbdfbb687..fa42b757f 100644 --- a/src/SmiServices/packages.lock.json +++ b/src/SmiServices/packages.lock.json @@ -189,12 +189,12 @@ }, "RabbitMQ.Client": { "type": "Direct", - "requested": "[6.8.1, )", - "resolved": "6.8.1", - "contentHash": "jNsmGgmCNw2S/NzskeN2ijtGywtH4Sk/G6jWUTD5sY9SrC27Xz6BsLIiB8hdsfjeyWCa4j4GvCIGkpE8wrjU1Q==", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "8YJz22mOSMtkbIVuVSz2HbJwbpKwRoXQ1uqbczDUt1w1Ds8dxFs6dkV/oZ8AlTmkErZjtQelHv+oBu52ud00WA==", "dependencies": { - "System.Memory": "4.5.5", - "System.Threading.Channels": "7.0.0" + "System.IO.Pipelines": "8.0.0", + "System.Threading.RateLimiting": "8.0.0" } }, "StackExchange.Redis": { @@ -795,8 +795,8 @@ }, "System.IO.Pipelines": { "type": "Transitive", - "resolved": "5.0.1", - "contentHash": "qEePWsaq9LoEEIqhbGe6D5J8c9IqQOUuTzzV6wn1POlfdLkJliZY3OlB0j0f17uMWlqZYjH7txj+2YbyrIA8Yg==" + "resolved": "8.0.0", + "contentHash": "FHNOatmUq0sqJOkTx+UF/9YK1f180cnW5FVqnQMvYUN0elp6wFzbtPSiqbo1/ru8ICp43JM1i7kKkk6GsNGHlA==" }, "System.Linq.Async": { "type": "Transitive", @@ -945,8 +945,13 @@ }, "System.Threading.Channels": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "qmeeYNROMsONF6ndEZcIQ+VxR4Q/TX/7uIVLJqtwIWL7dDWeh0l1UIqgo4wYyjG//5lUNhwkLDSFl+pAWO6oiA==" + "resolved": "6.0.0", + "contentHash": "TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==" + }, + "System.Threading.RateLimiting": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "7mu9v0QDv66ar3DpGSZHg9NuNcxDaaAcnMULuZlaTpP9+hwXhrxNGsF5GmLkSHxFdb5bBc1TzeujsRgTrPWi+Q==" }, "System.Threading.Tasks": { "type": "Transitive",