mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 02:08:13 +00:00 
			
		
		
		
	Merge pull request #40844 from k82cn/admin_deny
Automatic merge from submit-queue Improve the code coverage of /plugin/pkg/admission/deny part of #39559 refer to attachment for the coverage report: [combined-coverage.html.gz](https://github.com/kubernetes/kubernetes/files/746779/combined-coverage.html.gz)
This commit is contained in:
		| @@ -27,6 +27,17 @@ func TestAdmission(t *testing.T) { | ||||
| 	handler := NewAlwaysDeny() | ||||
| 	err := handler.Admit(admission.NewAttributesRecord(nil, nil, api.Kind("kind").WithVersion("version"), "namespace", "name", api.Resource("resource").WithVersion("version"), "subresource", admission.Create, nil)) | ||||
| 	if err == nil { | ||||
| 		t.Errorf("Expected error returned from admission handler") | ||||
| 		t.Error("Expected error returned from admission handler") | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func TestHandles(t *testing.T) { | ||||
| 	handler := NewAlwaysDeny() | ||||
| 	tests := []admission.Operation{admission.Create, admission.Connect, admission.Update, admission.Delete} | ||||
|  | ||||
| 	for _, test := range tests { | ||||
| 		if !handler.Handles(test) { | ||||
| 			t.Errorf("Expected handling all operations, including: %v", test) | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue