MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / create_mock_server

Function create_mock_server

tests/helpers.py:945–975  ·  view source on GitHub ↗
(mock_type,  # type: MockServerType
                       mock_path,  # type: str
                       mock_download_url,  # type: Optional[str]
                       mock_version,  # type: Optional[str]
                       log_dir=None,  # type: Optional[str]
                       log_filename=None,  # type: Optional[str]
                       )

Source from the content-addressed store, hash-verified

943
944
945def create_mock_server(mock_type, # type: MockServerType
946 mock_path, # type: str
947 mock_download_url, # type: Optional[str]
948 mock_version, # type: Optional[str]
949 log_dir=None, # type: Optional[str]
950 log_filename=None, # type: Optional[str]
951 ) -> MockServer:
952
953 if mock_type == MockServerType.Legacy:
954 bspec_dfl = LegacyMockBucketSpec('default', 'couchbase')
955 mock = MockServer.create_legacy_mock_server([bspec_dfl],
956 mock_path,
957 mock_download_url,
958 replicas=2,
959 nodes=4)
960 else:
961 mock = MockServer.create_caves_mock_server(mock_path,
962 mock_download_url,
963 mock_version,
964 log_dir,
965 log_filename)
966
967 try:
968 mock.start()
969 if mock_type == MockServerType.GoCAVES:
970 mock.create_cluster()
971 except Exception as ex:
972 raise CouchbaseTestEnvironmentException(
973 f"Problem trying to start mock server:\n{ex}")
974
975 return mock
976
977
978def restart_mock(mock) -> None:

Callers 1

load_configFunction · 0.85

Calls 6

create_clusterMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected