Skip to content

Re-add envvar required by pulp-cli tests#1024

Merged
pedro-psb merged 1 commit intopulp:mainfrom
pedro-psb:fix-cli-tests
Mar 30, 2026
Merged

Re-add envvar required by pulp-cli tests#1024
pedro-psb merged 1 commit intopulp:mainfrom
pedro-psb:fix-cli-tests

Conversation

@pedro-psb
Copy link
Copy Markdown
Member

@pedro-psb pedro-psb commented Mar 30, 2026

PULP_API_ROOT environment variable is required by some pulp-cli tests. This re-introduces the variable only for running those tests.

Failing test (without this patch): https://github.com/pulp/pulpcore/pull/7543/checks?check_run_id=69192556708
Passing test (with this patch): https://github.com/pulp/pulpcore/pull/7543/checks?check_run_id=69195895246

{%- if docker_fixtures %}
export PULP_FIXTURES_URL="http://pulp-fixtures:8080"
# some pulp-cli tests use the api root envvar
export PULP_API_ROOT="$(EDITOR=cat pulp config edit 2>/dev/null | grep api_root | awk -F'"' '/api_root/{print $2; exit}')"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand what this command is doing. Can you explain?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's getting the api_root from pulp-cli config.

# workaround to dump the cli config. It will use cat as editor, which will just dump the file contents
EDITOR=cat pulp config edit

# filter the lines with the api_root config (hopefully only one)
grep api_root

# -F"" split fields by " (quote). '/api_root/{...}' matches lines, prints 2nd field and exit on stops on first line (if more than one line would match).
awk -F'"' '/api_root/{print $2; exit}')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm, I can get rid of the grep. Wrote it before looking for the awk thing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It should work on any machine with pulp-cli installed and configured (works on mine).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

And 2>/dev/null supresses the pulp-cli warning that the "editor" didn't do anything.

PULP_API_ROOT environment variable is required by some pulp-cli tests.
This re-introduces the variable only for running those tests.
@pedro-psb pedro-psb merged commit e6b1fe8 into pulp:main Mar 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants