Skip to content

Commit

Permalink
Merge pull request #51 from linkernetworks/hwchiu/fix-test
Browse files Browse the repository at this point in the history
Add the testing condition for prometheus
  • Loading branch information
John-Lin authored Jun 27, 2018
2 parents 4481511 + ab2e1ce commit 8c31223
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit 8c31223

Please sign in to comment.