From 90c1608d880fa54c13b94ec02b8f8f46580feb5a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 13 May 2017 21:59:00 +0200 Subject: [PATCH] sftp: Add Benchmarks --- src/restic/backend/sftp/sftp_test.go | 38 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/restic/backend/sftp/sftp_test.go b/src/restic/backend/sftp/sftp_test.go index 8fb46d2a1..8f52b57a5 100644 --- a/src/restic/backend/sftp/sftp_test.go +++ b/src/restic/backend/sftp/sftp_test.go @@ -29,18 +29,8 @@ func findSFTPServerBinary() string { var sftpServer = findSFTPServerBinary() -func TestBackendSFTP(t *testing.T) { - defer func() { - if t.Skipped() { - SkipDisallowed(t, "restic/backend/sftp.TestBackendSFTP") - } - }() - - if sftpServer == "" { - t.Skip("sftp server binary not found") - } - - suite := test.Suite{ +func newTestSuite(t testing.TB) *test.Suite { + return &test.Suite{ // NewConfig returns a config for a new temporary backend that will be used in tests. NewConfig: func() (interface{}, error) { dir, err := ioutil.TempDir(TestTempDir, "restic-test-sftp-") @@ -80,6 +70,26 @@ func TestBackendSFTP(t *testing.T) { return nil }, } - - suite.RunTests(t) +} + +func TestBackendSFTP(t *testing.T) { + defer func() { + if t.Skipped() { + SkipDisallowed(t, "restic/backend/sftp.TestBackendSFTP") + } + }() + + if sftpServer == "" { + t.Skip("sftp server binary not found") + } + + newTestSuite(t).RunTests(t) +} + +func BenchmarkBackendSFTP(t *testing.B) { + if sftpServer == "" { + t.Skip("sftp server binary not found") + } + + newTestSuite(t).RunBenchmarks(t) }