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

Provide a mechanism to modify config files in a running test cluster #117859

Merged

Conversation

mark-vieira
Copy link
Contributor

@mark-vieira mark-vieira commented Dec 2, 2024

Adds the ability to provide mutable config files to a test cluster, such that the contents of the file can be updating while the cluster is running. This is helpful in testing behavior that relies on reloadable configuration.

The Resource API used in test clusters for providing file-based configuration has been extended to allow for a MutableResource whose content can be updated. When updated, the file will be updated in-place, even in a running cluster. Here is a simple example:

    private static final MutableResource rolesFile = MutableResource.from(Resource.fromString(""));

    @ClassRule
    public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
        .setting("xpack.security.enabled", "true")
        .rolesFile(rolesFile)
        .build();

    public void testUpdateRolesFile() {
        // do stuff

        rolesFile.update(Resource.fromString("""
            user_role:
              cluster: [ALL]
              indices: []
            """));

        // do more stuff
    }

@mark-vieira mark-vieira added >non-issue :Delivery/Build Build or test infrastructure auto-backport Automatically create backport pull requests when merged v8.17.1 v8.18.0 labels Dec 2, 2024
@mark-vieira mark-vieira requested a review from tvernum December 2, 2024 21:13
@elasticsearchmachine elasticsearchmachine added v9.0.0 Team:Delivery Meta label for Delivery team labels Dec 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

Copy link
Contributor

@slobodanadamovic slobodanadamovic left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Dec 3, 2024
@mark-vieira
Copy link
Contributor Author

@elasticmachine update branch

@mark-vieira mark-vieira merged commit ebf470a into elastic:main Dec 3, 2024
16 checks passed
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Dec 3, 2024
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Dec 3, 2024
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2024
…117859) (#117932)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Delivery/Build Build or test infrastructure >non-issue serverless-linked Added by automation, don't add manually Team:Delivery Meta label for Delivery team v8.17.1 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants