-
Notifications
You must be signed in to change notification settings - Fork 71
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
Allow instance rename #526
Conversation
Signed-off-by: Din Music <[email protected]>
9beb9e2
to
fd6cc54
Compare
{ | ||
// Ensure instance rename fails when instance is running. | ||
Config: testAccInstance_rename(instanceNameA, true), | ||
ExpectError: regexp.MustCompile("Renaming of running instance not allowed"), |
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.
Should we also have the resource.TestCheckResourceAttr("lxd_instance.instance1", "name", instanceNameB),
checked here?
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.
Not sure if state is testable when error is expected, but worth trying.
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.
Seems to be working. Thanks :)
}, | ||
{ | ||
// Stop and rename the instance. | ||
Config: testAccInstance_rename(instanceNameB, false), |
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.
The provided name could be a bit more indicative of the intention. Say the instance started with A
, then move to A2B
-> B2C
-> C2D
-(fail)-> D2E
.
Just an idea as I think what you have is fine, it just required a bit more mental tracking.
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.
Hehe, will fix :)
Signed-off-by: Din Music <[email protected]>
fd6cc54
to
4e5f92b
Compare
Instead of replacing an instance, allow instance to be renamed. This is only possible if instance is either currently stopped or the
running
field is set tofalse
.