From 6a8f10463edf6b2aa4e3a925c52599a4e6e1ae96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Mon, 27 Nov 2023 09:51:45 +0100 Subject: [PATCH] Make assertCleanRegistry consistent with assertCleanFilesystem Behaviour is the same, this simply make the two functions look more similar. --- end-to-end/main_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/end-to-end/main_test.go b/end-to-end/main_test.go index a593ca8e2..2ddc47f38 100644 --- a/end-to-end/main_test.go +++ b/end-to-end/main_test.go @@ -315,6 +315,10 @@ func filesToCleanUp() ([]string, error) { // assertCleanRegistry returns error if registry key 'UbuntuPro' exists. // If safety checks are overridden, then the key is removed and no error is returned. func assertCleanRegistry() error { + if os.Getenv(overrideSafety) != "" { + return cleanupRegistry() + } + k, err := registry.OpenKey(registry.CURRENT_USER, registryPath, registry.READ) if errors.Is(err, registry.ErrNotExist) { // Key does not exist, as expected @@ -327,11 +331,6 @@ func assertCleanRegistry() error { k.Close() - // Key exists: this is probably running outside of a clean runner - if os.Getenv(overrideSafety) != "" { - return cleanupRegistry() - } - // Protect unsuspecting users return fmt.Errorf(`UbuntuPro registry key should not exist. Remove it from your machine `+ `to agree to run this potentially destructive test. It can be located at `+