-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes 60 - `off` and `cycle` `power off` and `power cycle` had `Args: cobra.MinimumNArgs(1)` set. This was previously removed for several other commands because it broke piping. When piping occurs, at least with how `gru` accepts piped arguments, the `args[]` slice is empty. In order for piping to work, we can not set a minimum number of arguments. There may be another way to handle piping, assuming there's a way to get in front of Cobra. * add power cycle tests and update power off to use STDIN (#66) * add power cycle tests and update power off to use STDIN Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com> * Update spec/functional/chassis_power_cycle_spec.sh --------- Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com> Co-authored-by: Russell Bunch <doomslayer@hpe.com> --------- Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com> Co-authored-by: Jacob Salmela <me@jacobsalmela.com>
- Loading branch information
1 parent
44d4b5d
commit b8bc3da
Showing
4 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env sh | ||
# MIT License | ||
# | ||
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP | ||
# | ||
# Permissioff is hereby granted, free of charge, to any persoff obtaining a | ||
# copy of this software and associated documentatioff files (the "Software"), | ||
# to deal in the Software without restriction, including without limitation | ||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
# and/or sell copies of the Software, and to permit persons to whom the | ||
# Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permissioff notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
# OTHER LIABILITY, WHETHER IN AN ACTIoff OF CONTRACT, TORT OR OTHERWISE, | ||
# ARISING FROM, OUT OF OR IN CONNECTIoff WITH THE SOFTWARE OR THE USE OR | ||
# OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
Describe 'gru chassis power cycle' | ||
|
||
# Running against an active host with good credentials should succeed and show output | ||
It "--config ${GRU_CONF} 127.0.0.1:5000" | ||
BeforeCall use_valid_config | ||
When call ./gru chassis power cycle --config "${GRU_CONF}" 127.0.0.1:5000 | ||
The status should equal 0 | ||
The line 1 of stderr should include 'Asynchronously updating' | ||
The line 1 of stdout should equal '127.0.0.1:5000:' | ||
The line 2 of stdout should include 'PreviousPowerState' | ||
The line 3 of stdout should include 'RequestedPowerState' | ||
The line 3 of stdout should include 'GracefulRestart' | ||
The lines of stderr should equal 1 | ||
End | ||
|
||
# validate piping to STDIN works | ||
It "--config ${GRU_CONF} (via STDIN)" | ||
BeforeCall use_valid_config | ||
|
||
Data "127.0.0.1:5000" # STDIN | ||
|
||
When call ./gru chassis power cycle --config "${GRU_CONF}" | ||
The status should equal 0 | ||
The line 1 of stderr should include 'Asynchronously updating' | ||
The line 1 of stdout should equal '127.0.0.1:5000:' | ||
The line 2 of stdout should include 'PowerState' | ||
The line 3 of stdout should include 'GracefulRestart' | ||
The line 4 of stdout should include "reset type 'GracefulRestart' is not supported by this service" | ||
The lines of stderr should equal 1 | ||
End | ||
|
||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters