diff options
-rw-r--r-- | .github/workflows/build.yml | 56 | ||||
-rw-r--r-- | plugins/http/plugin.go | 9 |
2 files changed, 44 insertions, 21 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e4ebb1e..af64dc08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,28 +56,50 @@ jobs: - name: Install Go dependencies run: go mod download - - name: Run golang tests + - name: Run golang tests on Windows without codecov + if: ${{ matrix.os == 'windows-latest' || matrix.os == 'macos-latest' }} + run: | + go test -v -race -cover -tags=debug . + go test -v -race -cover -tags=debug ./plugins/rpc + go test -v -race -cover -tags=debug ./plugins/rpc/tests + go test -v -race -cover -tags=debug ./plugins/config/tests + go test -v -race -cover -tags=debug ./plugins/logger/tests + go test -v -race -cover -tags=debug ./plugins/server/tests + go test -v -race -cover -tags=debug ./plugins/metrics/tests + go test -v -race -cover -tags=debug ./plugins/informer/tests + go test -v -race -cover -tags=debug ./plugins/resetter/tests + go test -v -race -cover -tags=debug ./plugins/http/attributes + go test -v -race -cover -tags=debug ./plugins/http/tests + go test -v -race -cover -tags=debug ./plugins/gzip/tests + go test -v -race -cover -tags=debug ./plugins/static/tests + go test -v -race -cover -tags=debug ./plugins/static + go test -v -race -cover -tags=debug ./plugins/headers/tests + go test -v -race -cover -tags=debug ./plugins/checker/tests + + - name: Run golang tests on Linux and MacOS + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} run: | mkdir ./coverage-ci - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/lib.txt" -covermode=atomic . - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/rpc_config.txt" -covermode=atomic ./plugins/rpc - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/rpc.txt" -covermode=atomic ./plugins/rpc/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/plugin_config.txt" -covermode=atomic ./plugins/config/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/logger.txt" -covermode=atomic ./plugins/logger/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/server.txt" -covermode=atomic ./plugins/server/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/metrics.txt" -covermode=atomic ./plugins/metrics/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/informer.txt" -covermode=atomic ./plugins/informer/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/resetter.txt" -covermode=atomic ./plugins/resetter/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/attributes.txt" -covermode=atomic ./plugins/http/attributes - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/http_tests.txt" -covermode=atomic ./plugins/http/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/gzip.txt" -covermode=atomic ./plugins/gzip/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/static.txt" -covermode=atomic ./plugins/static/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/static_root.txt" -covermode=atomic ./plugins/static - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/headers.txt" -covermode=atomic ./plugins/headers/tests - go test -v -race -cover -tags=debug -coverprofile="./coverage-ci/checker.txt" -covermode=atomic ./plugins/checker/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/lib.txt -covermode=atomic . + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/rpc_config.txt -covermode=atomic ./plugins/rpc + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./plugins/rpc/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/plugin_config.txt -covermode=atomic ./plugins/config/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./plugins/logger/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/server.txt -covermode=atomic ./plugins/server/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./plugins/metrics/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./plugins/informer/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./plugins/resetter/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/attributes.txt -covermode=atomic ./plugins/http/attributes + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/http_tests.txt -covermode=atomic ./plugins/http/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./plugins/gzip/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/static.txt -covermode=atomic ./plugins/static/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/static_root.txt -covermode=atomic ./plugins/static + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./plugins/headers/tests + go test -v -race -cover -tags=debug -coverprofile=./coverage-ci/checker.txt -covermode=atomic ./plugins/checker/tests cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt - uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action> + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage-ci/summary.txt diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index 371cdb91..a6399489 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -183,6 +183,11 @@ func (s *Plugin) Serve() chan error { s.fcgi = &http.Server{Handler: s} } + // apply middlewares before starting the server + if len(s.mdwr) > 0 { + s.addMiddlewares() + } + if s.http != nil { go func() { httpErr := s.http.ListenAndServe() @@ -217,10 +222,6 @@ func (s *Plugin) Serve() chan error { }() } - if len(s.mdwr) > 0 { - s.addMiddlewares() - } - return errCh } |