Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def test_1_upload_ds(self):
        check_ds_not_exists(TEST_DS_CSV)

        with open(self.external_datasource_csv_path, 'rb') as f:
            d = f.read()
        res = requests.put(f'{HTTP_API_ROOT}/datasources/{TEST_DS_CSV}',
                           files={
                               'file': ('data.csv', d, 'text/csv'),
                               'name': (None, TEST_DS_CSV),
                               'source_type': (None, 'file'),
                               'source': (None, 'data.csv')
                           })
        assert res.status_code == 200

        check_ds_exists(TEST_DS_CSV)
        check_ds_analyzable(TEST_DS_CSV)
Exemplo n.º 3
0
    def test_3_create_ds_from_sql_by_http(self):
        '''
        check is no DS with this name
        create DS
        analyse it
        '''
        check_ds_not_exists(TEST_DS)

        data = {
            "integration_id": TEST_INTEGRATION,
            "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

        check_ds_exists(TEST_DS)
        check_ds_analyzable(TEST_DS)