cmd/swarm: fixed comments and remove sprintf from log.Info

This commit is contained in:
Javier Peletier 2018-11-25 21:41:44 +01:00
parent 2bd410608c
commit e0f643f390

View file

@ -19,7 +19,6 @@ package main
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"testing" "testing"
@ -69,7 +68,7 @@ func TestCLIFeedUpdate(t *testing.T) {
hexData} hexData}
// create an update and expect an exit without errors // create an update and expect an exit without errors
log.Info(fmt.Sprintf("updating a feed with 'swarm feed update'")) log.Info("updating a feed with 'swarm feed update'")
cmd := runSwarm(t, flags...) cmd := runSwarm(t, flags...)
cmd.ExpectExit() cmd.ExpectExit()
@ -116,7 +115,7 @@ func TestCLIFeedUpdate(t *testing.T) {
"--user", address.Hex(), "--user", address.Hex(),
} }
log.Info(fmt.Sprintf("getting feed info with 'swarm feed info'")) log.Info("getting feed info with 'swarm feed info'")
cmd = runSwarm(t, flags...) cmd = runSwarm(t, flags...)
_, matches := cmd.ExpectRegexp(`.*`) // regex hack to extract stdout _, matches := cmd.ExpectRegexp(`.*`) // regex hack to extract stdout
cmd.ExpectExit() cmd.ExpectExit()
@ -141,7 +140,7 @@ func TestCLIFeedUpdate(t *testing.T) {
"--topic", topic.Hex(), "--topic", topic.Hex(),
} }
log.Info(fmt.Sprintf("Publishing manifest with 'swarm feed create'")) log.Info("Publishing manifest with 'swarm feed create'")
cmd = runSwarm(t, flags...) cmd = runSwarm(t, flags...)
_, matches = cmd.ExpectRegexp(`[a-f\d]{64}`) // regex hack to extract stdout _, matches = cmd.ExpectRegexp(`[a-f\d]{64}`) // regex hack to extract stdout
cmd.ExpectExit() cmd.ExpectExit()
@ -166,13 +165,12 @@ func TestCLIFeedUpdate(t *testing.T) {
// test publishing a manifest for a different user // test publishing a manifest for a different user
flags = []string{ flags = []string{
"--bzzapi", srv.URL, "--bzzapi", srv.URL,
"--bzzaccount", pkFileName,
"feed", "create", "feed", "create",
"--topic", topic.Hex(), "--topic", topic.Hex(),
"--user", "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // different user "--user", "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // different user
} }
log.Info(fmt.Sprintf("Publishing manifest with 'swarm feed create' for a different user")) log.Info("Publishing manifest with 'swarm feed create' for a different user")
cmd = runSwarm(t, flags...) cmd = runSwarm(t, flags...)
_, matches = cmd.ExpectRegexp(`[a-f\d]{64}`) // regex hack to extract stdout _, matches = cmd.ExpectRegexp(`[a-f\d]{64}`) // regex hack to extract stdout
cmd.ExpectExit() cmd.ExpectExit()
@ -187,8 +185,8 @@ func TestCLIFeedUpdate(t *testing.T) {
"--manifest", manifestAddress, "--manifest", manifestAddress,
hexData} hexData}
// create an update and expect an exit without errors // create an update and expect an error given there is a user mismatch
log.Info(fmt.Sprintf("updating a feed with 'swarm feed update'")) log.Info("updating a feed with 'swarm feed update'")
cmd = runSwarm(t, flags...) cmd = runSwarm(t, flags...)
cmd.ExpectRegexp("Fatal:.*") // best way so far to detect a failure. cmd.ExpectRegexp("Fatal:.*") // best way so far to detect a failure.
cmd.ExpectExit() cmd.ExpectExit()