mirror of
				https://gitea.com/gitea/act_runner.git
				synced 2025-10-31 21:07:57 +01:00 
			
		
		
		
	fix: invalid label NoInteractive exit code (#683)
* add test * return validation error not nil from function Closes #665 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>
This commit is contained in:
		
				
					committed by
					
						 techknowlogick
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							44b4736703
						
					
				
				
					commit
					f0b5aff3bb
				
			| @@ -281,7 +281,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) | ||||
|   | ||||
							
								
								
									
										19
									
								
								internal/app/cmd/register_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								internal/app/cmd/register_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| // Copyright 2025 The Gitea Authors. All rights reserved. | ||||
| // SPDX-License-Identifier: MIT | ||||
|  | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"gotest.tools/v3/assert" | ||||
| ) | ||||
|  | ||||
| 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") | ||||
| } | ||||
		Reference in New Issue
	
	Block a user