Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Conversation

@inoc603
Copy link
Member

@inoc603 inoc603 commented Sep 13, 2019

Signed-off-by: inoc603 [email protected]

Ⅰ. Describe what this PR did

Remove viper.RegisterAlias("supernodes", "node"), and set the value by hand.

Ⅱ. Does this pull request fix one issue?

fixes #900

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

create a simple dfdaemon.yml:

supernodes:
- 127.0.0.1:6666

First use the config file only:

dfdaemon --config dfdaemon.yml

Look for this line in log:

use supernodes: 127.0.0.1:6666

Then use the --node flag

dfdaemon --config dfdaemon.yml --node 127.0.0.1:7777 --node 127.0.0.1:7778

And check the cli flag overrides the config file:

use supernodes: 127.0.0.1:7777,127.0.0.1:7778

Ⅴ. Special notes for reviews

@inoc603 inoc603 requested a review from yeya24 September 13, 2019 16:28
@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Sep 13, 2019
@codecov-io
Copy link

codecov-io commented Sep 13, 2019

Codecov Report

Merging #903 into master will increase coverage by 0.04%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #903      +/-   ##
==========================================
+ Coverage   46.53%   46.58%   +0.04%     
==========================================
  Files         114      114              
  Lines        6728     6730       +2     
==========================================
+ Hits         3131     3135       +4     
+ Misses       3343     3341       -2     
  Partials      254      254
Impacted Files Coverage Δ
cmd/dfdaemon/app/root.go 66.66% <83.33%> (+3.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 266923d...3b9db8c. Read the comment docs.

Copy link
Collaborator

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for this quick fix.
Also let @starnop to merge this.

r.Nil(err)
file.WriteString("supernodes:\n- 127.0.0.1:6666")
file.Close()
rootCmd.Flags().Set("config", configName)
Copy link
Contributor

Choose a reason for hiding this comment

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

And could you please add more test cases:

  1. use config file that is not exist and specify the node with cli flag
  2. neither use config file and cli flag to specify the node and the expected result should be 127.0.0.1:8002

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently there's no default value for supernodes. Should we add one?

@yeya24
Copy link
Collaborator

yeya24 commented Sep 19, 2019

What' s the progress? Can we move on this because we really need to fix this bug as soon as possible

@inoc603
Copy link
Member Author

inoc603 commented Sep 19, 2019

Added default value for node. Also changed how we override the value. Please review again @starnop @yeya24

@yeya24
Copy link
Collaborator

yeya24 commented Sep 23, 2019

@starnop

@starnop
Copy link
Contributor

starnop commented Sep 24, 2019

LGTM.

@starnop starnop merged commit 2f3ca58 into dragonflyoss:master Sep 24, 2019
starnop added a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
sungjunyoung pushed a commit to sungjunyoung/Dragonfly that referenced this pull request May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

kind/bug This is bug report for project size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] dfdaemon flag --node don't work

5 participants