-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Command for moving nodes between namespaces #569
Conversation
e7c376f
to
62c780a
Compare
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.
Looks good, can you have a look at adding some integration senario as well? integration_cli_test.go
cmd/headscale/cli/nodes.go
Outdated
moveNodeCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)") | ||
err = moveNodeCmd.MarkFlagRequired("identifier") | ||
if err != nil { | ||
log.Fatalf(err.Error()) | ||
} | ||
moveNodeCmd.Flags().StringP("namespace", "n", "", "New namespace") | ||
err = moveNodeCmd.MarkFlagRequired("namespace") | ||
if err != nil { | ||
log.Fatalf(err.Error()) | ||
} | ||
nodeCmd.AddCommand(moveNodeCmd) |
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.
moveNodeCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)") | |
err = moveNodeCmd.MarkFlagRequired("identifier") | |
if err != nil { | |
log.Fatalf(err.Error()) | |
} | |
moveNodeCmd.Flags().StringP("namespace", "n", "", "New namespace") | |
err = moveNodeCmd.MarkFlagRequired("namespace") | |
if err != nil { | |
log.Fatalf(err.Error()) | |
} | |
nodeCmd.AddCommand(moveNodeCmd) | |
moveNodeCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)") | |
err = moveNodeCmd.MarkFlagRequired("identifier") | |
if err != nil { | |
log.Fatalf(err.Error()) | |
} | |
moveNodeCmd.Flags().StringP("namespace", "n", "", "New namespace") | |
err = moveNodeCmd.MarkFlagRequired("namespace") | |
if err != nil { | |
log.Fatalf(err.Error()) | |
} | |
nodeCmd.AddCommand(moveNodeCmd) |
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.
Looks good, can you have a look at adding some integration senario as well?
integration_cli_test.go
On it!
Alright, the integration test was a lifesaver. Turns out that a machine's namespace wasn't updating properly. |
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.
Great!, one tiny extra safety, but otherwise great!
err = json.Unmarshal([]byte(moveToNewNSResult), &machine) | ||
assert.Nil(s.T(), err) | ||
|
||
assert.Equal(s.T(), machine.Namespace, newNamespace) |
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.
Could you yank the nodes list
code from one of the other tests just to verify that we can read it back correctly after move?
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.
Sure, no problems!
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.
Done
Added command for moving nodes between namespaces (see #362)