Skip to content

Testing cluster and enterprise setups #27

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

Merged
merged 1 commit into from
Oct 20, 2024
Merged
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ workflows:
matrix:
parameters:
python_version: ["3.10"]
arangodb_config: ["single"]
arangodb_license: ["community"]
arangodb_config: ["single", "cluster"]
arangodb_license: ["community", "enterprise"]
arangodb_version: ["3.12"]

jobs:
Expand Down
26 changes: 23 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class GlobalData:
token: str = None
sys_db_name: str = "_system"
username: str = generate_username()
cluster: bool = False
enterprise: bool = False


global_data = GlobalData()
Expand All @@ -40,6 +42,12 @@ def pytest_addoption(parser):
parser.addoption(
"--secret", action="store", default="secret", help="ArangoDB JWT secret"
)
parser.addoption(
"--cluster", action="store_true", help="Run tests in a cluster setup"
)
parser.addoption(
"--enterprise", action="store_true", help="Run tests in an enterprise setup"
)


def pytest_configure(config):
Expand All @@ -52,6 +60,8 @@ def pytest_configure(config):
global_data.password = config.getoption("password")
global_data.secret = config.getoption("secret")
global_data.token = JwtToken.generate_token(global_data.secret)
global_data.cluster = config.getoption("cluster")
global_data.enterprise = config.getoption("enterprise")


@pytest.fixture
Expand All @@ -74,6 +84,16 @@ def basic_auth_root(root, password):
return Auth(username=root, password=password)


@pytest.fixture
def clusetr():
return global_data.cluster


@pytest.fixture
def enterprise():
return global_data.enterprise


@pytest.fixture
def username():
return global_data.username
Expand Down Expand Up @@ -126,18 +146,18 @@ async def sys_db(arango_client, sys_db_name, basic_auth_root):


@pytest_asyncio.fixture
async def test_db(arango_client, sys_db, password):
async def test_db(arango_client, sys_db, username, password):
tst_db_name = generate_db_name()
tst_user = UserInfo(
user=generate_username(),
user=username,
password=password,
active=True,
)
await sys_db.create_database(tst_db_name, users=[tst_user])
yield await arango_client.db(
tst_db_name,
auth_method="basic",
auth=Auth(username=tst_user.user, password=password),
auth=Auth(username=username, password=password),
verify=False,
)
await sys_db.delete_database(tst_db_name)
Expand Down
Loading