summaryrefslogtreecommitdiffstats
path: root/api/file_benchmark_test.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-08-15 17:38:55 -0400
committerenahum <nahumhbl@gmail.com>2016-08-15 16:38:55 -0500
commitc5fc504cb26be0c2e96083c0bad6c79d278e3afc (patch)
tree5b160834ad1382ba77a5d63411817469a019862a /api/file_benchmark_test.go
parent782d5f64e7661f123be112e67037b99cea180923 (diff)
downloadchat-c5fc504cb26be0c2e96083c0bad6c79d278e3afc.tar.gz
chat-c5fc504cb26be0c2e96083c0bad6c79d278e3afc.tar.bz2
chat-c5fc504cb26be0c2e96083c0bad6c79d278e3afc.zip
PLT-3617 Switched public file links to use a sha256 hash (#3792)
* Changed FileSettings.PublicLinkSalt to be a pointer * Switched public file links to use a sha256 hash
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)
}
}