Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ jobs:
run: make test
shell: bash
env:
# NOTE: The following lets us focus the test run while debugging.
# TEST_ARGS: "-run TestDeploy ./pkg/commands/compute/..."
TEST_COMPUTE_INIT: true
TEST_COMPUTE_BUILD: true
TEST_COMPUTE_DEPLOY: true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
)

require (
github.com/fastly/go-fastly/v8 v8.5.4
github.com/fastly/go-fastly/v8 v8.5.5
github.com/kennygrant/sanitize v1.2.4
github.com/mholt/archiver v3.1.1+incompatible
github.com/otiai10/copy v1.12.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 h1:90Ly+6UfUypEF6vvvW5rQIv9opIL8CbmW9FT20LDQoY=
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0/go.mod h1:V+Qd57rJe8gd4eiGzZyg4h54VLHmYVVw54iMnlAMrF8=
github.com/fastly/go-fastly/v8 v8.5.4 h1:uyu5xfnGB0HBELC+TEpCrX01QDP5NbdAbifh1R5duT8=
github.com/fastly/go-fastly/v8 v8.5.4/go.mod h1:m/QWKyZsuH8Ow3tDkRLqlbvbJdxalRGkTT3ZKxZJ4eo=
github.com/fastly/go-fastly/v8 v8.5.5 h1:okmeQDxjyK9FEh5mj2K+AwN9SiZDz3epQHm4dAh3+2s=
github.com/fastly/go-fastly/v8 v8.5.5/go.mod h1:jmjaUGq1RUdP05XOuD1ICvuuzo0EdCexShviy2sFfHU=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:FhrXlfhgGCS+uc6YwyiFUt04alnjpoX7vgDKJxS6Qbk=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/compute/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ func TestDeploy(t *testing.T) {
select {
case <-done:
// Wait for app.Run() to finish
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
t.Fatalf("unexpected timeout waiting for mocked prompt inputs to be processed")
}
} else {
Expand Down
25 changes: 23 additions & 2 deletions pkg/commands/kvstoreentry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ func (c *CreateCommand) PromptWindowsUser(in io.Reader, out io.Writer) (bool, er
// CallBatchEndpoint calls the batch API endpoint.
func (c *CreateCommand) CallBatchEndpoint(in io.Reader, out io.Writer) error {
type result struct {
Success bool `json:"success"`
Success bool `json:"success"`
Errors []*fastly.ErrorObject `json:"errors,omitempty"`
}

if err := c.Globals.APIClient.BatchModifyKVStoreKey(&fastly.BatchModifyKVStoreKeyInput{
Expand All @@ -371,11 +372,31 @@ func (c *CreateCommand) CallBatchEndpoint(in io.Reader, out io.Writer) error {
}); err != nil {
c.Globals.ErrLog.Add(err)

r := result{Success: false}

he, ok := err.(*fastly.HTTPError)
if ok {
r.Errors = append(r.Errors, he.Errors...)
}

if c.JSONOutput.Enabled {
_, err := c.WriteJSON(out, result{Success: false})
_, err := c.WriteJSON(out, r)
return err
}

// If we were able to convert the error into a fastly.HTTPError, then
// display those errors to the user, otherwise we'll display the original
// error type.
if ok {
for i, e := range he.Errors {
text.Output(out, "Error %d", i)
text.Output(out, "Title: %s", e.Title)
text.Output(out, "Code: %s", e.Code)
text.Output(out, "Detail: %s", e.Detail)
text.Break(out)
}
return he
}
return err
}

Expand Down