From ad6ff81a51d0b5a7cc3783ebc9ae4f0a4dc87f75 Mon Sep 17 00:00:00 2001
From: Sujith Quintelier <sujith.quintelier@gmail.com>
Date: Fri, 11 Oct 2024 08:57:16 +0200
Subject: [PATCH] Refactor test file paths to use environment variable

---
 images/windows/scripts/tests/Helpers.psm1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/images/windows/scripts/tests/Helpers.psm1 b/images/windows/scripts/tests/Helpers.psm1
index 0f00198d85d5..d8168deeaa59 100644
--- a/images/windows/scripts/tests/Helpers.psm1
+++ b/images/windows/scripts/tests/Helpers.psm1
@@ -39,7 +39,7 @@ function Invoke-PesterTests {
         [string] $TestName
     )
 
-    $testPath = "C:\image\tests\${TestFile}.Tests.ps1"
+    $testPath = "$env:IMAGE_FOLDER\tests\${TestFile}.Tests.ps1"
     if (-not (Test-Path $testPath)) {
         throw "Unable to find test file '$TestFile' on '$testPath'."
     }
@@ -53,7 +53,7 @@ function Invoke-PesterTests {
     }
     if ($TestFile -eq "*") {
         $configuration.TestResult.Enabled = $true
-        $configuration.TestResult.OutputPath = "C:\image\tests\testResults.xml"
+        $configuration.TestResult.OutputPath = "$env:IMAGE_FOLDER\tests\testResults.xml"
     }
 
     # Update environment variables without reboot