1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/cmd/healthcheck_test.go
Carlos A Becker 68cd12b506
test: use ErrorIs
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-03 10:36:45 -03:00

33 lines
851 B
Go

package cmd
import (
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestHealthcheckSystem(t *testing.T) {
cmd := newHealthcheckCmd()
cmd.cmd.SetArgs([]string{"-f", "testdata/good.yml"})
require.NoError(t, cmd.cmd.Execute())
}
func TestHealthcheckConfigThatDoesNotExist(t *testing.T) {
cmd := newHealthcheckCmd()
cmd.cmd.SetArgs([]string{"-f", "testdata/nope.yml"})
require.ErrorIs(t, cmd.cmd.Execute(), os.ErrNotExist)
}
func TestHealthcheckMissingTool(t *testing.T) {
cmd := newHealthcheckCmd()
cmd.cmd.SetArgs([]string{"-f", "testdata/missing_tool.yml"})
require.EqualError(t, cmd.cmd.Execute(), "one or more needed tools are not present")
}
func TestHealthcheckQuier(t *testing.T) {
cmd := newHealthcheckCmd()
cmd.cmd.SetArgs([]string{"-f", "testdata/good.yml", "--quiet"})
require.NoError(t, cmd.cmd.Execute())
}