From 0a4f4106c9328d8ab1606d02874bc677f6ae05de Mon Sep 17 00:00:00 2001 From: Kevin Hobson Date: Thu, 10 Mar 2022 07:20:16 -0800 Subject: [PATCH 1/5] update to OC 1.2.2 --- .../Lombiq.Tests.UI.AppExtensions.csproj | 27 ++++++++++++++ .../Lombiq.Tests.UI.Shortcuts.csproj | 35 +++++++++++++++---- Lombiq.Tests.UI/Lombiq.Tests.UI.csproj | 27 ++++++++++++++ 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj b/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj index 31c224c8c..2c88c8ead 100644 --- a/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj +++ b/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj @@ -37,4 +37,31 @@ + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + diff --git a/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj b/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj index e341dd463..758334684 100644 --- a/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj +++ b/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj @@ -43,16 +43,39 @@ - - + + + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index b27c947e5..bd0088810 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -102,4 +102,31 @@ + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + all + runtime; build; native; contentfiles; analyzers + + + From a5ea4658a6d36d8a6a8088d851848e994cb2804e Mon Sep 17 00:00:00 2001 From: Szabolcs Deme Date: Thu, 10 Mar 2022 19:59:55 +0100 Subject: [PATCH 2/5] Revert "update to OC 1.2.2" This reverts commit 0a4f4106c9328d8ab1606d02874bc677f6ae05de. --- .../Lombiq.Tests.UI.AppExtensions.csproj | 27 -------------- .../Lombiq.Tests.UI.Shortcuts.csproj | 35 ++++--------------- Lombiq.Tests.UI/Lombiq.Tests.UI.csproj | 27 -------------- 3 files changed, 6 insertions(+), 83 deletions(-) diff --git a/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj b/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj index 2c88c8ead..31c224c8c 100644 --- a/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj +++ b/Lombiq.Tests.UI.AppExtensions/Lombiq.Tests.UI.AppExtensions.csproj @@ -37,31 +37,4 @@ - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj b/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj index 758334684..e341dd463 100644 --- a/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj +++ b/Lombiq.Tests.UI.Shortcuts/Lombiq.Tests.UI.Shortcuts.csproj @@ -43,39 +43,16 @@ - - + + - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - diff --git a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj index bd0088810..b27c947e5 100644 --- a/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj +++ b/Lombiq.Tests.UI/Lombiq.Tests.UI.csproj @@ -102,31 +102,4 @@ - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - From e0965684266855baf24f2517cf5e24530cc8a1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 14 Apr 2022 17:29:32 +0200 Subject: [PATCH 3/5] Fixing that the setup snapshot was loaded even if the given test didn't use a setup operation --- Lombiq.Tests.UI/Services/UITestExecutionSession.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Lombiq.Tests.UI/Services/UITestExecutionSession.cs b/Lombiq.Tests.UI/Services/UITestExecutionSession.cs index 4f81b4bc9..43d80c84b 100644 --- a/Lombiq.Tests.UI/Services/UITestExecutionSession.cs +++ b/Lombiq.Tests.UI/Services/UITestExecutionSession.cs @@ -39,6 +39,7 @@ internal sealed class UITestExecutionSession : IAsyncDisposable private SynchronizingWebApplicationSnapshotManager _currentSetupSnapshotManager; private string _snapshotDirectoryPath; + private bool _hasSetupOperation; private SqlServerManager _sqlServerManager; private SmtpService _smtpService; private AzureBlobStorageManager _azureBlobStorageManager; @@ -65,7 +66,7 @@ public async Task ExecuteAsync(int retryCount, string dumpRootPath) try { var setupConfiguration = _configuration.SetupConfiguration; - var hasSetupOperation = setupConfiguration.SetupOperation != null; + _hasSetupOperation = setupConfiguration.SetupOperation != null; var snapshotSubdirectory = "Default"; if (_configuration.UseSqlServer) @@ -81,7 +82,7 @@ public async Task ExecuteAsync(int retryCount, string dumpRootPath) _snapshotDirectoryPath = Path.Combine(setupConfiguration.SetupSnapshotDirectoryPath, snapshotSubdirectory); - if (hasSetupOperation) + if (_hasSetupOperation) { _configuration.OrchardCoreConfiguration.SnapshotDirectoryPath = _snapshotDirectoryPath; @@ -622,7 +623,10 @@ async Task SqlServerManagerBeforeAppStartHandlerAsync(string contentRootPath, Ar _dockerConfiguration?.ContainerSnapshotPath ?? _snapshotDirectoryPath; - if (!Directory.Exists(_dockerConfiguration?.HostSnapshotPath ?? snapshotDirectoryPath)) return; + if (!_hasSetupOperation || !Directory.Exists(_dockerConfiguration?.HostSnapshotPath ?? snapshotDirectoryPath)) + { + return; + } _sqlServerManager.RestoreSnapshot(snapshotDirectoryPath); @@ -669,7 +673,7 @@ async Task AzureBlobStorageManagerBeforeAppStartHandlerAsync(string contentRootP argumentsBuilder.Add("--OrchardCore:OrchardCore_Media_Azure:CreateContainer").Add("true"); argumentsBuilder.Add("--Lombiq_Tests_UI:UseAzureBlobStorage").Add("true"); - if (!Directory.Exists(_snapshotDirectoryPath)) return; + if (!_hasSetupOperation || !Directory.Exists(_snapshotDirectoryPath)) return; await _azureBlobStorageManager.RestoreSnapshotAsync(_snapshotDirectoryPath); } From ab6caff46a9faa0ec9b33c830190fd0266eedd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 14 Apr 2022 17:44:39 +0200 Subject: [PATCH 4/5] Adding the ability to use multiple setup operations with snapshots --- .../Services/UITestExecutionSession.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Lombiq.Tests.UI/Services/UITestExecutionSession.cs b/Lombiq.Tests.UI/Services/UITestExecutionSession.cs index 43d80c84b..28e1679f8 100644 --- a/Lombiq.Tests.UI/Services/UITestExecutionSession.cs +++ b/Lombiq.Tests.UI/Services/UITestExecutionSession.cs @@ -68,22 +68,24 @@ public async Task ExecuteAsync(int retryCount, string dumpRootPath) var setupConfiguration = _configuration.SetupConfiguration; _hasSetupOperation = setupConfiguration.SetupOperation != null; - var snapshotSubdirectory = "Default"; - if (_configuration.UseSqlServer) - { - snapshotSubdirectory = _configuration.UseAzureBlobStorage - ? "SqlServer-AzureBlob" - : "SqlServer"; - } - else if (_configuration.UseAzureBlobStorage) + if (_hasSetupOperation) { - snapshotSubdirectory = "AzureBlob"; - } + var snapshotSubdirectory = "Default"; + if (_configuration.UseSqlServer) + { + snapshotSubdirectory = _configuration.UseAzureBlobStorage + ? "SqlServer-AzureBlob" + : "SqlServer"; + } + else if (_configuration.UseAzureBlobStorage) + { + snapshotSubdirectory = "AzureBlob"; + } - _snapshotDirectoryPath = Path.Combine(setupConfiguration.SetupSnapshotDirectoryPath, snapshotSubdirectory); + snapshotSubdirectory += "-" + setupConfiguration.SetupOperation.GetHashCode().ToTechnicalString(); + + _snapshotDirectoryPath = Path.Combine(setupConfiguration.SetupSnapshotDirectoryPath, snapshotSubdirectory); - if (_hasSetupOperation) - { _configuration.OrchardCoreConfiguration.SnapshotDirectoryPath = _snapshotDirectoryPath; _currentSetupSnapshotManager = _setupSnapshotManagers.GetOrAdd( From ce0658156a32be8c1a928051dfc291a031857c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 14 Apr 2022 17:52:47 +0200 Subject: [PATCH 5/5] Putting setup snapshots under the Temp folder too --- Lombiq.Tests.UI/Services/OrchardCoreSetupConfiguration.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lombiq.Tests.UI/Services/OrchardCoreSetupConfiguration.cs b/Lombiq.Tests.UI/Services/OrchardCoreSetupConfiguration.cs index f90a28164..4da7a0bfb 100644 --- a/Lombiq.Tests.UI/Services/OrchardCoreSetupConfiguration.cs +++ b/Lombiq.Tests.UI/Services/OrchardCoreSetupConfiguration.cs @@ -1,5 +1,6 @@ using Lombiq.Tests.UI.Constants; using System; +using System.IO; using System.Threading.Tasks; namespace Lombiq.Tests.UI.Services; @@ -30,7 +31,8 @@ public class OrchardCoreSetupConfiguration /// public bool FastFailSetup { get; set; } = true; - public string SetupSnapshotDirectoryPath { get; set; } = DirectoryPaths.SetupSnapshot; + public string SetupSnapshotDirectoryPath { get; set; } = + Path.Combine(DirectoryPaths.Temp, DirectoryPaths.SetupSnapshot); public BeforeSetupHandler BeforeSetup { get; set; } }