From ca4b0972fc57d8543d51e08bceaef4a4e4b0de38 Mon Sep 17 00:00:00 2001 From: lauk Date: Sat, 14 Sep 2024 16:48:58 +0800 Subject: [PATCH] Increase the coverage of test cases for the hookconfig file --- pkg/configmanager/asset/hookconfig_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/configmanager/asset/hookconfig_test.go b/pkg/configmanager/asset/hookconfig_test.go index 24d715c..9ca3e22 100644 --- a/pkg/configmanager/asset/hookconfig_test.go +++ b/pkg/configmanager/asset/hookconfig_test.go @@ -21,7 +21,7 @@ func TestHookconfig(t *testing.T) { hookconfig := &HookConf{ PreHookScript: "../../../hack/build.sh", - PostHookYaml: "", + PostHookYaml: "../../../hack/build.sh", ShellFiles: []ShellFile{ { Name: "test.sh", @@ -40,8 +40,8 @@ func TestHookconfig(t *testing.T) { }) //测试脚本格式 - t.Run("GetCmdHooks PreHookScript Fail", func(t *testing.T) { - hookconfig.PreHookScript = "./" + t.Run("GetCmdHooks PreHookScript", func(t *testing.T) { + hookconfig.PreHookScript = "../../../hack" err := GetCmdHooks(hookconfig) if err == nil { t.Log("Expected error, got nil") @@ -49,8 +49,8 @@ func TestHookconfig(t *testing.T) { }) //测试yaml格式 - t.Run("GetCmdHooks PostHookYaml Fail", func(t *testing.T) { - hookconfig.PostHookYaml = "test.sh" + t.Run("GetCmdHooks PostHookYaml", func(t *testing.T) { + hookconfig.PostHookYaml = "../../" err := GetCmdHooks(hookconfig) if err == nil { t.Log("Expected error, got nil") -- Gitee