-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with config reload when using a log pipeline with a metric …
…stage (#6971) * Fix bug with unnecessary config reload * Apply suggestions from code review Co-authored-by: Clayton Cornell <[email protected]> Co-authored-by: Piotr <[email protected]> * Refactor Flow unit test to make it more readable. * Add comments, prettify tests. --------- Co-authored-by: Clayton Cornell <[email protected]> Co-authored-by: Piotr <[email protected]>
- Loading branch information
1 parent
8dbd241
commit 0936175
Showing
8 changed files
with
331 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_UnregisterTwice_NormalCollector(t *testing.T) { | ||
u := WrapWithUnregisterer(prometheus.NewRegistry()) | ||
c := prometheus.NewCounter(prometheus.CounterOpts{ | ||
Name: "test_metric", | ||
Help: "Test metric.", | ||
}) | ||
u.Register(c) | ||
require.True(t, u.Unregister(c)) | ||
require.False(t, u.Unregister(c)) | ||
} | ||
|
||
type uncheckedCollector struct{} | ||
|
||
func (uncheckedCollector) Describe(chan<- *prometheus.Desc) {} | ||
|
||
func (uncheckedCollector) Collect(chan<- prometheus.Metric) {} | ||
|
||
var _ prometheus.Collector = uncheckedCollector{} | ||
|
||
func Test_UnregisterTwice_UncheckedCollector(t *testing.T) { | ||
u := WrapWithUnregisterer(prometheus.NewRegistry()) | ||
c := uncheckedCollector{} | ||
u.Register(c) | ||
require.True(t, u.Unregister(c)) | ||
require.True(t, u.Unregister(c)) | ||
} |
Oops, something went wrong.