pub async fn create_shared() -> Self {
        // Try and reuse the same shared server, if there is already
        // one present
        static SHARED_SERVER: OnceCell<parking_lot::Mutex<Weak<TestServer>>> = OnceCell::new();

        let shared_server = SHARED_SERVER.get_or_init(|| parking_lot::Mutex::new(Weak::new()));

        let mut shared_server = shared_server.lock();

        // is a shared server already present?
        let server = match shared_server.upgrade() {
            Some(server) => server,
            None => {
                // if not, create one
                let mut server = TestServer::new();
                // ensure the server is ready
                server.wait_until_ready(InitialConfig::Onboarded).await;

                let server = Arc::new(server);
                // save a reference for other threads that may want to
                // use this server, but don't prevent it from being
                // destroyed when going out of scope
                *shared_server = Arc::downgrade(&server);
                server
            }
        };
        std::mem::drop(shared_server);

        Self { server }
    }
/// Create a new server fixture and wait for it to be ready. This
/// is called "create" rather than new because it is async and
/// waits. The shared database can be used immediately.
///
/// This is currently implemented as a singleton so all tests *must*
/// use a new database and not interfere with the existing database.
Create a new server fixture and wait for it to be ready. This
is called "create" rather than new because it is async and
waits. The shared database can be used immediately.

This is currently implemented as a singleton so all tests *must
use a new database and not interfere with the existing database.
Create a new server fixture and wait for it to be ready . This is called " create " rather than new because it is async and waits . The shared database can be used immediately . This is currently implemented as a singleton so all tests * must use a new database and not interfere with the existing database .
pub async fn create_shared() -> Self {
        // Try and reuse the same shared server, if there is already
        // one present
        static SHARED_SERVER: OnceCell<parking_lot::Mutex<Weak<TestServer>>> = OnceCell::new();
        let shared_server = SHARED_SERVER.get_or_init(|| parking_lot::Mutex::new(Weak::new()));
        let mut shared_server = shared_server.lock();
        // is a shared server already present?
        let server = match shared_server.upgrade() {
            Some(server) => server,
            None => {
                // if not, create one
                let mut server = TestServer::new();
                // ensure the server is ready
                server.wait_until_ready(InitialConfig::Onboarded).await;
                let server = Arc::new(server);
                // save a reference for other threads that may want to
                // use this server, but don't prevent it from being
                // destroyed when going out of scope
                *shared_server = Arc::downgrade(&server);
                server
            }
        };
        std::mem::drop(shared_server);
        Self { server }
    }
pub async fn create_shared ( ) -> Self { // Try and reuse the same shared server, if there is already // one present static SHARED_SERVER : OnceCell < parking_lot :: Mutex < Weak < TestServer > > > = OnceCell :: new ( ) ; let shared_server = SHARED_SERVER . get_or_init ( | | parking_lot :: Mutex :: new ( Weak :: new ( ) ) ) ; let mut shared_server = shared_server . lock ( ) ; // is a shared server already present? let server = match shared_server . upgrade ( ) { Some ( server ) => server , None => { // if not, create one let mut server = TestServer :: new ( ) ; // ensure the server is ready server . wait_until_ready ( InitialConfig :: Onboarded ) . await ; let server = Arc :: new ( server ) ; // save a reference for other threads that may want to // use this server, but don't prevent it from being // destroyed when going out of scope * shared_server = Arc :: downgrade ( & server ) ; server } } ; std :: mem :: drop ( shared_server ) ; Self { server } }
Create a new server fixture and wait for it to be ready.
Create a new server fixture and wait for it to be ready .