-
Notifications
You must be signed in to change notification settings - Fork 142
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
Fix flaky test by disabling Prometheus metrics #1341
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager
dhwthompson
force-pushed
the
fix-double-test-port-failure
branch
from
January 24, 2022 23:50
59d39fa
to
c6076a2
Compare
jpellizzari
reviewed
Jan 25, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
jpellizzari
approved these changes
Jan 25, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never would have found this. Nice work!
J-Thompson12
approved these changes
Jan 25, 2022
joshri
pushed a commit
that referenced
this pull request
Jan 26, 2022
The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager
jpellizzari
pushed a commit
that referenced
this pull request
Jan 26, 2022
The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager
jpellizzari
pushed a commit
that referenced
this pull request
Jan 26, 2022
The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager
jpellizzari
added a commit
that referenced
this pull request
Jan 28, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
jpellizzari
added a commit
that referenced
this pull request
Feb 7, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
joshri
pushed a commit
that referenced
this pull request
Feb 10, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
joshri
pushed a commit
that referenced
this pull request
Feb 16, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
jpellizzari
added a commit
that referenced
this pull request
Feb 25, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
jpellizzari
added a commit
that referenced
this pull request
Mar 3, 2022
* New proto endpoints * Added integration tests * V2 workflow added * Use controller-runtime client in app server * Fix whitepace and unused linting errors * Add kustomization tests * Fix flaky test by disabling Prometheus metrics (#1341) The test suites for some of our packages spin up parts of a Kubernetes cluster using the `envtest` library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both the `kube` and `server` packages at once would cause one of those test suites to fail. Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server: python3 -m http.server 8080 After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request). Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs[1]), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place. [1]: https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.2/pkg/manager * Use suite test for kubebuilder setup/teardown * Add more create kustomization test coverage * Skip acceptance test lint * Split k8s resources into separate files * Initial work implementing HelmRepository to the API * Added weave related labels to helm repository resource * Use app name to list helm repositories * Added unit test for ListHelmRepositories * Added missing namespace parameter when listing helm repositories Co-authored-by: James Wilson <jwils22@gmail.com> Co-authored-by: Jordan Pellizzari <jordan@weave.works> Co-authored-by: David Thompson <32775+dhwthompson@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test suites for some of our packages spin up parts of a Kubernetes cluster using the
envtest
library, so that we have something more solid than mocks to test against. One problem this was causing was that running tests for both thekube
andserver
packages at once would cause one of those test suites to fail.Side-note: it's possible to reproduce this problem a little more efficiently by spinning up a fake web server to sit on port 8080, for example using Python's built-in web server:
After some digging, I found out that the reason for this is that both environments were trying to spin up a Prometheus metrics handler listening on port 8080. If they both tried to do this at once, one would fail, causing the entire test suite for that package to fail too (including some nil-pointer panics during the clean up, which might be worth tidying up in a future pull request).
Setting the metrics bind address to the string "0" disables metrics for the test clusters (the documentation for which is buried in a comment in the Kubernetes docs), which fixes this particular problem. Testing on my local machine, there didn't seem to be any other fixed port assignments cropping up to take its place.
Closes: #1332