Mattermost, Inc.

[Solved] Developer Machine Setup (cant 'make test')

First time using Githib and MatterMost.

I am attempting to setup a developer machine, so that I can review and hopefully contribute to this project.

I am a Windows guy, and I am having some trouble with the basics of setting up the dev environment (please be gentle).

I have followed the instructions here: https://github.com/mattermost/platform/blob/master/doc/developer/Setup.md

However, when I run a “make test” I get the following:

goroutine 3395 [IO wait]:
net.runtime_pollWait(0x2ac8fecc17d8, 0x72, 0xc8200101a0)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc82042be20, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82042be20, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc82042bdc0, 0xc82081e000, 0x104d, 0x2000, 0x0, 0x2ac8fecbc050, 0xc8200101a0)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(*conn).Read(0xc82002a3d8, 0xc82081e000, 0x104d, 0x2000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
github.com/go-sql-driver/mysql.(*buffer).fill(0xc820401c00, 0x4, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-sql-driver/mysql/buffer.go:57 +0x2b5
github.com/go-sql-driver/mysql.(*buffer).readNext(0xc820401c00, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-sql-driver/mysql/buffer.go:86 +0x55
github.com/go-sql-driver/mysql.(*mysqlConn).readPacket(0xc820401c00, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-sql-driver/mysql/packets.go:30 +0x84
github.com/go-sql-driver/mysql.(*mysqlConn).readResultSetHeaderPacket(0xc820401c00, 0xc8202c81c0, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-sql-driver/mysql/packets.go:421 +0x42
github.com/go-sql-driver/mysql.(*mysqlStmt).Exec(0xc820296180, 0xc8202c81c0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-sql-driver/mysql/statement.go:60 +0x1ef
database/sql.resultFromStatement(0x2ac8fecc2180, 0xc820253f80, 0x2ac8fecc2140, 0xc820296180, 0xc82035b780, 0x7, 0x8, 0x0, 0x0, 0x0, …)
/usr/local/go/src/database/sql/sql.go:1383 +0x3bd
database/sql.(*DB).exec(0xc82011fae0, 0xc820400180, 0x74, 0xc82035b780, 0x7, 0x8, 0xc8202c8001, 0x0, 0x0, 0x0, …)
/usr/local/go/src/database/sql/sql.go:938 +0x5ae
database/sql.(*DB).Exec(0xc82011fae0, 0xc820400180, 0x74, 0xc82035b780, 0x7, 0x8, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/database/sql/sql.go:895 +0xbe
github.com/go-gorp/gorp.exec(0x2ac8fecc2048, 0xc82001afc0, 0xc820400180, 0x74, 0xc82035b780, 0x7, 0x8, 0x0, 0x0, 0x0, …)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-gorp/gorp/gorp.go:1742 +0x1f4
github.com/go-gorp/gorp.(*DbMap).Exec(0xc82001afc0, 0xc820400180, 0x74, 0xc82035b780, 0x7, 0x8, 0x0, 0x0, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-gorp/gorp/gorp.go:1071 +0x17c
github.com/go-gorp/gorp.insert(0xc82001afc0, 0x2ac8fecc2048, 0xc82001afc0, 0xc820699e58, 0x1, 0x1, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-gorp/gorp/gorp.go:2113 +0xb33
github.com/go-gorp/gorp.(*DbMap).Insert(0xc82001afc0, 0xc820699e58, 0x1, 0x1, 0x0, 0x0)
/home/mbonny/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/go-gorp/gorp/gorp.go:991 +0x86
github.com/mattermost/platform/store.SqlAuditStore.Save.func1(0xc8202c8000, 0xc8201300c0, 0xc820252600)
/home/mbonny/go/src/github.com/mattermost/platform/store/sql_audit_store.go:47 +0x160
created by github.com/mattermost/platform/store.SqlAuditStore.Save
/home/mbonny/go/src/github.com/mattermost/platform/store/sql_audit_store.go:55 +0x67
exit status 2
FAIL github.com/mattermost/platform/api 180.030s
godep: go exit status 1
make: *** [go-test] Error 1

I have something similar. Trying to run it on OSX. After install have this:

$ make test
Starting docker containers
~/go/bin/godep go test  -run=. -test.v -test.timeout=180s ./api || exit 1
/bin/sh: ~/go/bin/godep: No such file or directory
make: *** [go-test] Error 1

System:

go version go1.5.1 darwin/amd64
Docker version 1.9.1, build a34a1d5
GNU Make 3.81
Oracle VM VirtualBox Manager 5.0.10

Any ideas?

I think you are missing “godep”

See this: https://devcenter.heroku.com/articles/go-dependencies-via-godep

I think you need to run this:
go get -u github.com/tools/godep

Then you might be stuck at the same place as me :wink:

Yes, thanks figured out this myself :slight_smile: created merge for them.

Test passed, no problems, but I had to install go from brew

I decided to run ‘make’ instead of ‘make test’ and I think I have a more useful error, still unsure what to do:

Error: Cannot find module ‘babel-runtime/helpers/typeof’ from ‘/home/mbonny/go/src/github.com/mattermost/platform/web/react/utils’

Any ideas?

This is a problem of npm installation. I think you can fix this by:

$ cd ~/go/src/github.com/mattermost/platform/web/react
$ rm -rf node_modules
$ npm install

I ran the npm install, then attempted to ‘make’ again.

Now I have some new errors.

npm ERR! Linux 3.19.0-25-generic
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” "build"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! mattermost@0.0.1 build: browserify -x crypto -x autolinker -x flux -x keymirror -x marked -x object-assign -x twemoji -d ./**/*.jsx | exorcist ../static/js/inter.js.map > ../static/js/tmp.js && uglifyjs ../static/js/tmp.js --in-source-map "../static/js/inter.js.map" --source-map "../static/js/bundle.min.js.map" --source-map-url "/static/js/bundle.min.js.map" -c -m --screw-ie8 > ../static/js/bundle.min.js && rm ../static/js/tmp.js && rm ../static/js/inter.js.map
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mattermost@0.0.1 build script 'browserify -x crypto -x autolinker -x flux -x keymirror -x marked -x object-assign -x twemoji -d .//*.jsx | exorcist …/static/js/inter.js.map > …/static/js/tmp.js && uglifyjs …/static/js/tmp.js --in-source-map “…/static/js/inter.js.map” --source-map “…/static/js/bundle.min.js.map” --source-map-url “/static/js/bundle.min.js.map” -c -m --screw-ie8 > …/static/js/bundle.min.js && rm …/static/js/tmp.js && rm …/static/js/inter.js.map’.
npm ERR! This is most likely a problem with the mattermost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! browserify -x crypto -x autolinker -x flux -x keymirror -x marked -x object-assign -x twemoji -d ./
/*.jsx | exorcist …/static/js/inter.js.map > …/static/js/tmp.js && uglifyjs …/static/js/tmp.js --in-source-map “…/static/js/inter.js.map” --source-map “…/static/js/bundle.min.js.map” --source-map-url “/static/js/bundle.min.js.map” -c -m --screw-ie8 > …/static/js/bundle.min.js && rm …/static/js/tmp.js && rm …/static/js/inter.js.map
npm ERR! You can get their info via:
npm ERR! npm owner ls mattermost
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/mbonny/go/src/github.com/mattermost/platform/web/react/npm-debug.log
make: *** [build-client] Error 1

Is this because when I cloned the GIT repository it was not in a working state?

We have been updating the build over the last couple of days. I would delete and re-get master to make sure you didn’t get a wonky build.

I would also try
make nuke
then
make test

Still no luck. Tried on Ubuntu 14.04 (Server) and 15.10 (Desktop).

Can anyone confirm that the current instructions are working?

Most of the team builds with Mac, but the official build server is ubuntu so they should work. Usually random npm errors are related to not adding ulimit -n 8096 line to the bashrc. Is there a new error?

you might trythe below but on a fresh machine you should have todo this

npm i -g babel-runtime
1 Like

fwiw, i had the same issue. I ran make nuke and make test again and then cleaned out the node_modules and ran npm install in the react directory and got it working. If it happens again, I’ll submit some more info to try and troubleshoot

Hi Guys,

Not sure if this is a great way to fix it…

/go/src/github.com/mattermost/platform$ > nano Makefile

go-test:
        $(GO) test $(GOFLAGS) -run=$(TESTS) -test.v -test.timeout=1800s ./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=120s ./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

Changing 180s to 1800s.

This allowed the test to finish and then make run seemed to work.

Now I have created my first user, but no “System Console” option is available. It seems that after the build my user is not the first. Any ideas on how to grant this user access?

I have found this: No admin access on Mac Dev install

When I run: src/github.com/mattermost/platform $ go run mattermost.go -assign_role -team_name=“yourteam” -email="you@example.com" -role=“system_admin”

myuser@ubuntu2:~/go/src/github.com/mattermost/platform$ go run mattermost.go -assign_role -team_name=“jeda” -email="myuser@gmail.com" -role=“system_admin”

Error:
mattermost.go:20:2: cannot find package “code.google.com/p/log4go” in any of:
/usr/local/go/src/code.google.com/p/log4go (from $GOROOT)
/home/mbonny/go/src/code.google.com/p/log4go (from $GOPATH)
api/server.go:8:2: cannot find package “github.com/braintree/manners” in any of:
/usr/local/go/src/github.com/braintree/manners (from $GOROOT)
/home/mbonny/go/src/github.com/braintree/manners (from $GOPATH)
api/file.go:10:2: cannot find package “github.com/disintegration/imaging” in any of:

got it figured, there are some more pre-reqs

sudo apt-get install mercurial

/go/src/github.com/mattermost/platform$ >
go get code.google.com/p/log4go
go get github.com/braintree/manners
go get github.com/disintegration/imaging
go get github.com/go-gorp/gorp
go get github.com/go-ldap/ldap
go get github.com/go-sql-driver/mysql
go get github.com/goamz/goamz/aws
go get github.com/goamz/goamz/s3
go get github.com/golang/freetype
go get github.com/gorilla/mux
go get github.com/gorilla/websocket
go get github.com/lib/pq
go get github.com/mssola/user_agent
go get github.com/pborman/uuid
go get github.com/rwcarlsen/goexif/exif
go get golang.org/x/crypto/bcrypt
go get gopkg.in/fsnotify.v1
go get gopkg.in/throttled/throttled.v1
go get gopkg.in/throttled/throttled.v1/store

I’m still getting the below error after doing all the suggestions mentioned above… any idea what I’m doing wrong? Thanks!

Running tests
/home/vagrant/go/bin/godep go test -run=. -test.v -test.timeout=240s ./api || exit 1
godep: WARNING: Go version (go1.6) & $GO15VENDOREXPERIMENT= wants to enable the vendor experiment, but disabling because a Godep workspace (Godeps/_workspace) exists
go build github.com/mattermost/platform/api: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
FAIL github.com/mattermost/platform/api [build failed]
godep: go exit status 1
make: *** [test] Error 1

FYI. I increased the timeout and am now getting the connection errors below:

Running tests
/home/vagrant/go/bin/godep go test -run=. -test.v -test.timeout=3900s ./api || exit 1
godep: WARNING: Go version (go1.6) & $GO15VENDOREXPERIMENT= wants to enable the vendor experiment, but disabling because a Godep w orkspace (Godeps/_workspace) exists
=== RUN TestGetLogs
[2016/04/25 23:32:35 UTC] [INFO] Loaded system translations for ‘en’ from ‘/home/vagrant/go/src/github.com/mattermost/platform/i18 n/en.json’
[2016/04/25 23:32:35 UTC] [CRIT] Failed to ping db err:dial tcp 127.0.0.1:3306: getsockopt: connection refused
— FAIL: TestGetLogs (1.10s)
panic: Failed to open sql connection dial tcp 127.0.0.1:3306: getsockopt: connection refused [recovered]
panic: Failed to open sql connection dial tcp 127.0.0.1:3306: getsockopt: connection refused

goroutine 7 [running]:
panic(0xbecc60, 0xc8204d6000)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
testing.tRunner.func1(0xc8200135f0)
/usr/local/go/src/testing/testing.go:467 +0x192
panic(0xbecc60, 0xc8204d6000)
/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/mattermost/platform/store.setupConnection(0xe13b48, 0x6, 0xc8200e9db8, 0x5, 0xc820019360, 0x48, 0xa, 0xa, 0xc82002c800, 0xc82052ad80)
/home/vagrant/go/src/github.com/mattermost/platform/store/sql_store.go:218 +0x894
github.com/mattermost/platform/store.initConnection(0x40a701)
/home/vagrant/go/src/github.com/mattermost/platform/store/sql_store.go:63 +0x11b
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
/home/vagrant/go/src/github.com/mattermost/platform/store/sql_store.go:85 +0x49
github.com/mattermost/platform/api.NewServer()
/home/vagrant/go/src/github.com/mattermost/platform/api/server.go:36 +0xe8
github.com/mattermost/platform/api.Setup(0x0)
/home/vagrant/go/src/github.com/mattermost/platform/api/apitestlib.go:56 +0xac
github.com/mattermost/platform/api.TestGetLogs(0xc8200135f0)
/home/vagrant/go/src/github.com/mattermost/platform/api/admin_test.go:15 +0x2c
testing.tRunner(0xc8200135f0, 0x126e960)
/usr/local/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
/usr/local/go/src/testing/testing.go:582 +0x892
exit status 2
FAIL github.com/mattermost/platform/api 1.114s
godep: go exit status 1
make: *** [test] Error 1

NVM… It turns out that it was failing because of not enough memory. I was able to run successfully after bumping up the memory and re-running make test after cleanup.