mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
remove feature gate from tests.
This commit is contained in:
parent
db3ec322d7
commit
84ef463481
@ -23,10 +23,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/controller-manager/config"
|
"k8s.io/controller-manager/config"
|
||||||
"k8s.io/controller-manager/pkg/features"
|
|
||||||
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
migrationconfig "k8s.io/controller-manager/pkg/leadermigration/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,26 +34,11 @@ func TestLeaderMigrationOptions(t *testing.T) {
|
|||||||
configContent string
|
configContent string
|
||||||
expectEnabled bool
|
expectEnabled bool
|
||||||
expectErr bool
|
expectErr bool
|
||||||
enableFeatureGate bool
|
|
||||||
expectConfig *config.LeaderMigrationConfiguration
|
expectConfig *config.LeaderMigrationConfiguration
|
||||||
}{
|
}{
|
||||||
{
|
|
||||||
name: "default (disabled), with feature gate disabled",
|
|
||||||
flags: []string{},
|
|
||||||
enableFeatureGate: false,
|
|
||||||
expectEnabled: false,
|
|
||||||
expectErr: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "enabled, with feature gate disabled",
|
|
||||||
flags: []string{"--enable-leader-migration"},
|
|
||||||
enableFeatureGate: false,
|
|
||||||
expectErr: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "enabled, with default configuration",
|
name: "enabled, with default configuration",
|
||||||
flags: []string{"--enable-leader-migration"},
|
flags: []string{"--enable-leader-migration"},
|
||||||
enableFeatureGate: true,
|
|
||||||
expectEnabled: true,
|
expectEnabled: true,
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
expectConfig: migrationconfig.DefaultLeaderMigrationConfiguration(),
|
expectConfig: migrationconfig.DefaultLeaderMigrationConfiguration(),
|
||||||
@ -64,7 +46,6 @@ func TestLeaderMigrationOptions(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "enabled, with custom configuration file",
|
name: "enabled, with custom configuration file",
|
||||||
flags: []string{"--enable-leader-migration"},
|
flags: []string{"--enable-leader-migration"},
|
||||||
enableFeatureGate: true,
|
|
||||||
expectEnabled: true,
|
expectEnabled: true,
|
||||||
configContent: `
|
configContent: `
|
||||||
apiVersion: controllermanager.config.k8s.io/v1alpha1
|
apiVersion: controllermanager.config.k8s.io/v1alpha1
|
||||||
@ -83,7 +64,6 @@ controllerLeaders: []
|
|||||||
{
|
{
|
||||||
name: "enabled, with custom configuration file (version v1beta1)",
|
name: "enabled, with custom configuration file (version v1beta1)",
|
||||||
flags: []string{"--enable-leader-migration"},
|
flags: []string{"--enable-leader-migration"},
|
||||||
enableFeatureGate: true,
|
|
||||||
expectEnabled: true,
|
expectEnabled: true,
|
||||||
configContent: `
|
configContent: `
|
||||||
apiVersion: controllermanager.config.k8s.io/v1beta1
|
apiVersion: controllermanager.config.k8s.io/v1beta1
|
||||||
@ -102,7 +82,6 @@ controllerLeaders: []
|
|||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ControllerManagerLeaderMigration, tc.enableFeatureGate)()
|
|
||||||
flags := tc.flags
|
flags := tc.flags
|
||||||
if tc.configContent != "" {
|
if tc.configContent != "" {
|
||||||
configFile, err := ioutil.TempFile("", tc.name)
|
configFile, err := ioutil.TempFile("", tc.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user