Added comment explaining the new unit test
Kubernetes-commit: 42f8d4e28fc05f3532f5cf7d2294049e3314896a
This commit is contained in:
		
							parent
							
								
									60021e2fed
								
							
						
					
					
						commit
						39f5df86ff
					
				|  | @ -35,6 +35,15 @@ const ( | ||||||
| 	numIterations   = 100 | 	numIterations   = 100 | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | /* TestSampler does a rough behavioral test of SampleAndWatermarkHistograms. | ||||||
|  |    The test creates one and exercises it, checking that the count in the | ||||||
|  |    sampling histogram is correct at each step.  A fake clock is used, and | ||||||
|  |    the exercise consists of changing that fake clock by an amount of time | ||||||
|  |    chosen uniformly at random from a range that goes from a little negative | ||||||
|  |    to somewhat more than two sampling periods.  The negative changes are | ||||||
|  |    included because negative changes have been observed in real monotonic | ||||||
|  |    clock readings. | ||||||
|  | */ | ||||||
| func TestSampler(t *testing.T) { | func TestSampler(t *testing.T) { | ||||||
| 	t0 := time.Now() | 	t0 := time.Now() | ||||||
| 	clk := clock.NewFakePassiveClock(t0) | 	clk := clock.NewFakePassiveClock(t0) | ||||||
|  | @ -74,6 +83,7 @@ func TestSampler(t *testing.T) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* getHistogramCount returns the count of the named histogram */ | ||||||
| func getHistogramCount(regs Registerables, metricName string) (int64, error) { | func getHistogramCount(regs Registerables, metricName string) (int64, error) { | ||||||
| 	considered := []string{} | 	considered := []string{} | ||||||
| 	mfs, err := legacyregistry.DefaultGatherer.Gather() | 	mfs, err := legacyregistry.DefaultGatherer.Gather() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue