Skip to content
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

Merged
merged 2 commits into from
Jul 20, 2020

Conversation

fgsch
Copy link
Member

@fgsch fgsch commented Jul 17, 2020

Use the default name if the user press enter at the name prompt.

@fgsch
Copy link
Member Author

fgsch commented Jul 17, 2020

Not sure how I can write a test but haven't checked in depth yet.

Copy link
Member

@phamann phamann left a 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)
Copy link
Member

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.

Copy link
Member Author

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.
@fgsch fgsch force-pushed the fgsch/fix-default-name branch 2 times, most recently from 50360af to 92f7867 Compare July 20, 2020 14:29
Copy link
Member

@phamann phamann left a 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

pkg/compute/compute_integration_test.go Outdated Show resolved Hide resolved
@fgsch fgsch force-pushed the fgsch/fix-default-name branch from 92f7867 to fcbb9e5 Compare July 20, 2020 14:37
@fgsch
Copy link
Member Author

fgsch commented Jul 20, 2020

Looks like you've got some failing tests after: 50360af

Yup, I will let you know when this is ready for another review. Until then please ignore this pr.

@fgsch
Copy link
Member Author

fgsch commented Jul 20, 2020

Updated and ready for another review.

@fgsch fgsch force-pushed the fgsch/fix-default-name branch from fcbb9e5 to e250e97 Compare July 20, 2020 14:46
Copy link
Member

@phamann phamann left a 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

@phamann phamann merged commit edc8efb into master Jul 20, 2020
@phamann phamann deleted the fgsch/fix-default-name branch July 20, 2020 15:02
@phamann phamann added the bug Something isn't working label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants