Skip to content

Commit

Permalink
Metrics reporting from tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Cortes <josecortes@datawire.io>
  • Loading branch information
josecv committed Jun 26, 2023
1 parent ae7b2cc commit d5d1327
Show file tree
Hide file tree
Showing 8 changed files with 819 additions and 17 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
max_attempts: 3
timeout_minutes: 10
command: |
# We want to validate that tests still pass, even if the metrics host
# points to a broken IP
echo "127.0.0.1 metriton.datawire.io" | sudo tee -a /etc/hosts
make check-unit
"windows":
runs-on: windows-2019
Expand All @@ -59,11 +56,6 @@ jobs:
run: choco install make
- name: Build
run: make build
- name: Update etc\hosts
run: |
# We want to validate that tests still pass, even if the metrics host
# points to a broken IP
echo "127.0.0.1 metriton.datawire.io" >> c:\windows\system32\drivers\etc\hosts
- name: Lint
run: make lint
- name: Run tests
Expand Down Expand Up @@ -101,7 +93,4 @@ jobs:
max_attempts: 3
timeout_minutes: 10
command: |
# We want to validate that tests still pass, even if the metrics host
# points to a broken IP
echo "127.0.0.1 metriton.datawire.io" | sudo tee -a /etc/hosts
make check-unit
11 changes: 6 additions & 5 deletions build-aux/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ generate: generate-clean
generate: protoc $(tools/go-mkopensource) $(BUILDDIR)/$(shell go env GOVERSION).src.tar.gz
cd ./rpc && export GOFLAGS=-mod=mod && go mod tidy && go mod vendor && rm -rf vendor
cd ./pkg/vif/testdata/router && export GOFLAGS=-mod=mod && go mod tidy && go mod vendor && rm -rf vendor
cd ./tools/src/test-report && export GOFLAGS=-mod=mod && go mod tidy && go mod vendor && rm -rf vendor

export GOFLAGS=-mod=mod && go mod tidy && go mod vendor

Expand Down Expand Up @@ -324,22 +325,22 @@ format: build-deps $(tools/golangci-lint) $(tools/protolint) ## (QA) Automatical
check-all: check-integration check-unit ## (QA) Run the test suite

.PHONY: check-unit
check-unit: build-deps ## (QA) Run the test suite
check-unit: build-deps $(tools/test-report) ## (QA) Run the test suite
# We run the test suite with TELEPRESENCE_LOGIN_DOMAIN set to localhost since that value
# is only used for extensions. Therefore, we want to validate that our tests, and
# telepresence, run without requiring any outside dependencies.
TELEPRESENCE_MAX_LOGFILES=300 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -failfast -timeout=20m ./cmd/... ./pkg/...
TELEPRESENCE_MAX_LOGFILES=300 SCOUT_DISABLE=1 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -json -failfast -timeout=20m ./cmd/... ./pkg/... | $(tools/test-report)

.PHONY: check-integration
ifeq ($(GOHOSTOS), linux)
check-integration: client-image $(tools/helm) ## (QA) Run the test suite
check-integration: client-image $(tools/test-report) $(tools/helm) ## (QA) Run the test suite
else
check-integration: build-deps $(tools/helm) ## (QA) Run the test suite
check-integration: build-deps $(tools/test-report) $(tools/helm) ## (QA) Run the test suite
endif
# We run the test suite with TELEPRESENCE_LOGIN_DOMAIN set to localhost since that value
# is only used for extensions. Therefore, we want to validate that our tests, and
# telepresence, run without requiring any outside dependencies.
TELEPRESENCE_MAX_LOGFILES=300 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -failfast -v -timeout=55m ./integration_test/...
TELEPRESENCE_MAX_LOGFILES=300 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -failfast -json -timeout=55m ./integration_test/... | $(tools/test-report)

.PHONY: _login
_login:
Expand Down
9 changes: 8 additions & 1 deletion build-aux/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,17 @@ $(TOOLSDIR)/$(PROTOLINT_TGZ):
mkdir -p $(@D)
tar -C $(@D) -zxmf $< protolint$(EXE) protoc-gen-protolint$(EXE)

ifneq ($(GOHOSTOS),windows)
# Test reporter
# ==========
#
tools/test-report = $(TOOLSBINDIR)/test-report$(EXE)
$(TOOLSBINDIR)/test-report$(EXE): $(TOOLSSRCDIR)/test-report/*.go $(TOOLSSRCDIR)/test-report/go.*
cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) *.go

# Shellcheck
# ==========
#
ifneq ($(GOHOSTOS),windows)
tools/shellcheck = $(TOOLSBINDIR)/shellcheck
SHELLCHECK_VERSION=0.8.0
SHELLCHECK_ARCH=$(shell uname -m)
Expand Down
92 changes: 92 additions & 0 deletions tools/src/test-report/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module local

go 1.20

replace github.com/telepresenceio/telepresence/rpc/v2 => ./../../../rpc

replace github.com/telepresenceio/telepresence/v2 => ./../../..

require (
github.com/datawire/metriton-go-client v0.1.1
github.com/fatih/color v1.15.0
github.com/telepresenceio/telepresence/v2 v2.0.0-00010101000000-000000000000
github.com/vbauerster/mpb/v8 v8.4.0
)

require (
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/datawire/dlib v1.3.1-0.20221228104658-e373c6d44961 // indirect
github.com/datawire/dtest v0.0.0-20210928162311-722b199c4c2f // indirect
github.com/datawire/envconfig v0.0.0-20221012222025-09524dc7d59b // indirect
github.com/datawire/k8sapi v0.1.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.1-0.20211109044230-42b52b674af5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/telepresenceio/telepresence/rpc/v2 v2.14.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.2 // indirect
k8s.io/apimachinery v0.27.2 // indirect
k8s.io/cli-runtime v0.27.2 // indirect
k8s.io/client-go v0.27.2 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230515203736-54b630e78af5 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.4 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit d5d1327

Please sign in to comment.