@@ -864,50 +864,36 @@ var _ = Describe("Client", func() {
864
864
})
865
865
866
866
Describe ("DeleteOptions" , func () {
867
- It ("should set empty metav1.DeleteOptions from nil or empty" , func () {
868
- var do * client.DeleteOptions
869
- Expect (do .AsDeleteOptions ()).To (Equal (& metav1.DeleteOptions {}))
870
- do = & client.DeleteOptions {}
871
- Expect (do .AsDeleteOptions ()).To (Equal (& metav1.DeleteOptions {}))
872
- })
873
-
874
- It ("should be converted to metav1.DeleteOptions" , func () {
875
- gp := int64 (1 )
876
- pc := metav1 .NewUIDPreconditions ("uid" )
877
- dp := metav1 .DeletePropagationForeground
878
- do := & client.DeleteOptions {
879
- GracePeriodSeconds : & gp ,
880
- Preconditions : pc ,
881
- PropagationPolicy : & dp ,
882
- }
883
- mdo := do .AsDeleteOptions ()
884
- Expect (mdo .GracePeriodSeconds ).To (Equal (& gp ))
885
- Expect (mdo .Preconditions ).To (Equal (pc ))
886
- Expect (mdo .PropagationPolicy ).To (Equal (& dp ))
887
- })
888
-
889
- It ("should be able to set GracePeriodSeconds from option func" , func () {
867
+ It ("should allow setting GracePeriodSeconds" , func () {
890
868
do := & client.DeleteOptions {}
891
- do . ApplyOptions ([] client.DeleteOptionFunc { client . GracePeriodSeconds (1 )} )
869
+ client .GracePeriodSeconds (1 )( do )
892
870
gp := int64 (1 )
893
- Expect (do .GracePeriodSeconds ).To (Equal (& gp ))
871
+ Expect (do .AsDeleteOptions (). GracePeriodSeconds ).To (Equal (& gp ))
894
872
})
895
873
896
- It ("should be able to set Precondition from option func" , func () {
897
- pc := metav1 .NewUIDPreconditions ("uid" )
874
+ It ("should allow setting Precondition" , func () {
898
875
do := & client.DeleteOptions {}
899
- do .ApplyOptions ([]client.DeleteOptionFunc {client .Preconditions (pc )})
876
+ pc := metav1 .NewUIDPreconditions ("uid" )
877
+ client .Preconditions (pc )(do )
878
+ Expect (do .AsDeleteOptions ().Preconditions ).To (Equal (pc ))
900
879
Expect (do .Preconditions ).To (Equal (pc ))
901
880
})
902
881
903
- It ("should be able to set PropagationPolicy from option func " , func () {
882
+ It ("should allow setting PropagationPolicy" , func () {
904
883
do := & client.DeleteOptions {}
905
- do . ApplyOptions ([] client.DeleteOptionFunc { client . PropagationPolicy (metav1 .DeletePropagationForeground )} )
884
+ client .PropagationPolicy (metav1 .DeletePropagationForeground )( do )
906
885
dp := metav1 .DeletePropagationForeground
907
- Expect (do .PropagationPolicy ).To (Equal (& dp ))
886
+ Expect (do .AsDeleteOptions ().PropagationPolicy ).To (Equal (& dp ))
887
+ })
888
+
889
+ It ("should produce empty metav1.DeleteOptions if nil" , func () {
890
+ var do * client.DeleteOptions
891
+ Expect (do .AsDeleteOptions ()).To (Equal (& metav1.DeleteOptions {}))
892
+ do = & client.DeleteOptions {}
893
+ Expect (do .AsDeleteOptions ()).To (Equal (& metav1.DeleteOptions {}))
908
894
})
909
895
910
- It ("should be able to set all option funcs " , func () {
896
+ It ("should merge multiple options together " , func () {
911
897
gp := int64 (1 )
912
898
pc := metav1 .NewUIDPreconditions ("uid" )
913
899
dp := metav1 .DeletePropagationForeground
0 commit comments