agones.dev/agones@v1.53.0/pkg/testing/apihooks.go (about) 1 // Copyright 2023 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package testing 16 17 import ( 18 "agones.dev/agones/pkg/apis" 19 agonesv1 "agones.dev/agones/pkg/apis/agones/v1" 20 corev1 "k8s.io/api/core/v1" 21 "k8s.io/apimachinery/pkg/util/validation/field" 22 ) 23 24 // FakeAPIHooks is a no-op, fake implementation of APIHooks 25 type FakeAPIHooks struct { 26 } 27 28 var _ agonesv1.APIHooks = FakeAPIHooks{} 29 30 // ValidateGameServerSpec is called by GameServer.Validate to allow for product specific validation. 31 func (f FakeAPIHooks) ValidateGameServerSpec(_ *agonesv1.GameServerSpec, _ *field.Path) field.ErrorList { 32 return nil 33 } 34 35 // ValidateScheduling is called by Fleet and GameServerSet Validate() to allow for product specific validation of scheduling strategy. 36 func (f FakeAPIHooks) ValidateScheduling(_ apis.SchedulingStrategy, _ *field.Path) field.ErrorList { 37 return nil 38 } 39 40 // MutateGameServerPod is called by createGameServerPod to allow for product specific pod mutation. 41 func (f FakeAPIHooks) MutateGameServerPod(_ *agonesv1.GameServerSpec, _ *corev1.Pod) error { 42 return nil 43 } 44 45 // SetEviction is called by gs.Pod to enforce GameServer.Status.Eviction. 46 func (f FakeAPIHooks) SetEviction(_ *agonesv1.Eviction, _ *corev1.Pod) error { 47 return nil 48 }