|
|
@ -14,13 +14,10 @@ |
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package main |
|
|
|
package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"flag" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
@ -28,6 +25,7 @@ import ( |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"runtime" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
"time" |
|
|
|
"time" |
|
|
@ -37,8 +35,6 @@ import ( |
|
|
|
"github.com/mattn/go-colorable" |
|
|
|
"github.com/mattn/go-colorable" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var loglevel = flag.Int("loglevel", 3, "verbosity of logs") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
func init() { |
|
|
|
log.PrintOrigins(true) |
|
|
|
log.PrintOrigins(true) |
|
|
|
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*loglevel), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))) |
|
|
|
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*loglevel), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true)))) |
|
|
@ -47,18 +43,31 @@ func init() { |
|
|
|
// TestCLISwarmUp tests that running 'swarm up' makes the resulting file
|
|
|
|
// TestCLISwarmUp tests that running 'swarm up' makes the resulting file
|
|
|
|
// available from all nodes via the HTTP API
|
|
|
|
// available from all nodes via the HTTP API
|
|
|
|
func TestCLISwarmUp(t *testing.T) { |
|
|
|
func TestCLISwarmUp(t *testing.T) { |
|
|
|
|
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
|
|
|
|
t.Skip() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
testCLISwarmUp(false, t) |
|
|
|
testCLISwarmUp(false, t) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestCLISwarmUpRecursive(t *testing.T) { |
|
|
|
func TestCLISwarmUpRecursive(t *testing.T) { |
|
|
|
|
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
|
|
|
|
t.Skip() |
|
|
|
|
|
|
|
} |
|
|
|
testCLISwarmUpRecursive(false, t) |
|
|
|
testCLISwarmUpRecursive(false, t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TestCLISwarmUpEncrypted tests that running 'swarm encrypted-up' makes the resulting file
|
|
|
|
// TestCLISwarmUpEncrypted tests that running 'swarm encrypted-up' makes the resulting file
|
|
|
|
// available from all nodes via the HTTP API
|
|
|
|
// available from all nodes via the HTTP API
|
|
|
|
func TestCLISwarmUpEncrypted(t *testing.T) { |
|
|
|
func TestCLISwarmUpEncrypted(t *testing.T) { |
|
|
|
|
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
|
|
|
|
t.Skip() |
|
|
|
|
|
|
|
} |
|
|
|
testCLISwarmUp(true, t) |
|
|
|
testCLISwarmUp(true, t) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestCLISwarmUpEncryptedRecursive(t *testing.T) { |
|
|
|
func TestCLISwarmUpEncryptedRecursive(t *testing.T) { |
|
|
|
|
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
|
|
|
|
t.Skip() |
|
|
|
|
|
|
|
} |
|
|
|
testCLISwarmUpRecursive(true, t) |
|
|
|
testCLISwarmUpRecursive(true, t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -279,6 +288,9 @@ func testCLISwarmUpRecursive(toEncrypt bool, t *testing.T) { |
|
|
|
// TestCLISwarmUpDefaultPath tests swarm recursive upload with relative and absolute
|
|
|
|
// TestCLISwarmUpDefaultPath tests swarm recursive upload with relative and absolute
|
|
|
|
// default paths and with encryption.
|
|
|
|
// default paths and with encryption.
|
|
|
|
func TestCLISwarmUpDefaultPath(t *testing.T) { |
|
|
|
func TestCLISwarmUpDefaultPath(t *testing.T) { |
|
|
|
|
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
|
|
|
|
t.Skip() |
|
|
|
|
|
|
|
} |
|
|
|
testCLISwarmUpDefaultPath(false, false, t) |
|
|
|
testCLISwarmUpDefaultPath(false, false, t) |
|
|
|
testCLISwarmUpDefaultPath(false, true, t) |
|
|
|
testCLISwarmUpDefaultPath(false, true, t) |
|
|
|
testCLISwarmUpDefaultPath(true, false, t) |
|
|
|
testCLISwarmUpDefaultPath(true, false, t) |
|
|
|