Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the testing condition for prometheus #51

Merged
merged 1 commit into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ install:
script:
- docker run --name prometheus -d -p 9090:9090 prom/prometheus
- make build
- sudo -E PATH=$PATH TEST_GRPC=1 make src.test-coverage
- sudo -E PATH=$PATH TEST_PROMETHEUS=1 TEST_GRPC=1 make src.test-coverage
- docker build --tag sdnvortex/vortex --file ./dockerfiles/Dockerfile .

before_deploy:
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pipeline {
}
stage('Test') {
steps {
withEnv(["GOPATH+AA=${env.WORKSPACE}"]) {
withEnv(["GOPATH+AA=${env.WORKSPACE}", "TEST_PROMETHEUS=1"]) {
dir ("src/github.com/linkernetworks/vortex") {
sh "make src.test-coverage 2>&1 | tee >(go-junit-report > report.xml)"
junit "report.xml"
Expand Down Expand Up @@ -111,4 +111,4 @@ pipeline {
}
}
}
}
}
5 changes: 5 additions & 0 deletions src/server/handler_prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package server
import (
"net/http"
"net/http/httptest"
"os"
"testing"

restful "github.com/emicklei/go-restful"
Expand Down Expand Up @@ -33,6 +34,10 @@ func (suite *PrometheusTestSuite) SetupSuite() {
}

func TestPrometheusTestSuite(t *testing.T) {
if _, defined := os.LookupEnv("TEST_PROMETHEUS"); !defined {
t.SkipNow()
return
}
suite.Run(t, new(PrometheusTestSuite))
}

Expand Down