Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Tests for the OceanBase Integration #31

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions integrations/test_oceanbase.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 5 additions & 0 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions utils/config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}