mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	Linting and updating tests
This commit is contained in:
		
							parent
							
								
									7bf2a91dd0
								
							
						
					
					
						commit
						daa75da277
					
				
							
								
								
									
										10
									
								
								app_test.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								app_test.go
									
									
									
									
									
								
							| @ -69,9 +69,8 @@ func (s *Suite) ResetDB(c *check.C) { | ||||
| // Enusre an error is returned when an invalid auth mode
 | ||||
| // is supplied.
 | ||||
| func (s *Suite) TestInvalidClientAuthMode(c *check.C) { | ||||
| 	app.cfg.TLSClientAuthMode = "invalid" | ||||
| 	_, err := app.GetClientAuthMode() | ||||
| 	c.Assert(err, check.NotNil) | ||||
| 	_, isValid := LookupTLSClientAuthMode("invalid") | ||||
| 	c.Assert(isValid, check.Equals, false) | ||||
| } | ||||
| 
 | ||||
| // Ensure that all client auth modes return a nil error.
 | ||||
| @ -79,8 +78,7 @@ func (s *Suite) TestAuthModes(c *check.C) { | ||||
| 	modes := []string{"disabled", "relaxed", "enforced"} | ||||
| 
 | ||||
| 	for _, v := range modes { | ||||
| 		app.cfg.TLSClientAuthMode = v | ||||
| 		_, err := app.GetClientAuthMode() | ||||
| 		c.Assert(err, check.IsNil) | ||||
| 		_, isValid := LookupTLSClientAuthMode(v) | ||||
| 		c.Assert(isValid, check.Equals, true) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -34,7 +34,6 @@ const ( | ||||
| ) | ||||
| 
 | ||||
| func LoadConfig(path string) error { | ||||
| 
 | ||||
| 	viper.SetConfigName("config") | ||||
| 	if path == "" { | ||||
| 		viper.AddConfigPath("/etc/headscale/") | ||||
| @ -295,7 +294,9 @@ func getHeadscaleConfig() headscale.Config { | ||||
| 			Msgf("'ip_prefixes' not configured, falling back to default: %v", prefixes) | ||||
| 	} | ||||
| 
 | ||||
|     tlsClientAuthMode, _ := headscale.LookupTLSClientAuthMode(viper.GetString("tls_client_auth_mode")) | ||||
| 	tlsClientAuthMode, _ := headscale.LookupTLSClientAuthMode( | ||||
| 		viper.GetString("tls_client_auth_mode"), | ||||
| 	) | ||||
| 
 | ||||
| 	return headscale.Config{ | ||||
| 		ServerURL:         viper.GetString("server_url"), | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user