@@ -1412,6 +1412,34 @@ func TestDontAllowForceApplyWithServerDryRun(t *testing.T) {
1412
1412
t .Fatalf (`expected error "%s"` , expectedError )
1413
1413
}
1414
1414
1415
+ func TestDontAllowForceApplyWithServerSide (t * testing.T ) {
1416
+ expectedError := "error: --force cannot be used with --server-side"
1417
+
1418
+ cmdutil .BehaviorOnFatal (func (str string , code int ) {
1419
+ panic (str )
1420
+ })
1421
+ defer func () {
1422
+ actualError := recover ()
1423
+ if expectedError != actualError {
1424
+ t .Fatalf (`expected error "%s", but got "%s"` , expectedError , actualError )
1425
+ }
1426
+ }()
1427
+
1428
+ tf := cmdtesting .NewTestFactory ().WithNamespace ("test" )
1429
+ defer tf .Cleanup ()
1430
+
1431
+ tf .ClientConfigVal = cmdtesting .DefaultClientConfig ()
1432
+
1433
+ ioStreams , _ , _ , _ := genericclioptions .NewTestIOStreams ()
1434
+ cmd := NewCmdApply ("kubectl" , tf , ioStreams )
1435
+ cmd .Flags ().Set ("filename" , filenameRC )
1436
+ cmd .Flags ().Set ("server-side" , "true" )
1437
+ cmd .Flags ().Set ("force" , "true" )
1438
+ cmd .Run (cmd , []string {})
1439
+
1440
+ t .Fatalf (`expected error "%s"` , expectedError )
1441
+ }
1442
+
1415
1443
func TestDontAllowApplyWithPodGeneratedName (t * testing.T ) {
1416
1444
expectedError := "error: from testing-: cannot use generate name with apply"
1417
1445
cmdutil .BehaviorOnFatal (func (str string , code int ) {
0 commit comments