mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
test: fixed hooks tests
refs #2875 refs f585f3be698ae1d3b86895a6f082518483283d94 Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
f585f3be69
commit
efdc4d0f48
@ -206,14 +206,14 @@ func TestRunPipeFailingHooks(t *testing.T) {
|
||||
ctx.Git.CurrentTag = "2.3.4"
|
||||
ctx.Config.Builds[0].Hooks.Pre = []config.Hook{{Cmd: "exit 1"}}
|
||||
ctx.Config.Builds[0].Hooks.Post = []config.Hook{{Cmd: "echo post"}}
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `pre hook failed: "": exec: "exit": executable file not found in $PATH`)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "pre hook failed: failed to run 'exit 1': exec: \"exit\": executable file not found in $PATH")
|
||||
})
|
||||
t.Run("post-hook", func(t *testing.T) {
|
||||
ctx := context.New(cfg)
|
||||
ctx.Git.CurrentTag = "2.3.4"
|
||||
ctx.Config.Builds[0].Hooks.Pre = []config.Hook{{Cmd: "echo pre"}}
|
||||
ctx.Config.Builds[0].Hooks.Post = []config.Hook{{Cmd: "exit 1"}}
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `post hook failed: "": exec: "exit": executable file not found in $PATH`)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `post hook failed: failed to run 'exit 1': exec: "exit": executable file not found in $PATH`)
|
||||
})
|
||||
}
|
||||
|
||||
@ -681,6 +681,6 @@ func TestRunHookFailWithLogs(t *testing.T) {
|
||||
}
|
||||
ctx := context.New(config)
|
||||
ctx.Git.CurrentTag = "2.4.5"
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "pre hook failed: \"foo\\n\": exit status 1")
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "pre hook failed: failed to run 'sh -c echo foo; exit 1': exit status 1")
|
||||
require.Empty(t, ctx.Artifacts.List())
|
||||
}
|
||||
|
@ -274,14 +274,14 @@ func TestRun(t *testing.T) {
|
||||
ctx := ctx5
|
||||
ctx.Config.UniversalBinaries[0].Hooks.Pre = []config.Hook{{Cmd: "exit 1"}}
|
||||
ctx.Config.UniversalBinaries[0].Hooks.Post = []config.Hook{{Cmd: "echo post"}}
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `pre hook failed: "": exec: "exit": executable file not found in $PATH`)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "pre hook failed: failed to run 'exit 1': exec: \"exit\": executable file not found in $PATH")
|
||||
})
|
||||
|
||||
t.Run("failing post-hook", func(t *testing.T) {
|
||||
ctx := ctx5
|
||||
ctx.Config.UniversalBinaries[0].Hooks.Pre = []config.Hook{{Cmd: "echo pre"}}
|
||||
ctx.Config.UniversalBinaries[0].Hooks.Post = []config.Hook{{Cmd: "exit 1"}}
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `post hook failed: "": exec: "exit": executable file not found in $PATH`)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), "post hook failed: failed to run 'exit 1': exec: \"exit\": executable file not found in $PATH")
|
||||
})
|
||||
|
||||
t.Run("hook with env tmpl", func(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user