@@ -22,8 +22,6 @@ import (
22
22
"testing"
23
23
"time"
24
24
25
- cmdutil "k8s.io/kubectl/pkg/cmd/util"
26
-
27
25
"github.com/google/go-cmp/cmp"
28
26
"github.com/google/go-cmp/cmp/cmpopts"
29
27
"github.com/spf13/cobra"
@@ -2088,31 +2086,29 @@ func TestGenerateNodeDebugPodCustomProfile(t *testing.T) {
2088
2086
} {
2089
2087
2090
2088
t .Run (tc .name , func (t * testing.T ) {
2091
- cmdtesting .WithAlphaEnvs ([]cmdutil.FeatureGate {cmdutil .DebugCustomProfile }, t , func (t * testing.T ) {
2092
- var err error
2093
- kflags := KeepFlags {
2094
- Labels : tc .opts .KeepLabels ,
2095
- Annotations : tc .opts .KeepAnnotations ,
2096
- Liveness : tc .opts .KeepLiveness ,
2097
- Readiness : tc .opts .KeepReadiness ,
2098
- Startup : tc .opts .KeepStartup ,
2099
- InitContainers : tc .opts .KeepInitContainers ,
2100
- }
2101
- tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2102
- if err != nil {
2103
- t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2104
- }
2105
- tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2089
+ var err error
2090
+ kflags := KeepFlags {
2091
+ Labels : tc .opts .KeepLabels ,
2092
+ Annotations : tc .opts .KeepAnnotations ,
2093
+ Liveness : tc .opts .KeepLiveness ,
2094
+ Readiness : tc .opts .KeepReadiness ,
2095
+ Startup : tc .opts .KeepStartup ,
2096
+ InitContainers : tc .opts .KeepInitContainers ,
2097
+ }
2098
+ tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2099
+ if err != nil {
2100
+ t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2101
+ }
2102
+ tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2106
2103
2107
- pod , err := tc .opts .generateNodeDebugPod (tc .node )
2108
- if err != nil {
2109
- t .Fatalf ("Fail to generate node debug pod: %v" , err )
2110
- }
2111
- tc .expected .Name = pod .Name
2112
- if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2113
- t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2114
- }
2115
- })
2104
+ pod , err := tc .opts .generateNodeDebugPod (tc .node )
2105
+ if err != nil {
2106
+ t .Fatalf ("Fail to generate node debug pod: %v" , err )
2107
+ }
2108
+ tc .expected .Name = pod .Name
2109
+ if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2110
+ t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2111
+ }
2116
2112
})
2117
2113
}
2118
2114
}
@@ -2296,31 +2292,29 @@ func TestGenerateCopyDebugPodCustomProfile(t *testing.T) {
2296
2292
} {
2297
2293
2298
2294
t .Run (tc .name , func (t * testing.T ) {
2299
- cmdtesting .WithAlphaEnvs ([]cmdutil.FeatureGate {cmdutil .DebugCustomProfile }, t , func (t * testing.T ) {
2300
- var err error
2301
- kflags := KeepFlags {
2302
- Labels : tc .opts .KeepLabels ,
2303
- Annotations : tc .opts .KeepAnnotations ,
2304
- Liveness : tc .opts .KeepLiveness ,
2305
- Readiness : tc .opts .KeepReadiness ,
2306
- Startup : tc .opts .KeepStartup ,
2307
- InitContainers : tc .opts .KeepInitContainers ,
2308
- }
2309
- tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2310
- if err != nil {
2311
- t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2312
- }
2313
- tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2295
+ var err error
2296
+ kflags := KeepFlags {
2297
+ Labels : tc .opts .KeepLabels ,
2298
+ Annotations : tc .opts .KeepAnnotations ,
2299
+ Liveness : tc .opts .KeepLiveness ,
2300
+ Readiness : tc .opts .KeepReadiness ,
2301
+ Startup : tc .opts .KeepStartup ,
2302
+ InitContainers : tc .opts .KeepInitContainers ,
2303
+ }
2304
+ tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2305
+ if err != nil {
2306
+ t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2307
+ }
2308
+ tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2314
2309
2315
- pod , dc , err := tc .opts .generatePodCopyWithDebugContainer (tc .copyPod )
2316
- if err != nil {
2317
- t .Fatalf ("Fail to generate node debug pod: %v" , err )
2318
- }
2319
- tc .expected .Spec .Containers [0 ].Name = dc
2320
- if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2321
- t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2322
- }
2323
- })
2310
+ pod , dc , err := tc .opts .generatePodCopyWithDebugContainer (tc .copyPod )
2311
+ if err != nil {
2312
+ t .Fatalf ("Fail to generate node debug pod: %v" , err )
2313
+ }
2314
+ tc .expected .Spec .Containers [0 ].Name = dc
2315
+ if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2316
+ t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2317
+ }
2324
2318
})
2325
2319
}
2326
2320
}
@@ -2510,31 +2504,29 @@ func TestGenerateEphemeralDebugPodCustomProfile(t *testing.T) {
2510
2504
} {
2511
2505
2512
2506
t .Run (tc .name , func (t * testing.T ) {
2513
- cmdtesting .WithAlphaEnvs ([]cmdutil.FeatureGate {cmdutil .DebugCustomProfile }, t , func (t * testing.T ) {
2514
- var err error
2515
- kflags := KeepFlags {
2516
- Labels : tc .opts .KeepLabels ,
2517
- Annotations : tc .opts .KeepAnnotations ,
2518
- Liveness : tc .opts .KeepLiveness ,
2519
- Readiness : tc .opts .KeepReadiness ,
2520
- Startup : tc .opts .KeepStartup ,
2521
- InitContainers : tc .opts .KeepInitContainers ,
2522
- }
2523
- tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2524
- if err != nil {
2525
- t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2526
- }
2527
- tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2507
+ var err error
2508
+ kflags := KeepFlags {
2509
+ Labels : tc .opts .KeepLabels ,
2510
+ Annotations : tc .opts .KeepAnnotations ,
2511
+ Liveness : tc .opts .KeepLiveness ,
2512
+ Readiness : tc .opts .KeepReadiness ,
2513
+ Startup : tc .opts .KeepStartup ,
2514
+ InitContainers : tc .opts .KeepInitContainers ,
2515
+ }
2516
+ tc .opts .Applier , err = NewProfileApplier (tc .opts .Profile , kflags )
2517
+ if err != nil {
2518
+ t .Fatalf ("Fail to create profile applier: %s: %v" , tc .opts .Profile , err )
2519
+ }
2520
+ tc .opts .IOStreams = genericiooptions .NewTestIOStreamsDiscard ()
2528
2521
2529
- pod , ec , err := tc .opts .generateDebugContainer (tc .copyPod )
2530
- if err != nil {
2531
- t .Fatalf ("Fail to generate node debug pod: %v" , err )
2532
- }
2533
- tc .expected .Spec .EphemeralContainers [0 ].Name = ec .Name
2534
- if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2535
- t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2536
- }
2537
- })
2522
+ pod , ec , err := tc .opts .generateDebugContainer (tc .copyPod )
2523
+ if err != nil {
2524
+ t .Fatalf ("Fail to generate node debug pod: %v" , err )
2525
+ }
2526
+ tc .expected .Spec .EphemeralContainers [0 ].Name = ec .Name
2527
+ if diff := cmp .Diff (tc .expected , pod ); diff != "" {
2528
+ t .Error ("unexpected diff in generated object: (-want +got):\n " , diff )
2529
+ }
2538
2530
})
2539
2531
}
2540
2532
}
0 commit comments