-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix bug where name was not added to the manifest #143
Conversation
Not sure how I can write a test but haven't checked in depth yet. |
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.
Thanks for finding and fixing this issue @fgsch.
Also agree it would be good to get some test coverage on this. So if you don't mind can you add a test to the table in TestInit
in pkg/compute/compute_integration_test.go
. As a new temporary directory is dynamically created for each test it's probably easier just to match on the fastly-build
prefix using the manifestIncludes
property, so something like this should work:
{
name: "with default name inferred from directory",
args: []string{"compute", "init"},
configFile: config.File{Token: "123"},
api: mock.API{
GetTokenSelfFn: tokenOK,
GetUserFn: getUserOk,
CreateServiceFn: createServiceOK,
CreateDomainFn: createDomainOK,
CreateBackendFn: createBackendOK,
},
wantOutput: []string{
"Initializing...",
"Fetching package template...",
"Updating package manifest...",
},
manifestIncludes: `name = "fastly-build`,
},
Hope that helps.
@@ -151,13 +151,14 @@ func (c *InitCommand) Exec(in io.Reader, out io.Writer) (err error) { | |||
c.path = abspath | |||
|
|||
if name == "" { | |||
name = filepath.Base(c.path) | |||
fmt.Fprintf(progress, "--name not specified, using %s\n\n", name) |
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.
Would be good to keep the verbose output 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.
None of the other options that have defaults show this and the message is incorrect since this is not necessarily the name you will end up using so I think removing this is better.
Use the default name if the user press enter at the name prompt.
50360af
to
92f7867
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 like you've got some failing tests after: 50360af
92f7867
to
fcbb9e5
Compare
Yup, I will let you know when this is ready for another review. Until then please ignore this pr. |
Updated and ready for another review. |
Test from @phamann.
fcbb9e5
to
e250e97
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.
LGTM - thank you for your contribution
Use the default name if the user press enter at the name prompt.