Skip to content

Commit de07f04

Browse files
committed
feat(!!): update lib and code to make the tests pass again
1 parent 219bd02 commit de07f04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+648
-480
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ explorer/node_modules
33
explorer/dist
44
dist/*
55
app/assets/bindata.go
6-
data
6+
data/*
77
admin/build
88
admin/node_modules
99
vendor

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ matrix:
1414
# env: TEST_FRONTEND=on TRAVIS_NODE_VERSION="0.12"
1515

1616
before_script:
17-
- curl https://dl.influxdata.com/influxdb/releases/influxdb-0.13.0_linux_amd64.tar.gz | tar xvzf -
18-
- ./influxdb-0.13.0-1/usr/bin/influxd &
19-
- sleep 2
2017
- if [ "$TEST_BACKEND" = "on" ]; then
2118
psql -c 'create database travis_ci_test;' -U postgres;
2219
cp -f test/config_travis.toml test/config_test.toml;

Makefile

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,34 @@ PID = .pid
44
GO_FILES = $(shell find . -type f -name "*.go")
55
GONODE_MODULES = $(shell ls -d ./modules/* | grep -v go)
66
GONODE_CORE = $(shell ls -d ./core/* | grep -v go)
7-
GO_PATH = $(shell go env GOPATH)
8-
9-
help: ## Display this help
10-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
11-
12-
define back
13-
$(call docker,back,$(1))
14-
endef
15-
16-
define docker
17-
if [ ! -f /.dockerenv ]; then \
18-
docker-compose run $(1) /bin/bash -c "$(2)"; \
19-
else \
20-
/bin/bash -c "$(2)"; \
21-
fi
22-
endef
23-
24-
shell:
25-
docker-compose run back /bin/bash
7+
GOPATH = $(shell go env GOPATH)
268

279
install:
2810
$(call back,glide install)
2911
$(call back,go get github.com/wadey/gocovmerge && go get golang.org/x/tools/cmd/cover && go get golang.org/x/tools/cmd/goimports && go get -u github.com/jteeuwen/go-bindata/...)
3012

3113
test:
32-
$(call back,./app/assets/bindata.sh && go test -v $(GONODE_CORE) $(GONODE_MODULES) ./test/modules)
33-
$(call back,go vet $(GONODE_CORE) $(GONODE_MODULES) ./test/modules/)
14+
./app/assets/bindata.sh
15+
echo "mode: atomic" > data/coverage.out
16+
mkdir -p data
3417

35-
format:
36-
$(call back,gofmt -w $(GONODE_CORE) $(GONODE_MODULES) ./test/modules)
37-
$(call back,go fix $(GONODE_CORE) $(GONODE_MODULES) ./test/modules)
38-
$(call back,go vet $(GONODE_CORE) $(GONODE_MODULES) ./test/modules)
18+
GONODE_TEST_OFFLINE=true GOPATH=${GOPATH} go test -v -failfast -covermode=atomic -coverprofile=data/coverage_core.out $(GONODE_CORE)
19+
GOPATH=${GOPATH} go test -v -failfast -covermode=atomic -coverprofile=data/coverage_modules.out $(GONODE_MODULES)
20+
GOPATH=${GOPATH} go test -v -failfast -covermode=atomic -coverpkg ./... -coverprofile=data/coverage_integration.out ./test/modules
21+
go vet $(GONODE_CORE) $(GONODE_MODULES) ./test/modules/
22+
23+
tail -n +2 data/coverage_core.out >> data/coverage.out
24+
tail -n +2 data/coverage_modules.out >> data/coverage.out
25+
tail -n +2 data/coverage_integration.out >> data/coverage.out
26+
go tool cover -html data/coverage.out -o data/coverage.html
3927

4028
run:
41-
docker-compose kill
42-
docker-compose up
29+
GOPATH=${GOPATH} `go env GOPATH`/bin/modd
30+
31+
format:
32+
gofmt -w $(GONODE_CORE) $(GONODE_MODULES) ./test/modules
33+
go fix $(GONODE_CORE) $(GONODE_MODULES) ./test/modules
34+
go vet $(GONODE_CORE) $(GONODE_MODULES) ./test/modules
4335

4436
load: ## Load fixtures
4537
curl -XPOST http://localhost:2508/setup/uninstall && exit 0

app/assets/bindata.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env bash
22

3+
GOPATH=`go env GOPATH`
34
GO_BINDATA_PATHS="${GOPATH}/src/github.com/rande/gonode/modules/..."
45
GO_BINDATA_IGNORE="(.*)\.(go|DS_Store)"
56
GO_BINDATA_OUTPUT="${GOPATH}/src/github.com/rande/gonode/app/assets/bindata.go"
67
GO_BINDATA_PACKAGE="assets"
78

89
echo "Generating bindata file..."
9-
cd ${GOPATH}/src && go-bindata -dev -prefix ${GOPATH}/src -o ${GO_BINDATA_OUTPUT} -pkg ${GO_BINDATA_PACKAGE} -ignore ${GO_BINDATA_IGNORE} ${GO_BINDATA_PATHS}
10+
cd ${GOPATH}/src && ${GOPATH}/bin/go-bindata -dev -prefix ${GOPATH}/src -o ${GO_BINDATA_OUTPUT} -pkg ${GO_BINDATA_PACKAGE} -ignore ${GO_BINDATA_IGNORE} ${GO_BINDATA_PATHS}
1011

1112
echo "Done!"

app/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package main
88
import (
99
"os"
1010

11-
log "github.com/Sirupsen/logrus"
1211
"github.com/mitchellh/cli"
1312
"github.com/rande/goapp"
1413
"github.com/rande/gonode/app/assets"
@@ -30,6 +29,7 @@ import (
3029
"github.com/rande/gonode/modules/search"
3130
"github.com/rande/gonode/modules/setup"
3231
"github.com/rande/gonode/modules/user"
32+
log "github.com/sirupsen/logrus"
3333
)
3434

3535
func Configure(configFile string) *goapp.Lifecycle {

app/server.toml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test= true
44

55
[databases.master]
66
type = "master"
7-
dsn = "postgres://postgres:gonode@database/gonode?sslmode=disable"
7+
dsn = "postgres://postgres:gonode@localhost/gonode?sslmode=disable"
88
enabled = true
99
prefix = "prod"
1010

core/bindata/bindata_app.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
package bindata
77

88
import (
9-
log "github.com/Sirupsen/logrus"
109
"github.com/flosch/pongo2"
1110
"github.com/rande/goapp"
1211
"github.com/rande/gonode/core/config"
12+
log "github.com/sirupsen/logrus"
1313
"github.com/zenazn/goji/web"
1414
)
1515

@@ -27,7 +27,6 @@ func Configure(l *goapp.Lifecycle, conf *config.Config) {
2727
})
2828

2929
l.Prepare(func(app *goapp.App) error {
30-
3130
if !app.Has("goji.mux") {
3231
return nil
3332
}

core/bindata/bindata_asset.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"net/http"
1010
"strings"
1111

12-
log "github.com/Sirupsen/logrus"
12+
log "github.com/sirupsen/logrus"
1313
"github.com/zenazn/goji/web"
1414
)
1515

@@ -88,7 +88,5 @@ func ConfigureBinDataMux(mux *web.Mux, Asset func(name string) ([]byte, error),
8888

8989
res.WriteHeader(404)
9090
res.Write([]byte("<html><head><title>Page not found</title></head><body><h1>Page not found</h1></body></html>"))
91-
92-
return
9391
})
9492
}

core/commands/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"flag"
1010
"net/http"
1111

12-
log "github.com/Sirupsen/logrus"
1312
"github.com/mitchellh/cli"
1413
"github.com/rande/goapp"
1514
"github.com/rande/gonode/core/config"
15+
log "github.com/sirupsen/logrus"
1616
"github.com/zenazn/goji/bind"
1717
"github.com/zenazn/goji/graceful"
1818
"github.com/zenazn/goji/web"

core/commands/cli_app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
"net/http"
1111
"time"
1212

13-
log "github.com/Sirupsen/logrus"
14-
sq "github.com/lann/squirrel"
13+
sq "github.com/Masterminds/squirrel"
1514
"github.com/lib/pq"
1615
"github.com/rande/goapp"
1716
"github.com/rande/gonode/core/config"
1817
"github.com/rande/gonode/core/vault"
1918
"github.com/rande/gonode/modules/base"
19+
log "github.com/sirupsen/logrus"
2020
"github.com/zenazn/goji/web"
2121
"github.com/zenazn/goji/web/middleware"
2222
)

0 commit comments

Comments
 (0)