mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Fix flaky test TestPreemptWithPermitPlugin
This commit is contained in:
parent
890b50f98b
commit
d0d46fdc7b
@ -419,8 +419,6 @@ func NewUnreservePlugin(_ *runtime.Unknown, _ framework.FrameworkHandle) (framew
|
|||||||
return unresPlugin, nil
|
return unresPlugin, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var perPlugin = &PermitPlugin{}
|
|
||||||
|
|
||||||
// Name returns name of the plugin.
|
// Name returns name of the plugin.
|
||||||
func (pp *PermitPlugin) Name() string {
|
func (pp *PermitPlugin) Name() string {
|
||||||
return permitPluginName
|
return permitPluginName
|
||||||
@ -476,10 +474,12 @@ func (pp *PermitPlugin) reset() {
|
|||||||
pp.allowPermit = false
|
pp.allowPermit = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPermitPlugin is the factory for permit plugin.
|
// NewPermitPlugin returns a factory for permit plugin with specified PermitPlugin.
|
||||||
func NewPermitPlugin(_ *runtime.Unknown, fh framework.FrameworkHandle) (framework.Plugin, error) {
|
func NewPermitPlugin(permitPlugin *PermitPlugin) framework.PluginFactory {
|
||||||
perPlugin.fh = fh
|
return func(_ *runtime.Unknown, fh framework.FrameworkHandle) (framework.Plugin, error) {
|
||||||
return perPlugin, nil
|
permitPlugin.fh = fh
|
||||||
|
return permitPlugin, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPrefilterPlugin tests invocation of prefilter plugins.
|
// TestPrefilterPlugin tests invocation of prefilter plugins.
|
||||||
@ -1221,7 +1221,8 @@ func TestPostbindPlugin(t *testing.T) {
|
|||||||
// TestPermitPlugin tests invocation of permit plugins.
|
// TestPermitPlugin tests invocation of permit plugins.
|
||||||
func TestPermitPlugin(t *testing.T) {
|
func TestPermitPlugin(t *testing.T) {
|
||||||
// Create a plugin registry for testing. Register only a permit plugin.
|
// Create a plugin registry for testing. Register only a permit plugin.
|
||||||
registry := framework.Registry{permitPluginName: NewPermitPlugin}
|
perPlugin := &PermitPlugin{}
|
||||||
|
registry := framework.Registry{permitPluginName: NewPermitPlugin(perPlugin)}
|
||||||
|
|
||||||
// Setup initial permit plugin for testing.
|
// Setup initial permit plugin for testing.
|
||||||
plugins := &schedulerconfig.Plugins{
|
plugins := &schedulerconfig.Plugins{
|
||||||
@ -1332,7 +1333,8 @@ func TestPermitPlugin(t *testing.T) {
|
|||||||
// TestCoSchedulingWithPermitPlugin tests invocation of permit plugins.
|
// TestCoSchedulingWithPermitPlugin tests invocation of permit plugins.
|
||||||
func TestCoSchedulingWithPermitPlugin(t *testing.T) {
|
func TestCoSchedulingWithPermitPlugin(t *testing.T) {
|
||||||
// Create a plugin registry for testing. Register only a permit plugin.
|
// Create a plugin registry for testing. Register only a permit plugin.
|
||||||
registry := framework.Registry{permitPluginName: NewPermitPlugin}
|
perPlugin := &PermitPlugin{}
|
||||||
|
registry := framework.Registry{permitPluginName: NewPermitPlugin(perPlugin)}
|
||||||
|
|
||||||
// Setup initial permit plugin for testing.
|
// Setup initial permit plugin for testing.
|
||||||
plugins := &schedulerconfig.Plugins{
|
plugins := &schedulerconfig.Plugins{
|
||||||
@ -1544,7 +1546,8 @@ func TestPostFilterPlugin(t *testing.T) {
|
|||||||
// TestPreemptWithPermitPlugin tests preempt with permit plugins.
|
// TestPreemptWithPermitPlugin tests preempt with permit plugins.
|
||||||
func TestPreemptWithPermitPlugin(t *testing.T) {
|
func TestPreemptWithPermitPlugin(t *testing.T) {
|
||||||
// Create a plugin registry for testing. Register only a permit plugin.
|
// Create a plugin registry for testing. Register only a permit plugin.
|
||||||
registry := framework.Registry{permitPluginName: NewPermitPlugin}
|
perPlugin := &PermitPlugin{}
|
||||||
|
registry := framework.Registry{permitPluginName: NewPermitPlugin(perPlugin)}
|
||||||
|
|
||||||
// Setup initial permit plugin for testing.
|
// Setup initial permit plugin for testing.
|
||||||
plugins := &schedulerconfig.Plugins{
|
plugins := &schedulerconfig.Plugins{
|
||||||
|
Loading…
Reference in New Issue
Block a user