def test_2_broke_analisys(self): ''' stop mindsdb while analyse dataset ''' data = { "integration_id": 'default_mariadb', "name": TEST_DS, "query": f"select * from test_data.{TEST_DATASET} limit 100;" } res = requests.put(f'{HTTP_API_ROOT}/datasources/{TEST_DS}', json=data) assert res.status_code == 200 res = requests.get(f'{HTTP_API_ROOT}/datasources/{TEST_DS}/analyze') assert res.status_code == 200 stop_mindsdb() self.mdb, datastore = run_environment( config, apis=['mysql', 'http'], override_integration_config={'default_mariadb': { 'publish': True }}, mindsdb_database=MINDSDB_DATABASE, clear_storage=False) check_ds_exists(TEST_DS)
def test_4_wrong_prediction(self): ''' close mindsdb while make prediction, then try run it again ''' ioloop = asyncio.get_event_loop() if ioloop.is_closed(): ioloop = asyncio.new_event_loop() ioloop.run_in_executor( None, lambda: requests.post( f'{HTTP_API_ROOT}/predictors/{TEST_PREDICTOR}_2/predict', json={'when': CONDITION})) time.sleep(0.5) stop_mindsdb() ioloop.close() self.mdb, datastore = run_environment( config, apis=['mysql', 'http'], override_integration_config={'default_mariadb': { 'publish': True }}, mindsdb_database=MINDSDB_DATABASE, clear_storage=False) res = requests.post( f'{HTTP_API_ROOT}/predictors/{TEST_PREDICTOR}_2/predict', json={'when': CONDITION}) assert res.status_code == 200
def test_2_restart_and_connect(self): stop_mindsdb() run_environment(apis=['mysql'], override_config={ 'integrations': { 'default_mariadb': { 'publish': False } } }) config.update(json.loads(Path(CONFIG_PATH).read_text()))
def test_3_wrong_predictor(self): ''' try create predictor with wrong parameters, close mindsdb while model training check mindsdb can start again ''' check_predictor_not_exists(TEST_PREDICTOR) data = { 'to_predict': list(TO_PREDICT.keys()), 'data_source_name': 'wrong ds' } res = requests.put(f'{HTTP_API_ROOT}/predictors/{TEST_PREDICTOR}', json=data) assert 'Can not find datasource' in res.json()['message'] check_predictor_not_exists(TEST_PREDICTOR) data = { 'to_predict': list(TO_PREDICT.keys()), 'data_source_name': TEST_DS } res = requests.put(f'{HTTP_API_ROOT}/predictors/{TEST_PREDICTOR}', json=data) assert res.status_code == 200 stop_mindsdb() self.mdb, datastore = run_environment( config, apis=['mysql', 'http'], override_integration_config={'default_mariadb': { 'publish': True }}, mindsdb_database=MINDSDB_DATABASE, clear_storage=False) # TODO add after this issue will be closed: https://github.com/mindsdb/mindsdb/issues/948 # check_predictor_not_exists(TEST_PREDICTOR) data = { 'to_predict': list(TO_PREDICT.keys()), 'data_source_name': TEST_DS } res = requests.put(f'{HTTP_API_ROOT}/predictors/{TEST_PREDICTOR}_2', json=data) assert res.status_code == 200 wait_predictor_learn(f'{TEST_PREDICTOR}_2')
def test_3_restart_and_connect(self): stop_mindsdb() mdb, datastore = run_environment( config, apis=['mysql'], override_integration_config={ 'default_mariadb': { 'publish': True } }, mindsdb_database=MINDSDB_DATABASE, clear_storage=False ) self.mdb = mdb