mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-10-31 04:06:37 +08:00 
			
		
		
		
	 78640f1342
			
		
	
	78640f1342
	
	
	
		
			
			* model changes * additional fields for extclient create * add DNS to extclient config * extclient name checks * update extclient * nmctl extclient * final tweaks * review comments * add extclientdns to node on ingress creation * fix to add ingress dns to api (#2296) --------- Co-authored-by: Aceix <aceixsmartX@gmail.com>
		
			
				
	
	
		
			52 lines
		
	
	
		
			807 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			807 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package controller
 | |
| 
 | |
| import "testing"
 | |
| 
 | |
| // TestValidName tests the validName function
 | |
| func TestValidName(t *testing.T) {
 | |
| 	type args struct {
 | |
| 		Name string
 | |
| 	}
 | |
| 	tests := []struct {
 | |
| 		Name string
 | |
| 		Args args
 | |
| 		Want bool
 | |
| 	}{
 | |
| 		{
 | |
| 			Name: "validName",
 | |
| 			Args: args{
 | |
| 				Name: "TestvalidName",
 | |
| 			},
 | |
| 			Want: true,
 | |
| 		},
 | |
| 		{
 | |
| 			Name: "invalidName",
 | |
| 			Args: args{
 | |
| 				Name: "Test*Name",
 | |
| 			},
 | |
| 			Want: false,
 | |
| 		},
 | |
| 		{
 | |
| 			Name: "nametoolong",
 | |
| 			Args: args{
 | |
| 				Name: "TestvalidNameTestvalidName",
 | |
| 			},
 | |
| 			Want: false,
 | |
| 		},
 | |
| 		{
 | |
| 			Name: "maxlength",
 | |
| 			Args: args{
 | |
| 				Name: "123456789012345",
 | |
| 			},
 | |
| 			Want: true,
 | |
| 		},
 | |
| 	}
 | |
| 	for _, tt := range tests {
 | |
| 		t.Run(tt.Name, func(t *testing.T) {
 | |
| 			if got := validName(tt.Args.Name); got != tt.Want {
 | |
| 				t.Errorf("validName() = %v, want %v", got, tt.Want)
 | |
| 			}
 | |
| 		})
 | |
| 	}
 | |
| }
 |