Skip to content

Conversation

@ahsimb
Copy link
Collaborator

@ahsimb ahsimb commented Jan 7, 2026

closes #123

This PR doesn't include the update of the User Guide. Will be done in a following PR.

@ahsimb ahsimb self-assigned this Jan 7, 2026
@ahsimb ahsimb added the feature Product feature label Jan 7, 2026
@ahsimb ahsimb temporarily deployed to manual-approval January 7, 2026 11:58 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 7, 2026 12:09 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 7, 2026 12:29 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 7, 2026 13:01 — with GitHub Actions Inactive
pointing to the root of the BucketFS bucket. Otherwise, even if the BucketFS access
is configured, the object is None.
The `get_bucketfs_location` is not tested here but mocked instead. It is tested in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you actually need an integration test then. Or, is this integration test a preparation for testing the tools?

Copy link
Collaborator Author

@ahsimb ahsimb Jan 8, 2026

Choose a reason for hiding this comment

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

Are you asking if we need the test that has been written (test_mcp_server_with_bucketfs), or if we need an integration test that covers get_bucketfs_location?
If it's the former, yes, I think we needed this test because the subsequent tests of the tools will not necessarily use the mcp_server. The main set of tools' tests - in test_mcp_server.py - uses a shortcut.
If it's the latter, hmm, yes, I feel slightly uneasy with this mock. In theory, it should be all good. The unit test covers this function completely, but still... It's just a bit awkward to extract the bucketfs parameters from backend_aware_bucketfs_params, given by the pytest plugin.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, after another look, I now know what bothers me. For get_bucketfs_location we only have unit tests that check that we parse the environment variable into parameters as expected. However, we don't test if the real infer_path likes these parameters. And this test isn't testing this easier, because it mocks get_bucketfs_location with an already created bucketfs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, that was my concern too.

@patch("exasol.bucketfs.path.infer_path")
def test_get_bucketfs_location(mock_infer_path, env, expected_kwargs) -> None:
get_bucketfs_location(env)
mock_infer_path.assert_called_with(**expected_kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In theory, we could test the environment parsing also without mocks if we extract it from get_bucketfs_location. Only a thought about how to structure testable code. We don't need to change it. Background, in general the most stable unit tests are input out tests without mocking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It makes the code more difficult to read. The mock is fine in my opinion.


def test_get_bucketfs_location_failure(caplog) -> None:
caplog.clear()
bucketfs_location = get_bucketfs_location(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might have actually raised an exception and do the logging in the caller. However, we probably can leave it as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would formulate it as a question of what we should do if the bucketfs is not configured properly, but the bucketfs tools are enabled. Should we blow up the whole thing or log a warning and continue? Since this is not a multi-user configuration, maybe the former is more appropriate. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, maybe it is actually better, that we blow it up, when the user requests us to provide the bucketfs tools, but didn't configure them correctly.

@ahsimb ahsimb temporarily deployed to manual-approval January 8, 2026 12:14 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 8, 2026 12:25 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 8, 2026 12:36 — with GitHub Actions Inactive
@ahsimb ahsimb temporarily deployed to manual-approval January 8, 2026 13:01 — with GitHub Actions Inactive
kwargs = {k.split("|")[0]: v for k, v in kwargs.items()}
if saas_env_complete(env):
kwargs["backend"] = "saas"
# This code should be moved to the `bucketfs-python.build_path`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What exactly needs to go to bucketfs-python

Copy link
Collaborator Author

@ahsimb ahsimb Jan 8, 2026

Choose a reason for hiding this comment

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

At the moment build_path requires the database_id for saas. infer_path makes it more user friendly, allowing to use a database_name instead. Unfortunately infer_path is at odds with the pytest-plugins, so I prefer to use build_path here (I already have a function to infer the backend). But I want the build_path to have the same feature. It would be best to mover this feature from infer_path to build_path.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ahsimb ahsimb merged commit 2573b4f into main Jan 8, 2026
86 of 88 checks passed
@ahsimb ahsimb deleted the feature/123-bfs-connection branch January 8, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add opening bucket_fs connection

3 participants