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 server = TestServer::new().expect("Could start test server");
                let server = Arc::new(server);

                // ensure the server is ready
                server.wait_until_ready(InitialConfig::SetWriterId).await;
                // 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::create_common(server).await
    }
/// 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 is configured with a writer id and
/// 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 is configured with a writer id and
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 is configured with a writer id and 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 server = TestServer::new().expect("Could start test server");
                let server = Arc::new(server);
                // ensure the server is ready
                server.wait_until_ready(InitialConfig::SetWriterId).await;
                // 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::create_common(server).await
    }
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 server = TestServer :: new ( ) . expect ( " " ) ; let server = Arc :: new ( server ) ; // ensure the server is ready server . wait_until_ready ( InitialConfig :: SetWriterId ) . await ; // 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 :: create_common ( server ) . await }
Create a new server fixture and wait for it to be ready.
Create a new server fixture and wait for it to be ready .