test(mcp): refactor helm toolset tests (#333)

Refactor tests to new approach before adding more functionality.

Signed-off-by: Marc Nuri <marc@marcnuri.com>
This commit is contained in:
Marc Nuri
2025-09-18 16:08:53 +02:00
committed by GitHub
parent 76e22321f5
commit 8af889bc8f
5 changed files with 236 additions and 226 deletions

View File

@@ -1,8 +1,21 @@
package test
import (
"os"
"path/filepath"
"runtime"
)
func Must[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
func ReadFile(path ...string) string {
_, file, _, _ := runtime.Caller(1)
filePath := filepath.Join(append([]string{filepath.Dir(file)}, path...)...)
fileBytes := Must(os.ReadFile(filePath))
return string(fileBytes)
}