@@ -23,6 +23,7 @@ import (
23
23
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
24
"k8s.io/apimachinery/pkg/fields"
25
25
"k8s.io/apimachinery/pkg/labels"
26
+ utilpointer "k8s.io/utils/pointer"
26
27
"sigs.k8s.io/controller-runtime/pkg/client"
27
28
)
28
29
@@ -87,3 +88,43 @@ var _ = Describe("CreateOptions", func() {
87
88
Expect (newCreatOpts ).To (Equal (o ))
88
89
})
89
90
})
91
+
92
+ var _ = Describe ("DeleteOptions" , func () {
93
+ It ("Should set GracePeriodSeconds" , func () {
94
+ o := & client.DeleteOptions {GracePeriodSeconds : utilpointer .Int64Ptr (42 )}
95
+ newDeleteOpts := & client.DeleteOptions {}
96
+ o .ApplyToDelete (newDeleteOpts )
97
+ Expect (newDeleteOpts ).To (Equal (o ))
98
+ })
99
+ It ("Should set Preconditions" , func () {
100
+ o := & client.DeleteOptions {Preconditions : & metav1.Preconditions {}}
101
+ newDeleteOpts := & client.DeleteOptions {}
102
+ o .ApplyToDelete (newDeleteOpts )
103
+ Expect (newDeleteOpts ).To (Equal (o ))
104
+ })
105
+ It ("Should set PropagationPolicy" , func () {
106
+ policy := metav1 .DeletePropagationBackground
107
+ o := & client.DeleteOptions {PropagationPolicy : & policy }
108
+ newDeleteOpts := & client.DeleteOptions {}
109
+ o .ApplyToDelete (newDeleteOpts )
110
+ Expect (newDeleteOpts ).To (Equal (o ))
111
+ })
112
+ It ("Should set Raw" , func () {
113
+ o := & client.DeleteOptions {Raw : & metav1.DeleteOptions {}}
114
+ newDeleteOpts := & client.DeleteOptions {}
115
+ o .ApplyToDelete (newDeleteOpts )
116
+ Expect (newDeleteOpts ).To (Equal (o ))
117
+ })
118
+ It ("Should set DryRun" , func () {
119
+ o := & client.DeleteOptions {DryRun : []string {"Hello" , "Pippa" }}
120
+ newDeleteOpts := & client.DeleteOptions {}
121
+ o .ApplyToDelete (newDeleteOpts )
122
+ Expect (newDeleteOpts ).To (Equal (o ))
123
+ })
124
+ It ("Should not set anything" , func () {
125
+ o := & client.DeleteOptions {}
126
+ newDeleteOpts := & client.DeleteOptions {}
127
+ o .ApplyToDelete (newDeleteOpts )
128
+ Expect (newDeleteOpts ).To (Equal (o ))
129
+ })
130
+ })
0 commit comments