You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: admission_test.go
    path of file: ./repos/kubernetes/plugin/pkg/admission/priority
    
    the code of the file until where you have to start completion: /*
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package priority

import (
	"context"
	"testing"

	"k8s.io/klog/v2"

	schedulingv1 "k8s.io/api/scheduling/v1"
	metav1
    
func TestPriorityClassAdmission(t *testing.T) {
	var systemClass = &scheduling.PriorityClass{
		TypeMeta: metav1.TypeMeta{
			Kind: "PriorityClass",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name: scheduling.SystemPriorityClassPrefix + "test",
		},
		Value:       scheduling.HighestUserDefinablePriority + 1,
		Description: "Name has system critical prefix",
	}

	tests := []struct {
		name            string
		existingClasses []*scheduling.PriorityClass
		newClass        *scheduling.PriorityClass
		userInfo        user.Info
		operation       admission.Operation
		expectError     bool
	}{
		{
			"create operator with default class",
			[]*scheduling.PriorityClass{},
			defaultClass1,
			nil,
			admission.Create,
			false,
		},
		{
			"create operator with one existing default class",
			[]*scheduling.PriorityClass{defaultClass1},
			defaultClass2,
			nil,
			admission.Create,
			true,
		},
		{
			"create operator with system name and value allowed by admission controller",
			[]*scheduling.PriorityClass{},
			systemClass,
			&user.DefaultInfo{
				Name: user.APIServerUser,
			},
			admission.Create,
			false,
		},
		{
			"update operator with default class",
			[]*scheduling.PriorityClass{},
			defaultClass1,
			nil,
			admission.Update,
			false,
		},
		{
			"update operator with one existing default class",
			[]*scheduling.PriorityClass{defaultClass1},
			defaultClass2,
			nil,
			admission.Update,
			true,
		},
		{
			"update operator with system name and value allowed by admission controller",
			[]*scheduling.PriorityClass{},
			systemClass,
			&user.DefaultInfo{
				Name: user.APIServerUser,
			},
			admission.Update,
			false,
		},
		{
			"update operator with different default classes",
			[]*scheduling.PriorityClass{defaultClass1},
			defaultClass2,
			nil,
			admission.Update,
			true,
		},
		{
			"delete operation with default class",
			[]*scheduling.PriorityClass{},
			defaultClass1,
			nil,
			admission.Delete,
			false,
		},
	}

	for _, test := range tests {
		klog.V(4).Infof("starting test %q", test.name)

		ctrl := NewPlugin()
		// Add existing priority classes.
		if err := addPriorityClasses(ctrl, test.existingClasses); err != nil {
			t.Errorf("Test %q: unable to add object to informer: %v", test.name, err)
		}
		// Now add the new class.
		attrs := admission.NewAttributesRecord(
			test.newClass,
			nil,
			scheduling.Kind("PriorityClass").WithVersion("version"),
			"",
			"",
			scheduling.Resource("priorityclasses").WithVersion("version"),
			"",
			test.operation,
			&metav1.CreateOptions{},
			false,
			test.userInfo,
		)
		err := ctrl.Validate(context.TODO(), attrs, nil)
		klog.Infof("Got %v", err)
		if err != nil && !test.expectError {
			t.Errorf("Test %q: unexpected error received: %v", test.name, err)
		}
		if err == nil && test.expectError {
			t.Errorf("Test %q: expected error and no error recevied", test.name)
		}
	}
}