Tests: Reorganize test suite into functional subdirectories
- Categorized scripts into tests/unit/, tests/integration/, tests/e2e/, and tests/tools/. - Adopted consistent naming prefixes (test_unit_*, test_int_*, test_e2e_*, tool_*). - Renamed conftest_mock.py to mock_config_helper.py for clarity. - Updated test_int_boot_diagnosis.py with sys.path setup for root-level execution.
This commit is contained in:
46
tests/integration/test_int_db_connectivity.py
Normal file
46
tests/integration/test_int_db_connectivity.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import sqlalchemy
|
||||
from sqlalchemy import text
|
||||
import json
|
||||
|
||||
# Connection details from .env
|
||||
DB_USER = "aether_dev"
|
||||
DB_PASS = "$1sky.AE_dev.2023"
|
||||
DB_SERVER = "vpn-db.oneskyit.com"
|
||||
DB_PORT = "3306"
|
||||
DB_NAME = "aether_dev"
|
||||
|
||||
# Construct URI
|
||||
DB_URI = f"mysql://{DB_USER}:{DB_PASS}@{DB_SERVER}:{DB_PORT}/{DB_NAME}"
|
||||
|
||||
def test_raw_describe():
|
||||
engine = sqlalchemy.create_engine(DB_URI)
|
||||
print(f"Connecting to {DB_SERVER}...")
|
||||
|
||||
try:
|
||||
with engine.connect() as conn:
|
||||
result = conn.execute(text("DESCRIBE journal"))
|
||||
columns = []
|
||||
for row in result.fetchall():
|
||||
columns.append({
|
||||
"Field": row[0],
|
||||
"Type": row[1],
|
||||
"Null": row[2],
|
||||
"Default": row[4]
|
||||
})
|
||||
|
||||
# Print as a nice JSON snippet
|
||||
print("\n--- Raw DB Metadata for 'journal' (Sample) ---")
|
||||
print(json.dumps(columns[:5], indent=2))
|
||||
|
||||
# Highlight the specific fields mentioned in the task
|
||||
print("\n--- Target Fields ---")
|
||||
targets = ["name", "enable", "passcode_timeout", "created_on"]
|
||||
for col in columns:
|
||||
if col["Field"] in targets:
|
||||
print(f"Field: {col['Field']:16} | Type: {col['Type']:15} | Null: {col['Null']:3} | Default: {col['Default']}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_raw_describe()
|
||||
Reference in New Issue
Block a user