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

redfishpower: support test mode #143

Merged
merged 7 commits into from
Feb 10, 2024
Merged

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Feb 10, 2024

Problem: As redfishpower gets more complex, testing of the actual redfishpower co-process instead of the simulated one under t/simulators will become important.

Add a test-mode into redfishpower via a --test-mode option. The test mode essentially disables all internal curl API calls so no actual network communication is done. All network calls are just assumed to work immediately. The power status of all hosts is tracked after off/on/cycle calls are made.

Problem: There is some inconsistent tabbing.

Fix it!
Problem: In several functions curl API calls are not "grouped"
together.  They are oddly called at different points in the
function even though it is not necessary.  This is likely due to
early development and cleanup was forgotten.

Group the curl API calls together so the code is a little cleaner.
Problem: The commands "stat", "on", "off", and "cycle" are hard coded
everywhere.  This isn't good programming practice.

Create macros CMD_STAT, CMD_ON, CMD_OFF, and CMD_CYCLE instead of
hard coding it everywhere.
Problem: As redfishpower gets more complex, testing of the actual
redfishpower co-process instead of the simulated one under t/simulators
will become important.

Add a test-mode into redfishpower via a --test-mode option.  The
test mode essentially disables all internal curl API calls so no
actual network communication is done.  All network calls are just
assumed to work immediately.  The power status of all hosts is
tracked after off/on/cycle calls are made.

Fixes chaos#131
Problem: Redfishpower now has a test mode, but it is not being
used.

Use it in t0029-redfish.t.
Problem: Redfishpower now has a --test-mode option, so the redfishpower
simulator is no longer needed.

Remove the redfishpower simulator from t/simulators.
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM! This will be better.

Did you see the simulator and dev script in #127? Just wanted to make sure you saw what was proposed there as it was intended to be kind of a design proposal, but not important for this PR!

@chu11
Copy link
Member Author

chu11 commented Feb 10, 2024

Did you see the simulator and dev script in #127? Just wanted to make sure you saw what was proposed there as it was intended to be kind of a design proposal, but not important for this PR!

Ahhh didn't see the tweaks you made there. Yeah, next step will be to come up with the exact config design we wanna use.

@chu11
Copy link
Member Author

chu11 commented Feb 10, 2024

FYI throwing up some fixups as I'm trying to figure out what is wrong with distcheck on CI. I think it's mostly related to the distcheck not finding the redfishpower binary.

Problem: The t0029-redfish.t test now uses the redfishpower
--test-mode option, not the redfishpower simulator.  This
requires 'make distcheck' to build redfishpower.

Set the DISTCHECK_CONFIGURE_FLAGS environment variable to
ensure distcheck builds redfishpower.
@garlick
Copy link
Member

garlick commented Feb 10, 2024

I proposed a set of commands, implemented them in the simulator and added a test with a faux el cap config. It probably means having a hash of plugs rather than a hash of hosts, with plug->host optionally pointing to a host taken from -h (by configured index), and in the common / legacy case the plug name == the host name. But all the set commands are targetted at plugs by design.

@mergify mergify bot merged commit 3939b01 into chaos:master Feb 10, 2024
8 checks passed
@chu11 chu11 deleted the redfishpower_test_mode branch February 10, 2024 20:28
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