fix: invalid label NoInteractive exit code
* add test * return validation error not nil from function Reviewed-on: https://gitea.com/gitea/act_runner/pulls/683 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de> (cherry picked from commit f0b5aff3bbeda469a682fe21144c16485ea2189a) Conflicts: internal/app/cmd/register_test.go trivial context conflict
This commit is contained in:
parent
fccf857bce
commit
67acfa9ce0
2 changed files with 12 additions and 1 deletions
|
|
@ -276,7 +276,7 @@ func registerNoInteractive(ctx context.Context, configFile string, regArgs *regi
|
|||
}
|
||||
if err := inputs.validate(); err != nil {
|
||||
log.WithError(err).Errorf("Invalid input, please re-run act command.")
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
if err := doRegister(ctx, cfg, inputs); err != nil {
|
||||
return fmt.Errorf("Failed to register runner: %w", err)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ package cmd
|
|||
import (
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCommaSplit(t *testing.T) {
|
||||
|
|
@ -29,3 +31,12 @@ func TestCommaSplit(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterNonInteractiveReturnsLabelValidationError(t *testing.T) {
|
||||
err := registerNoInteractive(t.Context(), "", ®isterArgs{
|
||||
Labels: "label:invalid",
|
||||
Token: "token",
|
||||
InstanceAddr: "http://localhost:3000",
|
||||
})
|
||||
assert.Error(t, err, "unsupported schema: invalid")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue