Commit 38ee83e4 authored by Christopher Speller's avatar Christopher Speller
Browse files

Moving to glide

parent 84d2482d
......@@ -69,6 +69,8 @@ web/sass-files/sass/.sass-cache/
data/*
api/data/*
enterprise
.agignore
.ctags
tags
{
"ImportPath": "github.com/mattermost/platform",
"GoVersion": "go1.6",
"GodepVersion": "v65",
"Deps": [
{
"ImportPath": "github.com/NYTimes/gziphandler",
"Rev": "63027b26b87e2ae2ce3810393d4b81021cfd3a35"
},
{
"ImportPath": "github.com/alecthomas/log4go",
"Rev": "e5dc62318d9bd58682f1dceb53a4b24e8253682f"
},
{
"ImportPath": "github.com/braintree/manners",
"Comment": "0.4.0-15-g82a8879",
"Rev": "82a8879fc5fd0381fa8b2d8033b19bf255252088"
},
{
"ImportPath": "github.com/cloudfoundry/jibber_jabber",
"Rev": "bcc4c8345a21301bf47c032ff42dd1aae2fe3027"
},
{
"ImportPath": "github.com/dgryski/dgoogauth",
"Rev": "67642ac6f9144f6610279e37e7be9af13f1cd668"
},
{
"ImportPath": "github.com/disintegration/imaging",
"Rev": "d8bbae1de109b518dabc98c6c1633eb358c148a4"
},
{
"ImportPath": "github.com/garyburd/redigo/internal",
"Rev": "8873b2f1995f59d4bcdd2b0dc9858e2cb9bf0c13"
},
{
"ImportPath": "github.com/garyburd/redigo/redis",
"Rev": "8873b2f1995f59d4bcdd2b0dc9858e2cb9bf0c13"
},
{
"ImportPath": "github.com/go-gorp/gorp",
"Comment": "v1.7-184-g6a3c8a8",
"Rev": "6a3c8a87d0457cf700e57046c41e19b7cf3c44fa"
},
{
"ImportPath": "github.com/go-ldap/ldap",
"Comment": "v2.3.0",
"Rev": "0e7db8eb77695b5a952f0e5d78df9ab160050c73"
},
{
"ImportPath": "github.com/go-sql-driver/mysql",
"Comment": "v1.2-194-g7ebe0a5",
"Rev": "7ebe0a500653eeb1859664bed5e48dec1e164e73"
},
{
"ImportPath": "github.com/goamz/goamz/aws",
"Rev": "02d5144a587b982e33b95f484a34164ce6923c99"
},
{
"ImportPath": "github.com/goamz/goamz/s3",
"Rev": "02d5144a587b982e33b95f484a34164ce6923c99"
},
{
"ImportPath": "github.com/golang/freetype",
"Comment": "release-129-gc67e4d9",
"Rev": "c67e4d98d212356ec0d9436a1edcbb6eb799f847"
},
{
"ImportPath": "github.com/golang/freetype/raster",
"Comment": "release-129-gc67e4d9",
"Rev": "c67e4d98d212356ec0d9436a1edcbb6eb799f847"
},
{
"ImportPath": "github.com/golang/freetype/truetype",
"Comment": "release-129-gc67e4d9",
"Rev": "c67e4d98d212356ec0d9436a1edcbb6eb799f847"
},
{
"ImportPath": "github.com/golang/groupcache/lru",
"Rev": "4eab30f13db9d8b25c752e99d1583628ac2fa422"
},
{
"ImportPath": "github.com/gorilla/context",
"Comment": "v1.1-2-ga8d44e7",
"Rev": "a8d44e7d8e4d532b6a27a02dd82abb31cc1b01bd"
},
{
"ImportPath": "github.com/gorilla/handlers",
"Comment": "v1.1-6-g66e6c6f",
"Rev": "66e6c6f01d8da976ee113437745ca029c2b585a6"
},
{
"ImportPath": "github.com/gorilla/mux",
"Comment": "v1.1-7-g9c19ed5",
"Rev": "9c19ed558d5df4da88e2ade9c8940d742aef0e7e"
},
{
"ImportPath": "github.com/gorilla/websocket",
"Rev": "1f512fc3f05332ba7117626cdfb4e07474e58e60"
},
{
"ImportPath": "github.com/lib/pq",
"Comment": "go1.0-cutoff-86-gdd3290b",
"Rev": "dd3290b2f71a8b30bee8e4e75a337a825263d26f"
},
{
"ImportPath": "github.com/lib/pq/oid",
"Comment": "go1.0-cutoff-86-gdd3290b",
"Rev": "dd3290b2f71a8b30bee8e4e75a337a825263d26f"
},
{
"ImportPath": "github.com/mattermost/rsc/gf256",
"Rev": "bbaefb05eaa0389ea712340066837c8ce4d287f9"
},
{
"ImportPath": "github.com/mattermost/rsc/qr",
"Rev": "bbaefb05eaa0389ea712340066837c8ce4d287f9"
},
{
"ImportPath": "github.com/mattermost/rsc/qr/coding",
"Rev": "bbaefb05eaa0389ea712340066837c8ce4d287f9"
},
{
"ImportPath": "github.com/mssola/user_agent",
"Comment": "v0.4.1-14-g8e786bc",
"Rev": "8e786bcb38b846e5eb8eb5f036d9144fc7b0a1f8"
},
{
"ImportPath": "github.com/nicksnyder/go-i18n/i18n",
"Comment": "v1.4.0",
"Rev": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3"
},
{
"ImportPath": "github.com/nicksnyder/go-i18n/i18n/bundle",
"Comment": "v1.4.0",
"Rev": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3"
},
{
"ImportPath": "github.com/nicksnyder/go-i18n/i18n/language",
"Comment": "v1.4.0",
"Rev": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3"
},
{
"ImportPath": "github.com/nicksnyder/go-i18n/i18n/translation",
"Comment": "v1.4.0",
"Rev": "37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3"
},
{
"ImportPath": "github.com/pborman/uuid",
"Comment": "v1.0-11-gc55201b",
"Rev": "c55201b036063326c5b1b89ccfe45a184973d073"
},
{
"ImportPath": "github.com/rwcarlsen/goexif/exif",
"Rev": "709fab3d192d7c62f86043caff1e7e3fb0f42bd8"
},
{
"ImportPath": "github.com/rwcarlsen/goexif/tiff",
"Rev": "709fab3d192d7c62f86043caff1e7e3fb0f42bd8"
},
{
"ImportPath": "github.com/vaughan0/go-ini",
"Rev": "a98ad7ee00ec53921f08832bc06ecf7fd600e6a1"
},
{
"ImportPath": "golang.org/x/crypto/bcrypt",
"Rev": "91ab96ae987aef3e74ab78b3aaf026109d206148"
},
{
"ImportPath": "golang.org/x/crypto/blowfish",
"Rev": "91ab96ae987aef3e74ab78b3aaf026109d206148"
},
{
"ImportPath": "golang.org/x/image/bmp",
"Rev": "f551d3a6b7fc11df315ad9e18b404280680f8bec"
},
{
"ImportPath": "golang.org/x/image/font",
"Rev": "f551d3a6b7fc11df315ad9e18b404280680f8bec"
},
{
"ImportPath": "golang.org/x/image/math/fixed",
"Rev": "f551d3a6b7fc11df315ad9e18b404280680f8bec"
},
{
"ImportPath": "golang.org/x/image/tiff",
"Rev": "f551d3a6b7fc11df315ad9e18b404280680f8bec"
},
{
"ImportPath": "golang.org/x/image/tiff/lzw",
"Rev": "f551d3a6b7fc11df315ad9e18b404280680f8bec"
},
{
"ImportPath": "golang.org/x/sys/unix",
"Rev": "b776ec39b3e54652e09028aaaaac9757f4f8211a"
},
{
"ImportPath": "gopkg.in/asn1-ber.v1",
"Comment": "v1.1",
"Rev": "4e86f4367175e39f69d9358a5f17b4dda270378d"
},
{
"ImportPath": "gopkg.in/fsnotify.v1",
"Comment": "v1.3.0",
"Rev": "30411dbcefb7a1da7e84f75530ad3abe4011b4f8"
},
{
"ImportPath": "gopkg.in/throttled/throttled.v1",
"Comment": "v1.0.0",
"Rev": "74e328a1af88a9b54f9eca1397d74ad98572a6df"
},
{
"ImportPath": "gopkg.in/throttled/throttled.v1/store",
"Comment": "v1.0.0",
"Rev": "74e328a1af88a9b54f9eca1397d74ad98572a6df"
},
{
"ImportPath": "gopkg.in/yaml.v2",
"Rev": "a83829b6f1293c91addabc89d0571c246397bbf4"
}
]
}
This directory tree is generated automatically by godep.
Please do not edit.
See https://github.com/tools/godep for more information.
.PHONY: build package run stop run-client run-server stop-client stop-server restart-server restart-client start-docker clean-dist clean nuke check-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows
# For golang 1.5.x compatibility (remove when we don't want to support it anymore)
GO15VENDOREXPERIMENT=1
export GO15VENDOREXPERIMENT=1
# Build Flags
BUILD_NUMBER ?= $(BUILD_NUMBER:)
......@@ -30,9 +30,9 @@ endif
BUILD_WEBAPP_DIR = ./webapp
# Golang Flags
GOPATH ?= $(GOPATH:)
GOPATH ?= $(GOPATH:):./vendor
GOFLAGS ?= $(GOFLAGS:)
GO=$(GOPATH)/bin/godep go
GO=go
GO_LINKER_FLAGS ?= -ldflags \
"-X github.com/mattermost/platform/model.BuildNumber=$(BUILD_NUMBER)\
-X 'github.com/mattermost/platform/model.BuildDate=$(BUILD_DATE)'\
......@@ -143,18 +143,20 @@ check-style:
exit 1; \
fi
test: start-docker
test: prepare-enteprise start-docker
@echo Running tests
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./store || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=340s ./api || exit 1
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=12s ./model || exit 1
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=180s ./store || exit 1
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./utils || exit 1
#$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s ./web || exit 1
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Running Enterprise tests
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s $(BUILD_ENTERPRISE_DIR)/ldap || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=120s $(BUILD_ENTERPRISE_DIR)/compliance || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/ldap && ./ldap.test -test.v -test.timeout=120s || exit 1
$(GO) test $(GOFLAGS) -run=$(TESTS) -c ./enterprise/compliance && ./compliance.test -test.v -test.timeout=120s || exit 1
rm -r ldap.test
rm -r compliance.test
endif
setup-run-client-tests:
......@@ -173,7 +175,7 @@ test-client: setup-run-client-tests run-server run-client-tests stop-server clea
.prebuild:
@echo Preparation for running go code
go get $(GOFLAGS) github.com/tools/godep
go get $(GOFLAGS) github.com/Masterminds/glide
touch $@
......@@ -181,6 +183,8 @@ prepare-enterprise:
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Enterprise build selected, preparing
cp $(BUILD_ENTERPRISE_DIR)/imports.go .
rm -f enterprise
ln -s $(BUILD_ENTERPRISE_DIR) enterprise
endif
build-linux: .prebuild prepare-enterprise
......@@ -318,10 +322,9 @@ clean: stop-docker
rm -rf api/data
rm -rf logs
rm -rf Godeps/_workspace/pkg/
rm -f mattermost.log
rm -f .prepare-go
rm -f enterprise
nuke: clean clean-docker
@echo BOOM
......
......@@ -27,16 +27,16 @@ type TestHelper struct {
SystemAdminChannel *model.Channel
}
func SetupEnterprise(platformDir string) *TestHelper {
func SetupEnterprise() *TestHelper {
if Srv == nil {
utils.LoadConfig(platformDir + "/config/config.json")
utils.InitTranslationsWithDir(platformDir + "/i18n")
utils.LoadConfig("config.json")
utils.InitTranslations()
utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
utils.DisableDebugLogForTest()
utils.License.Features.SetDefaults()
NewServer()
StartServer()
utils.InitHTMLWithDir(platformDir + "/templates")
utils.InitHTML()
InitApi()
utils.EnableDebugLogForTest()
Srv.Store.MarkSystemRanUnitTests()
......
hash: aa2fadc7f997a93e78d46d009d5695fb079697453d83e6a6dd7481d46ce73b7e
updated: 2016-05-12T19:14:13.836695608-04:00
imports:
- name: github.com/alecthomas/log4go
version: e5dc62318d9bd58682f1dceb53a4b24e8253682f
- name: github.com/braintree/manners
version: 82a8879fc5fd0381fa8b2d8033b19bf255252088
- name: github.com/cloudfoundry/jibber_jabber
version: bcc4c8345a21301bf47c032ff42dd1aae2fe3027
- name: github.com/dgryski/dgoogauth
version: 67642ac6f9144f6610279e37e7be9af13f1cd668
- name: github.com/disintegration/imaging
version: d8bbae1de109b518dabc98c6c1633eb358c148a4
- name: github.com/garyburd/redigo
version: 8873b2f1995f59d4bcdd2b0dc9858e2cb9bf0c13
subpackages:
- redis
- internal
- name: github.com/go-gorp/gorp
version: 6a3c8a87d0457cf700e57046c41e19b7cf3c44fa
- name: github.com/go-ldap/ldap
version: 0e7db8eb77695b5a952f0e5d78df9ab160050c73
- name: github.com/go-sql-driver/mysql
version: 7ebe0a500653eeb1859664bed5e48dec1e164e73
- name: github.com/goamz/goamz
version: 02d5144a587b982e33b95f484a34164ce6923c99
subpackages:
- aws
- s3
- name: github.com/golang/freetype
version: c67e4d98d212356ec0d9436a1edcbb6eb799f847
subpackages:
- raster
- truetype
- name: github.com/golang/groupcache
version: 4eab30f13db9d8b25c752e99d1583628ac2fa422
subpackages:
- lru
- name: github.com/gorilla/context
version: a8d44e7d8e4d532b6a27a02dd82abb31cc1b01bd
- name: github.com/gorilla/handlers
version: 66e6c6f01d8da976ee113437745ca029c2b585a6
- name: github.com/gorilla/mux
version: 9c19ed558d5df4da88e2ade9c8940d742aef0e7e
- name: github.com/gorilla/websocket
version: 1f512fc3f05332ba7117626cdfb4e07474e58e60
- name: github.com/lib/pq
version: ee1442bda7bd1b6a84e913bdb421cb1874ec629d
subpackages:
- oid
- name: github.com/mattermost/rsc
version: bbaefb05eaa0389ea712340066837c8ce4d287f9
subpackages:
- qr
- qr/coding
- gf256
- name: github.com/mssola/user_agent
version: 8e786bcb38b846e5eb8eb5f036d9144fc7b0a1f8
- name: github.com/nicksnyder/go-i18n
version: 37e5c2de3e03e4b82693e3fcb4a6aa2cc4eb07e3
subpackages:
- i18n
- i18n/bundle
- i18n/language
- i18n/translation
- name: github.com/NYTimes/gziphandler
version: 63027b26b87e2ae2ce3810393d4b81021cfd3a35
- name: github.com/pborman/uuid
version: c55201b036063326c5b1b89ccfe45a184973d073
- name: github.com/rwcarlsen/goexif
version: 709fab3d192d7c62f86043caff1e7e3fb0f42bd8
subpackages:
- exif
- tiff
- name: github.com/vaughan0/go-ini
version: a98ad7ee00ec53921f08832bc06ecf7fd600e6a1
- name: golang.org/x/crypto
version: 1e61df8d9ea476e2e1504cd9a32b40280c7c6c7e
subpackages:
- bcrypt
- blowfish
- name: golang.org/x/image
version: f551d3a6b7fc11df315ad9e18b404280680f8bec
subpackages:
- bmp
- tiff
- font
- math/fixed
- tiff/lzw
- name: golang.org/x/sys
version: e82cb4d7dffc35bcec7bc8bf9e402377e0ecf3f4
subpackages:
- unix
- name: gopkg.in/asn1-ber.v1
version: 4e86f4367175e39f69d9358a5f17b4dda270378d
- name: gopkg.in/fsnotify.v1
version: 30411dbcefb7a1da7e84f75530ad3abe4011b4f8
- name: gopkg.in/throttled/throttled.v1
version: 74e328a1af88a9b54f9eca1397d74ad98572a6df
subpackages:
- store
- name: gopkg.in/yaml.v2
version: a83829b6f1293c91addabc89d0571c246397bbf4
devImports: []
package: github.com/mattermost/platform
import:
- package: github.com/NYTimes/gziphandler
- package: github.com/alecthomas/log4go
- package: github.com/braintree/manners
- package: github.com/cloudfoundry/jibber_jabber
- package: github.com/dgryski/dgoogauth
- package: github.com/disintegration/imaging
- package: github.com/go-gorp/gorp
- package: github.com/go-ldap/ldap
- package: github.com/go-sql-driver/mysql
- package: github.com/goamz/goamz
subpackages:
- aws
- s3
- package: github.com/golang/freetype
- package: github.com/gorilla/handlers
- package: github.com/gorilla/mux
- package: github.com/gorilla/websocket
- package: github.com/lib/pq
- package: github.com/mattermost/rsc
subpackages:
- qr
- package: github.com/mssola/user_agent
- package: github.com/nicksnyder/go-i18n
subpackages:
- i18n
- package: github.com/pborman/uuid
- package: github.com/rwcarlsen/goexif
subpackages:
- exif
- package: golang.org/x/crypto
subpackages:
- bcrypt
- package: golang.org/x/image
subpackages:
- bmp
- package: gopkg.in/fsnotify.v1
- package: gopkg.in/throttled/throttled.v1
subpackages:
- store
package gziphandler
import (
"bytes"
"compress/gzip"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseEncodings(t *testing.T) {
examples := map[string]codings{
// Examples from RFC 2616
"compress, gzip": codings{"compress": 1.0, "gzip": 1.0},
"": codings{},
"*": codings{"*": 1.0},
"compress;q=0.5, gzip;q=1.0": codings{"compress": 0.5, "gzip": 1.0},
"gzip;q=1.0, identity; q=0.5, *;q=0": codings{"gzip": 1.0, "identity": 0.5, "*": 0.0},
// More random stuff
"AAA;q=1": codings{"aaa": 1.0},
"BBB ; q = 2": codings{"bbb": 1.0},
}
for eg, exp := range examples {
act, _ := parseEncodings(eg)
assert.Equal(t, exp, act)
}
}
func TestGzipHandler(t *testing.T) {
testBody := "aaabbbccc"
// This just exists to provide something for GzipHandler to wrap.
handler := newTestHandler(testBody)
// requests without accept-encoding are passed along as-is
req1, _ := http.NewRequest("GET", "/whatever", nil)
res1 := httptest.NewRecorder()
handler.ServeHTTP(res1, req1)
assert.Equal(t, 200, res1.Code)
assert.Equal(t, "", res1.Header().Get("Content-Encoding"))
assert.Equal(t, "Accept-Encoding", res1.Header().Get("Vary"))
assert.Equal(t, testBody, res1.Body.String())
// but requests with accept-encoding:gzip are compressed if possible
req2, _ := http.NewRequest("GET", "/whatever", nil)
req2.Header.Set("Accept-Encoding", "gzip")
res2 := httptest.NewRecorder()
handler.ServeHTTP(res2, req2)
assert.Equal(t, 200, res2.Code)
assert.Equal(t, "gzip", res2.Header().Get("Content-Encoding"))
assert.Equal(t, "Accept-Encoding", res2.Header().Get("Vary"))
assert.Equal(t, gzipStr(testBody), res2.Body.Bytes())
// content-type header is correctly set based on uncompressed body
req3, _ := http.NewRequest("GET", "/whatever", nil)
req3.Header.Set("Accept-Encoding", "gzip")
res3 := httptest.NewRecorder()
handler.ServeHTTP(res3, req3)
assert.Equal(t, http.DetectContentType([]byte(testBody)), res3.Header().Get("Content-Type"))
}
// --------------------------------------------------------------------
func BenchmarkGzipHandler_S2k(b *testing.B) { benchmark(b, false, 2048) }
func BenchmarkGzipHandler_S20k(b *testing.B) { benchmark(b, false, 20480) }
func BenchmarkGzipHandler_S100k(b *testing.B) { benchmark(b, false, 102400) }
func BenchmarkGzipHandler_P2k(b *testing.B) { benchmark(b, true, 2048) }
func BenchmarkGzipHandler_P20k(b *testing.B) { benchmark(b, true, 20480) }
func BenchmarkGzipHandler_P100k(b *testing.B) { benchmark(b, true, 102400) }
// --------------------------------------------------------------------
func gzipStr(s string) []byte {
var b bytes.Buffer
w := gzip.NewWriter(&b)
io.WriteString(w, s)
w.Close()
return b.Bytes()
}
func benchmark(b *testing.B, parallel bool, size int) {
bin, err := ioutil.ReadFile("testdata/benchmark.json")
if err != nil {
b.Fatal(err)
}
req, _ := http.NewRequest("GET", "/whatever", nil)
req.Header.Set("Accept-Encoding", "gzip")
handler := newTestHandler(string(bin[:size]))
if parallel {
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
runBenchmark(b, req, handler)
}
})
} else {
b.ResetTimer()
for i := 0; i < b.N; i++ {
runBenchmark(b, req, handler)
}
}
}
func runBenchmark(b *testing.B, req *http.Request, handler http.Handler) {
res := httptest.NewRecorder()
handler.ServeHTTP(res, req)
if code := res.Code; code != 200 {
b.Fatalf("Expected 200 but got %d", code)
} else if blen := res.Body.Len(); blen < 500 {
b.Fatalf("Expected complete response body, but got %d bytes", blen)
}
}
func newTestHandler(body string) http.Handler {
return GzipHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, body)
}))