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

Use agents beaker DSL method #9244

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

joshcooper
Copy link
Contributor

Beaker's singular agent method can either return a single host or an array of hosts, depending on how many hosts have the agent role in your beaker config. For example, when running with redhat7-64m-ubuntu2004-64a, then it will return a single host. If running with redhat7-64ma-ubuntu2004-64a, then it will return an array of hosts[1].

The beaker agent method should never be used as it can cause tests to pass in agent CI, but fail in puppetserver CI, since they test the agent running on the server host.

Instead reference the agents method, which is guaranteed to exist and return an array, possible empty.

Also use the fact_on helper which parses the facter output as JSON and avoids having to chomp newlines in the output.

[1] https://github.com/voxpupuli/beaker/blob/abd5b30e93061b44e45f2211bc6a73cb6e20b353/lib/beaker/dsl/roles.rb#L181-L187

Beaker's singular `agent` DSL method can either return a single host or an array
of hosts, depending on how many hosts have the agent role in your beaker config.
For example, when running with `redhat7-64m-ubuntu2004-64a`, then it will return
a single host. If running with `redhat7-64ma-ubuntu2004-64a`, then it will
return an array of hosts[1].

The beaker `agent` method should never be used as it can cause tests to pass in
agent CI, but fail in puppetserver CI, since they test the agent running on the
server host.

Instead reference the `agents` method, which is guaranteed to exist and return
an array, possible empty.

Also use the `fact_on` helper which parses the facter output as JSON and avoids
having to chomp newlines in the output.

[1] https://github.com/voxpupuli/beaker/blob/abd5b30e93061b44e45f2211bc6a73cb6e20b353/lib/beaker/dsl/roles.rb#L181-L187
@joshcooper joshcooper requested a review from a team as a code owner February 6, 2024 05:51
@joshcooper
Copy link
Contributor Author

jenkins please test this on redhat7-64a,ubuntu2004-64a

1 similar comment
@joshcooper
Copy link
Contributor Author

jenkins please test this on redhat7-64a,ubuntu2004-64a

@mhashizume mhashizume merged commit 3379bce into puppetlabs:main Feb 6, 2024
15 checks passed
@mhashizume mhashizume added maintenance Maintenance chores are excluded from changelogs backport 7.x Generate a backport PR to 7.x labels Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

Successfully created backport PR for 7.x:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 7.x Generate a backport PR to 7.x maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants