-
Notifications
You must be signed in to change notification settings - Fork 12
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
Set RABBITMQ_PLUGINS_DIR when starting the server #273
base: main
Are you sure you want to change the base?
Conversation
@fizyk, tests seem to fail. Could it be that some of the integration tests point to a plugins directory which isn't actually valid for RabbitMQ? |
@akaihola by default it points to the tempdir, maybe that's why. It's fine to have there a temporary plugin's file, but ni plugin directory (with some random stuff possibly) |
So creating an empty directory (e.g. with tempfile.TemporaryDirectory()) would probably be more appropriate? |
@akaihola yes, I think so, so the default should be a new temporary directory within tempdir, rather than tmpdir itself. |
The tests do pass if I run them locally in a container. Any idea what is different in the GitHub Workflows environment? I'm using this FROM python
RUN apt-get update \
&& apt-get install -y rabbitmq-server \
&& rm -rf /var/lib/apt/lists/*
COPY . /pytest-rabbitmq
WORKDIR /pytest-rabbitmq
RUN python -m pip install --upgrade pip
RUN pip install -r requirements-test.txt
CMD pytest -n 0 --cov-report=xml \
&& pytest -n 1 --cov-report=xml:coverage-xdist.xml And it indeed runs fine:
|
@akaihola looking at this I think the difference is the lack of administrative privileges. your local run on docker is being run with root, so it does have all privileges. The github actions run is used with a user without those privileges, and maybe the plugin_path is restricted, or it's creation would require root privileges 🤔 |
Thanks @fizyk, I trust you that the lack of admin privileges is indeed the culprit here. I couldn't find a pre-built Docker image which would claim to be close to GitHub's |
You have to create separate user on your docker, and switch to it prior to requirements installation and run: |
@fizyk, I tried with this FROM python
RUN apt-get update \
&& apt-get install -y rabbitmq-server \
&& rm -rf /var/lib/apt/lists/*
COPY src /pytest-rabbitmq/src
COPY tests /pytest-rabbitmq/tests
COPY setup.* /pytest-rabbitmq/
COPY requirements-test.txt /pytest-rabbitmq/
WORKDIR /pytest-rabbitmq
RUN useradd -m pyuser \
&& chown -R pyuser /pytest-rabbitmq
USER pyuser
ENV PATH /home/pyuser/.local/bin:$PATH
RUN python -m pip install --upgrade pip
RUN pip install -r requirements-test.txt
CMD pytest -n 0 --cov-report=xml \
&& pytest -n 1 --cov-report=xml:coverage-xdist.xml |
@akaihola do you have a branch I could look at when I'll have spare time? |
@fizyk, I'm using the very branch of this pull request (akaihola:plugin-dir) with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've merged main branch and added additional commit removing the default value, however after a bit of thinking I believe there's no real need for default, the default, should be not to use these settings. And only use them if someone will pass the configuration options.
@@ -37,7 +37,8 @@ def __init__( | |||
envvars = { | |||
"RABBITMQ_LOG_BASE": logpath + f"/rabbit-server.{port}.log", | |||
"RABBITMQ_MNESIA_BASE": path + "mnesia", | |||
"RABBITMQ_ENABLED_PLUGINS_FILE": plugin_path + "/plugins", | |||
"RABBITMQ_ENABLED_PLUGINS_FILE": plugin_path + "/enabled", | |||
"RABBITMQ_PLUGINS_DIR": plugin_path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 maybe skip both settings if the plugin's dir does not exists? question, what happens if we'll point to the real files and paths, will it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my thinking is that there's not much point to point to the default for both of these settings (enabled_plugin_file and plugins_dir) if they are not existing.
@@ -96,7 +96,7 @@ def rabbitmq_proc_fixture(request): | |||
rabbit_port = get_port(port) or get_port(config["port"]) | |||
|
|||
rabbit_path = os.path.join(gettempdir(), f"rabbitmq.{rabbit_port}/") | |||
rabbit_plugin_path = plugindir or config["plugindir"] or rabbit_path | |||
rabbit_plugin_path = plugindir or config["plugindir"] or os.path.join(rabbit_path, "plugins") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the default to None, and pointed to plugins inside the created rabbit_path as created above. However I believe it should no have default
It seems init terminating in do_boot
({undef,
[{rabbit_nodes_common,make,test3,[]},
{rabbit_prelaunch,start,0,[{_},{_}]},
{init,start_em,1,[]},
{init,do_boot,3,[]}]
})
Crash dump is being written to: /tmp/rabbit-server.28723.log/erl_crash.dump... This goes way beyond my expertise unfortunately. |
As most of the Java programs when they crash for me. I won't promise when, but I'll take a look at it someday... |
Although RabbitMQ isn't written in Java but in Erlang. |
Only
RABBITMQ_ENABLED_PLUGINS_FILE
was being set, but and any.ez
files in the directory specified using the--rabbitmq-plugindir
Pytest option would be ignored.