-
-
Notifications
You must be signed in to change notification settings - Fork 762
st2client - elapsed time in a more user-friendly format #4963
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
Draft
winem
wants to merge
19
commits into
StackStorm:master
Choose a base branch
from
winem:issue-4944-stcli-elapsed-time-more-readable
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
43c80be
Change the presentation of elapsed time on st2 execution get to a mor…
winem 0e76b0c
drop space between days and hours if the elapsed time is > 86400 seconds
winem dc5b830
Remove space between days and hours from changelog (more user-friendl…
winem a265346
remove repeating spaces before operator to pass lint checks
winem aafca8b
add unit test to parse the elapsed time for the expected format
winem 724c68a
Merge branch 'master' into issue-4944-stcli-elapsed-time-more-readable
winem d4e6bba
Add unit test for st2client with hours in elapsed time
winem e99819f
Revert "add unit test to parse the elapsed time for the expected format"
winem 3d2af58
try to fix unexpected duration reported
winem 98ffc97
test with a duration >1 day
winem 7135b76
troubleshooting failing unit test (elapsed time)
winem befa79a
Revert "troubleshooting failing unit test (elapsed time)"
winem 7430732
change end timestamp for another test
winem c5d8e63
use mock.path.object to create DURATION_HOURS response object
winem 52bc3d3
Revert "use mock.path.object to create DURATION_HOURS response object"
winem 41874c7
revert the DURATION_HOURS tests and go back to the initial one
winem 15a4b64
reduce the duration back from 1d2h0m1s ot 2h0m1s
winem 25f91d8
break line to fix lint issue
winem 3765c1f
Merge branch 'master' into issue-4944-stcli-elapsed-time-more-readable
winem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
st2client/tests/fixtures/execution_get_attribute_with_hours_in_elapsed_time.txt
This file contains hidden or 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 @@ | ||
status: succeeded (2h0m1s elapsed) |
29 changes: 29 additions & 0 deletions
29
st2client/tests/fixtures/execution_with_hours_in_elapsed_time.json
This file contains hidden or 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,29 @@ | ||
{ | ||
"id": "547e19561e2e2417d3dde398", | ||
"parameters": { | ||
"cmd": "127.0.0.1 3" | ||
}, | ||
"callback": {}, | ||
"context": { | ||
"user": "stanley" | ||
}, | ||
"result": { | ||
"localhost": { | ||
"failed": false, | ||
"stderr": "", | ||
"return_code": 0, | ||
"succeeded": true, | ||
"stdout": "PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.\n64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.015 ms\n64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.024 ms\n64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.030 ms\n\n--- 127.0.0.1 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 1998ms\nrtt min/avg/max/mdev = 0.015/0.023/0.030/0.006 ms" | ||
} | ||
}, | ||
"status": "succeeded", | ||
"start_timestamp": "2014-12-02T19:56:06.900000Z", | ||
"end_timestamp": "2014-12-02T21:56:07.000000Z", | ||
"action": { | ||
"ref": "core.ping" | ||
}, | ||
"liveaction": { | ||
"callback": {}, | ||
"id": "1" | ||
} | ||
} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think using
self._get_execution()
is the source of the error because_get_execution()
has a mock so it always returns the json fromEXECUTION
, but you need it to returnDURATION_HOURS
.Here's
_get_execution
with the mockedEXECUTION
response:That's why your example unit test that uses mock.MagicMock worked better than
self._get_execution()
.