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: remote services ls always return a list #7829

Merged
merged 2 commits into from
Jan 14, 2021
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: 1 addition & 1 deletion core/commands/pin/remotepin.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ var lsRemotePinServiceCmd = &cmds.Command{
return err
}
if cfg.Pinning.RemoteServices == nil {
return nil // no pinning services added yet
return cmds.EmitOnce(res, &PinServicesList{make([]ServiceDetails, 0)})
}
services := cfg.Pinning.RemoteServices
result := PinServicesList{make([]ServiceDetails, 0, len(services))}
Expand Down
8 changes: 8 additions & 0 deletions test/sharness/t0700-remotepin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ TEST_PIN_SVC_KEY=$(curl -s -X POST "$TEST_PIN_SVC/users" -d email="go-ipfs-sharn

# pin remote service add|ls|rm

# confirm empty service list response has proper json struct
# https://github.com/ipfs/go-ipfs/pull/7829
test_expect_success "test 'ipfs pin remote service ls' JSON on empty list" '
ipfs pin remote service ls --stat --enc=json | tee empty_ls_out &&
echo "{\"RemoteServices\":[]}" > exp_ls_out &&
test_cmp exp_ls_out empty_ls_out
'

# add valid and invalid services
test_expect_success "creating test user on remote pinning service" '
echo CI host IP address ${TEST_PIN_SVC} &&
Expand Down