Skip to content
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
46 changes: 46 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,49 @@ jobs:
pip install pytest anyio
pip install -e .

- name: Debug vector index secret wiring

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please remove this debug step ?

run: |
python - <<'PY'
import hashlib
import os
from urllib.parse import urlparse

def log_env(name):
value = os.environ.get(name)
if value is None:
print(f"{name}: missing")
return
digest = hashlib.sha256(value.encode()).hexdigest()[:12]
print(
f"{name}: set len={len(value)} stripped={value == value.strip()} "
f"sha256_12={digest}"
)

for env_name in (
"PYSAI_TEST_USER",
"PYTEST_TEST_OBJSTORE_EMBEDDING_LOC",
"PYTEST_TEST_OBJSTORE_USERNAME",
"PYTEST_TEST_OBJSTORE_PASSWORD",
):
log_env(env_name)

location = os.environ.get("PYTEST_TEST_OBJSTORE_EMBEDDING_LOC")
if location:
print(
"PYTEST_TEST_OBJSTORE_EMBEDDING_LOC "
f"host={urlparse(location.strip()).hostname}"
)

user = os.environ.get("PYSAI_TEST_USER")
if user:
print(f"PYSAI_TEST_USER uppercase={user == user.upper()}")
PY
env:
PYSAI_TEST_USER: ${{ secrets.PYSAI_TEST_USER }}_${{env.PYTHON_VERSION_WITHOUT_DOT}}
PYTEST_TEST_OBJSTORE_EMBEDDING_LOC: ${{ secrets.PYTEST_TEST_OBJSTORE_EMBEDDING_LOC }}
PYTEST_TEST_OBJSTORE_USERNAME: ${{ secrets.PYTEST_TEST_OBJSTORE_USERNAME }}
PYTEST_TEST_OBJSTORE_PASSWORD: ${{ secrets.PYTEST_TEST_OBJSTORE_PASSWORD }}

- name: Run select_ai tests
run: |
python_version=${{matrix.python-version}}
Expand All @@ -60,3 +103,6 @@ jobs:
PYSAI_TEST_EMAIL_SENDER: ${{secrets.PYSAI_TEST_EMAIL_SENDER}}
PYSAI_TEST_EMAIL_SMTPHOST: ${{secrets.PYSAI_TEST_EMAIL_SMTPHOST}}
PYSAI_TEST_OPENAI_API_KEY: ${{secrets.PYSAI_TEST_OPENAI_API_KEY}}
PYTEST_TEST_OBJSTORE_EMBEDDING_LOC: ${{ secrets.PYTEST_TEST_OBJSTORE_EMBEDDING_LOC }}
PYTEST_TEST_OBJSTORE_USERNAME: ${{ secrets.PYTEST_TEST_OBJSTORE_USERNAME }}
PYTEST_TEST_OBJSTORE_PASSWORD: ${{ secrets.PYTEST_TEST_OBJSTORE_PASSWORD }}
51 changes: 51 additions & 0 deletions tests/credential/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -----------------------------------------------------------------------------
# Copyright (c) 2025, Oracle and/or its affiliates.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new files, Copyright header should use the current year - 2026

#
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
# -----------------------------------------------------------------------------

import os

import pytest


def get_credential_env_value(name, default_value=None):
return os.environ.get(f"PYSAI_TEST_{name}", default_value)


@pytest.fixture(scope="session")
def oci_credential():
"""
Override the root autouse OCI credential fixture for credential-only tests.
These suites should not require OCI environment variables unless a test
explicitly opts into them.
"""
return None


@pytest.fixture(scope="session")
def credential_test_params(test_env):
return {
"user": test_env.test_user,
"password": test_env.test_user_password,
"dsn": test_env.connect_string,
"user_ocid": get_credential_env_value(
"OCI_USER_OCID", default_value="user ocid"
),
"tenancy_ocid": get_credential_env_value(
"OCI_TENANCY_OCID", default_value="tenancy ocid"
),
"private_key": get_credential_env_value(
"OCI_PRIVATE_KEY", default_value="private key"
),
"fingerprint": get_credential_env_value(
"OCI_FINGERPRINT", default_value="fingerprint"
),
"cred_username": get_credential_env_value(
"CRED_USERNAME", default_value="OCI credential username"
),
"cred_password": get_credential_env_value(
"CRED_PASSWORD", default_value="OCI credential password"
),
}
Loading