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

Move e2e tests for metrics export to integration status to reduce crosstalk flakiness #1782

Closed
wants to merge 11 commits into from

Conversation

evankanderson
Copy link
Member

Maybe fixes #1672

Creating a PR to see what I need to change in Prow

/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 7, 2020
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 7, 2020
@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 7, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release labels Oct 7, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -name '*.pb.go' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v .pb.go | grep -v wire_gen.go)

@codecov
Copy link

codecov bot commented Oct 7, 2020

Codecov Report

Merging #1782 into master will decrease coverage by 0.11%.
The diff coverage is 82.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1782      +/-   ##
==========================================
- Coverage   68.22%   68.11%   -0.12%     
==========================================
  Files         222      222              
  Lines        9437     9442       +5     
==========================================
- Hits         6438     6431       -7     
- Misses       2678     2692      +14     
+ Partials      321      319       -2     
Impacted Files Coverage Δ
metrics/opencensus_exporter.go 51.16% <ø> (-14.75%) ⬇️
metrics/config.go 80.48% <77.77%> (-0.97%) ⬇️
metrics/exporter.go 79.38% <85.71%> (+1.12%) ⬆️
metrics/resource_view.go 87.73% <85.71%> (+0.93%) ⬆️
metrics/stackdriver_exporter.go 78.84% <0.00%> (-2.57%) ⬇️
test/gcs/mock/mock.go 91.39% <0.00%> (-1.08%) ⬇️
reconciler/events.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f492d08...c7d694f. Read the comment docs.

metrics/record_e2e_test.go Outdated Show resolved Hide resolved
metrics/record_e2e_test.go Outdated Show resolved Hide resolved
metrics/record_e2e_test.go Outdated Show resolved Hide resolved
metrics/record_e2e_test.go Outdated Show resolved Hide resolved
metrics/record_e2e_test.go Outdated Show resolved Hide resolved
metrics/record_e2e_test.go Outdated Show resolved Hide resolved
@evankanderson
Copy link
Member Author

/test pull-knative-pkg-integration-tests

Evan Anderson added 5 commits October 12, 2020 14:18
Fix one bug where prometheus wouldn't work if only the port changed.

Fix timeout to work correctly in the record_e2e_test.

Fix one bug in the record_e2e_test when multiple measures came in for the same metric.
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 21, 2020
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 21, 2020
@evankanderson
Copy link
Member Author

Looking into the new segv...

@evankanderson
Copy link
Member Author

$ (base) evana-a01:pkg evana$ go test ./metrics -run '^TestS[d]'
ok  	knative.dev/pkg/metrics	0.055s
$ go test ./metrics/... -run '^TestS[e]'
ok  	knative.dev/pkg/metrics	0.049s
$ go test ./metrics -run '^TestS[d-e]'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x236ba92]

goroutine 6 [running]:
knative.dev/pkg/metrics.(*testExporter).ExportView(0xc00000efa0, 0xc0000be0f0)
	<autogenerated>:1 +0x32
go.opencensus.io/stats/view.(*worker).reportView(0xc00017e000, 0xc00000f400)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:357 +0x252
go.opencensus.io/stats/view.(*unregisterFromViewReq).handleCommand(0xc0001d87a0, 0xc00017e000)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker_commands.go:98 +0xe7
go.opencensus.io/stats/view.(*worker).start(0xc00017e000)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:278 +0x1bb
created by go.opencensus.io/stats/view.init.0
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:34 +0x68
FAIL	knative.dev/pkg/metrics	0.049s
FAIL

So there's something that changes test execution order here that breaks existing tests.

@evankanderson
Copy link
Member Author

go test ./metrics -run '^(TestSdRecord|TestSetFactory)'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x236ba92]

goroutine 19 [running]:
knative.dev/pkg/metrics.(*testExporter).ExportView(0xc000801100, 0xc0000b6690)
	<autogenerated>:1 +0x32
go.opencensus.io/stats/view.(*worker).reportView(0xc00017a000, 0xc000801460)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:357 +0x252
go.opencensus.io/stats/view.(*unregisterFromViewReq).handleCommand(0xc0008019e0, 0xc00017a000)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker_commands.go:98 +0xe7
go.opencensus.io/stats/view.(*worker).start(0xc00017a000)
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:278 +0x1bb
created by go.opencensus.io/stats/view.init.0
	/Users/evana/go/src/knative.dev/pkg/vendor/go.opencensus.io/stats/view/worker.go:34 +0x68
FAIL	knative.dev/pkg/metrics	0.048s
FAIL

@vagababov
Copy link
Contributor

Something about how we setup globals?

@evankanderson
Copy link
Member Author

Yeah, I think I've figured it out finally and may have reduced flakiness in TestMetricsExport, too.

Comment on lines 190 to 195
if newConfig.backendDestination == prometheus {
return newConfig.prometheusPort != cc.prometheusPort
}

return newConfig.backendDestination == stackdriver && newConfig.stackdriverClientConfig != cc.stackdriverClientConfig
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return dest=promo && nc.pp != cc.pp || des == stack && nc.sCC != cc.sCC?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might make this a switch, I worry about having a conditional with 4 boolean expressions being hard to maintain.

@lgtm-com
Copy link

lgtm-com bot commented Oct 23, 2020

This pull request introduces 1 alert when merging 67c9600 into 22e4e0a - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 31, 2020
@knative-prow-robot
Copy link
Contributor

@evankanderson: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@evankanderson
Copy link
Member Author

/close

Fixed this with #1957

@knative-prow-robot
Copy link
Contributor

@evankanderson: Closed this PR.

In response to this:

/close

Fixed this with #1957

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release cla: yes Indicates the PR's author has signed the CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flaky] TestMetricsExport is super flaky
4 participants