MCPcopy
hub / github.com/kubernetes/client-go / TestNewInformerWatcher

Function TestNewInformerWatcher

tools/watch/informerwatcher_test.go:136–278  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

134}
135
136func TestNewInformerWatcher(t *testing.T) {
137 // Make sure there are no 2 same types of events on a secret with the same name or that might be flaky.
138 tt := []struct {
139 name string
140 objects []runtime.Object
141 events []watch.Event
142 }{
143 {
144 name: "basic test",
145 objects: []runtime.Object{
146 &corev1.Secret{
147 ObjectMeta: metav1.ObjectMeta{
148 Name: "pod-1",
149 },
150 StringData: map[string]string{
151 "foo-1": "initial",
152 },
153 },
154 &corev1.Secret{
155 ObjectMeta: metav1.ObjectMeta{
156 Name: "pod-2",
157 },
158 StringData: map[string]string{
159 "foo-2": "initial",
160 },
161 },
162 &corev1.Secret{
163 ObjectMeta: metav1.ObjectMeta{
164 Name: "pod-3",
165 },
166 StringData: map[string]string{
167 "foo-3": "initial",
168 },
169 },
170 },
171 events: []watch.Event{
172 {
173 Type: watch.Added,
174 Object: &corev1.Secret{
175 ObjectMeta: metav1.ObjectMeta{
176 Name: "pod-4",
177 },
178 StringData: map[string]string{
179 "foo-4": "initial",
180 },
181 },
182 },
183 {
184 Type: watch.Modified,
185 Object: &corev1.Secret{
186 ObjectMeta: metav1.ObjectMeta{
187 Name: "pod-2",
188 },
189 StringData: map[string]string{
190 "foo-2": "new",
191 },
192 },
193 },

Callers

nothing calls this directly

Calls 14

byEventTypeAndNameTypeAlias · 0.85
PrependWatchReactorMethod · 0.80
RunMethod · 0.65
DeepCopyMethod · 0.65
ListMethod · 0.65
SecretsMethod · 0.65
CoreV1Method · 0.65
WatchMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected