Skip to content

Conversation

@trapier
Copy link

@trapier trapier commented Sep 23, 2019

- What I did

Add --format output flag to dump-{object,snapshot,wal} which defaults to
"text" (current style) and also accepts "json".

Hopefully this will greatly facilitate future analysis of raft dumps, which are
currently only available as walls of pretty printed protobuf.

- How I did it
Added cobra flag with validation and introduced switch statements to dump path.

- How to test it

  • Run dump-{object,snapshot,wal} with --format nope. Confirm this errors
    and prints help.
  • Run dump-{object,snapshot,wal} without the --format flag, or with --format text. Confirm the output is unchanged from present.
  • Run dump-{object,snapshot,wal} with --format json. Pipe the output to
    jq or other json parser and confirm there are no parsing errors. Confirm
    information previously presented (e.g. event index from WAL) is still communicated
    via the json format.

- Description for the changelog
N/A

Add --format output flag which defaults to "text" (current style) and also accepts
"json".

Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
@trapier trapier changed the title swarm-rafttool: add output format flag swarm-rafttool: add json output format flag Sep 23, 2019
@codecov
Copy link

codecov bot commented Sep 23, 2019

Codecov Report

Merging #2898 into master will decrease coverage by 0.38%.
The diff coverage is 3.61%.

@@            Coverage Diff             @@
##           master    #2898      +/-   ##
==========================================
- Coverage    61.7%   61.32%   -0.39%     
==========================================
  Files         139      139              
  Lines       22615    22677      +62     
==========================================
- Hits        13955    13906      -49     
- Misses       7188     7304     +116     
+ Partials     1472     1467       -5

Copy link
Author

@trapier trapier left a comment

Choose a reason for hiding this comment

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

need to pretty-print json output.

Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
@trapier
Copy link
Author

trapier commented Sep 24, 2019

now with pretty-printed json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant