diff --git a/integrations/test_oceanbase.py b/integrations/test_oceanbase.py new file mode 100644 index 0000000..fe6ed0c --- /dev/null +++ b/integrations/test_oceanbase.py @@ -0,0 +1,32 @@ +import unittest +from integrations.base_test import BaseTest +from utils.config import get_value_from_json_env_var, generate_random_db_name + + +class OceanBaseConnection(BaseTest): + """ + Test class for testing the OceanBase datasource using the MindsDB SQL API. + """ + + def test_execute_query(self): + """ + Create a new OceanBase Datasource. + """ + try: + cursor = self.connection.cursor() + random_db_name = generate_random_db_name("oceanbase_datasource") + oceanbase_config = get_value_from_json_env_var("INTEGRATIONS_CONFIG", 'oceanbase') + query = self.query_generator.create_database_query( + random_db_name, + "oceanbase", + oceanbase_config + ) + cursor.execute(query) + cursor.close() + except Exception as err: + cloud_temp = self.template.get_integration_template("OceanBase", "cln1kmzmy130779bbmzwsz7yepe") + self.incident.report_incident("cl8nll9f7106187olof1m17eg17", cloud_temp) + + +if __name__ == "__main__": + unittest.main() diff --git a/services/docker-compose.yml b/services/docker-compose.yml index f5617ad..4c700fa 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -46,6 +46,11 @@ services: command: start-single-node --insecure volumes: - "${PWD}/cockroach-data/cockroachdb:/cockroach/cockroach-data" + oceanbase: + image: oceanbase/oceanbase-ce + container_name: oceanbase + ports: + - "2881:2881" # Add more services below as required # Example service: # service_name: diff --git a/utils/config_example.json b/utils/config_example.json index 905aea8..69f64e8 100644 --- a/utils/config_example.json +++ b/utils/config_example.json @@ -218,6 +218,13 @@ "FileHeaderInfo": "mocked_file_header_info" } } + }, + "oceanbase": { + "host": "mocked_host", + "port": "mocked_port", + "database": "mocked_database", + "user": "mocked_user", + "password": "mocked_password" } } \ No newline at end of file