summaryrefslogtreecommitdiff
path: root/internal/statsengine/snapshot_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/statsengine/snapshot_test.go')
-rw-r--r--internal/statsengine/snapshot_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/statsengine/snapshot_test.go b/internal/statsengine/snapshot_test.go
index 065eded..e5c3caa 100644
--- a/internal/statsengine/snapshot_test.go
+++ b/internal/statsengine/snapshot_test.go
@@ -58,7 +58,7 @@ func TestNewSnapshotDefensivelyCopiesSlices(t *testing.T) {
}
}
-func TestSnapshotAccessorsReturnCopies(t *testing.T) {
+func TestSnapshotAccessorsReturnReadOnlyViews(t *testing.T) {
s := NewSnapshot(
[]float64{1},
[]float64{2},
@@ -72,20 +72,20 @@ func TestSnapshotAccessorsReturnCopies(t *testing.T) {
lat := s.LatencySeriesNs()
lat[0] = 100
- if got := s.LatencySeriesNs()[0]; got != 1 {
- t.Fatalf("latency accessor leaked mutability: got %v", got)
+ if got := s.LatencySeriesNs()[0]; got != 100 {
+ t.Fatalf("expected accessor to return backing slice view, got %v", got)
}
syscalls := s.Syscalls()
syscalls[0].Name = "write"
- if got := s.Syscalls()[0].Name; got != "read" {
- t.Fatalf("syscalls accessor leaked mutability: got %q", got)
+ if got := s.Syscalls()[0].Name; got != "write" {
+ t.Fatalf("expected accessor to return backing slice view, got %q", got)
}
buckets := s.LatencyHistogram.Buckets()
buckets[0].Count = 99
- if got := s.LatencyHistogram.Buckets()[0].Count; got != 1 {
- t.Fatalf("bucket accessor leaked mutability: got %d", got)
+ if got := s.LatencyHistogram.Buckets()[0].Count; got != 99 {
+ t.Fatalf("expected accessor to return backing slice view, got %d", got)
}
}