mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
For grins, make the watch checks very detailed
So we know we're not just seeing an arbitrary watch event, we're seeing _the_ watch event that describes the results of our actions
This commit is contained in:
parent
9fb05616ca
commit
1048dddc36
@ -200,8 +200,19 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
|
|||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(watchEvent watch.Event) (bool, error) {
|
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
|
||||||
return watchEvent.Type == watch.Added, nil
|
switch event.Type {
|
||||||
|
case watch.Added:
|
||||||
|
if cm, ok := event.Object.(*v1.ConfigMap); ok {
|
||||||
|
found := cm.ObjectMeta.Name == testConfigMap.Name &&
|
||||||
|
cm.Labels["test-configmap-static"] == "true" &&
|
||||||
|
cm.Data["valueName"] == "value"
|
||||||
|
return found, nil
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
framework.Logf("observed event type %v", event.Type)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
})
|
})
|
||||||
framework.ExpectNoError(err, "failed to see a watch.Added event for the configmap we created")
|
framework.ExpectNoError(err, "failed to see a watch.Added event for the configmap we created")
|
||||||
|
|
||||||
@ -223,8 +234,20 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
|
|||||||
ginkgo.By("waiting for the ConfigMap to be modified")
|
ginkgo.By("waiting for the ConfigMap to be modified")
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(watchEvent watch.Event) (bool, error) {
|
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
|
||||||
return watchEvent.Type == watch.Modified, nil
|
switch event.Type {
|
||||||
|
case watch.Modified:
|
||||||
|
if cm, ok := event.Object.(*v1.ConfigMap); ok {
|
||||||
|
found := cm.ObjectMeta.Name == testConfigMap.Name &&
|
||||||
|
cm.Labels["test-configmap-static"] == "true" &&
|
||||||
|
cm.Labels["test-configmap"] == "patched" &&
|
||||||
|
cm.Data["valueName"] == "value1"
|
||||||
|
return found, nil
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
framework.Logf("observed event type %v", event.Type)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
})
|
})
|
||||||
framework.ExpectNoError(err, "failed to see a watch.Modified event for the configmap we patched")
|
framework.ExpectNoError(err, "failed to see a watch.Modified event for the configmap we patched")
|
||||||
|
|
||||||
@ -260,8 +283,20 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
|
|||||||
ginkgo.By("waiting for the ConfigMap to be deleted")
|
ginkgo.By("waiting for the ConfigMap to be deleted")
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(watchEvent watch.Event) (bool, error) {
|
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
|
||||||
return watchEvent.Type == watch.Deleted, nil
|
switch event.Type {
|
||||||
|
case watch.Deleted:
|
||||||
|
if cm, ok := event.Object.(*v1.ConfigMap); ok {
|
||||||
|
found := cm.ObjectMeta.Name == testConfigMap.Name &&
|
||||||
|
cm.Labels["test-configmap-static"] == "true" &&
|
||||||
|
cm.Labels["test-configmap"] == "patched" &&
|
||||||
|
cm.Data["valueName"] == "value1"
|
||||||
|
return found, nil
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
framework.Logf("observed event type %v", event.Type)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
})
|
})
|
||||||
framework.ExpectNoError(err, "fasiled to observe a watch.Deleted event for the ConfigMap we deleted")
|
framework.ExpectNoError(err, "fasiled to observe a watch.Deleted event for the ConfigMap we deleted")
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user