diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d063d86 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: go +go_import_path: github.com/openfaas/faas-provider +script: + - make test diff --git a/Makefile b/Makefile index d5488ed..1a8709c 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,6 @@ build: docker build -t faas-provider . + + +test : + go test -cover ./... diff --git a/proxy/proxy.go b/proxy/proxy.go index 67b1afc..78bde88 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -29,7 +29,7 @@ import ( "time" "github.com/gorilla/mux" - "github.com/openfaas/faas-provider/httputils" + "github.com/openfaas/faas-provider/httputil" ) const ( @@ -112,7 +112,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient pathVars := mux.Vars(originalReq) functionName := pathVars["name"] if functionName == "" { - httputils.Errorf(w, http.StatusBadRequest, errMissingFunctionName) + httputil.Errorf(w, http.StatusBadRequest, errMissingFunctionName) return } @@ -120,13 +120,13 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient if resolveErr != nil { // TODO: Should record the 404/not found error in Prometheus. log.Printf("resolver error: cannot find %s: %s\n", functionName, resolveErr.Error()) - httputils.Errorf(w, http.StatusNotFound, "Cannot find service: %s.", functionName) + httputil.Errorf(w, http.StatusNotFound, "Cannot find service: %s.", functionName) return } proxyReq, err := buildProxyRequest(originalReq, functionAddr, pathVars["params"]) if err != nil { - httputils.Errorf(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName) + httputil.Errorf(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName) return } if proxyReq.Body != nil { @@ -140,7 +140,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient if err != nil { log.Printf("error with proxy request to: %s, %s\n", proxyReq.URL.String(), err.Error()) - httputils.Errorf(w, http.StatusInternalServerError, "Can't reach service for: %s.", functionName) + httputil.Errorf(w, http.StatusInternalServerError, "Can't reach service for: %s.", functionName) return }