async fn watch_annotations_wait_for_update() -> Result<(), anyhow::Error> {
        let holder = Arc::new(Mutex::new(AnnotationHolder::new()));
        let proxy = spawn_annotation_controller_handler(holder.clone());

        // Make the initial request, so that the next one will hang.
        let annotations = proxy.watch_annotations().await?.unwrap();
        assert_eq!(annotations.len(), 0);

        let annotations = proxy.watch_annotations();
        let update = fasync::Task::spawn(async move {
            let _ = proxy.update_annotations(
                &mut vec![felement::Annotation {
                    key: make_annotation_key("NAMESPACE", "id1"),
                    value: make_annotation_text("original1"),
                }]
                .iter_mut(),
                &mut vec![].iter_mut(),
            );
        });

        let (annotations, _) = fasync::futures::join!(annotations, update);
        assert_eq!(annotations?.unwrap().len(), 1);
        Ok(())
    }
// Test `watch_annotations` waits for an update to annotations before returning to the client.
Test `watch_annotations` waits for an update to annotations before returning to the client.
Test ` watch_annotations ` waits for an update to annotations before returning to the client .
async fn watch_annotations_wait_for_update() -> Result<(), anyhow::Error> {
        let holder = Arc::new(Mutex::new(AnnotationHolder::new()));
        let proxy = spawn_annotation_controller_handler(holder.clone());
        // Make the initial request, so that the next one will hang.
        let annotations = proxy.watch_annotations().await?.unwrap();
        assert_eq!(annotations.len(), 0);
        let annotations = proxy.watch_annotations();
        let update = fasync::Task::spawn(async move {
            let _ = proxy.update_annotations(
                &mut vec![felement::Annotation {
                    key: make_annotation_key("NAMESPACE", "id1"),
                    value: make_annotation_text("original1"),
                }]
                .iter_mut(),
                &mut vec![].iter_mut(),
            );
        });
        let (annotations, _) = fasync::futures::join!(annotations, update);
        assert_eq!(annotations?.unwrap().len(), 1);
        Ok(())
    }
async fn watch_annotations_wait_for_update ( ) -> Result < ( ) , anyhow :: Error > { let holder = Arc :: new ( Mutex :: new ( AnnotationHolder :: new ( ) ) ) ; let proxy = spawn_annotation_controller_handler ( holder . clone ( ) ) ; // Make the initial request, so that the next one will hang. let annotations = proxy . watch_annotations ( ) . await ? . unwrap ( ) ; assert_eq ! ( annotations len ( ) 0 ) ; let annotations = proxy . watch_annotations ( ) ; let update = fasync :: Task :: spawn ( async move { let _ = proxy . update_annotations ( & mut vec ! [ felement Annotation { key make_annotation_key ( " " " " ) value make_annotation_text ( " " ) } ] . iter_mut ( ) , & mut vec ! [ ] . iter_mut ( ) , ) ; } ) ; let ( annotations , _ ) = fasync :: futures :: join ! ( annotations update ) ; assert_eq ! ( annotations unwrap ( ) len ( ) 1 ) ; Ok ( ( ) ) }
Test `watch_annotations` waits for an update to annotations before returning to the client.
Test ` watch_annotations ` waits for an update to annotations before returning to the client .