summaryrefslogtreecommitdiffstats
path: root/api/file_benchmark_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/file_benchmark_test.go')
-rw-r--r--api/file_benchmark_test.go13
1 files changed, 1 insertions, 12 deletions
diff --git a/api/file_benchmark_test.go b/api/file_benchmark_test.go
index f14d501ff..0e0fc105b 100644
--- a/api/file_benchmark_test.go
+++ b/api/file_benchmark_test.go
@@ -4,10 +4,7 @@
package api
import (
- "fmt"
- "github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- "net/url"
"testing"
"time"
)
@@ -29,7 +26,6 @@ func BenchmarkUploadFile(b *testing.B) {
func BenchmarkGetFile(b *testing.B) {
th := Setup().InitBasic()
Client := th.BasicClient
- team := th.BasicTeam
channel := th.BasicChannel
testPoster := NewAutoPostCreator(Client, channel.Id)
@@ -38,20 +34,13 @@ func BenchmarkGetFile(b *testing.B) {
b.Fatal("Unable to upload file for benchmark")
}
- newProps := make(map[string]string)
- newProps["filename"] = filenames[0]
- newProps["time"] = fmt.Sprintf("%v", model.GetMillis())
-
- data := model.MapToJson(newProps)
- hash := model.HashPassword(fmt.Sprintf("%v:%v", data, utils.Cfg.FileSettings.PublicLinkSalt))
-
// wait a bit for files to ready
time.Sleep(5 * time.Second)
// Benchmark Start
b.ResetTimer()
for i := 0; i < b.N; i++ {
- if _, downErr := Client.GetFile(filenames[0]+"?d="+url.QueryEscape(data)+"&h="+url.QueryEscape(hash)+"&t="+team.Id, true); downErr != nil {
+ if _, downErr := Client.GetFile(filenames[0]+"?h="+generatePublicLinkHash(filenames[0], *utils.Cfg.FileSettings.PublicLinkSalt), true); downErr != nil {
b.Fatal(downErr)
}
}