8000 Rename CollectableFn, it also doesn't need to be exported · coder/coder@4ab9d1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ab9d1e

Browse files
committed
Rename CollectableFn, it also doesn't need to be exported
Signed-off-by: Callum Styan <callumstyan@gmail.com>
1 parent 8b3fc67 commit 4ab9d1e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

scaletest/harness/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Cleanable interface {
3131
Cleanup(ctx context.Context, id string, logs io.Writer) error
3232
}
3333

34-
// Collectable is an optional extension to Runnable that allows to get metrics from the runner
34+
// Collectable is an optional extension to Runnable that allows to get metrics from the runner.
3535
type Collectable interface {
3636
Runnable
3737
// Gets the bytes transferred

scaletest/harness/run_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ type testFns struct {
1717
RunFn func(ctx context.Context, id string, logs io.Writer) error
1818
// CleanupFn is optional if no cleanup is required.
1919
CleanupFn func(ctx context.Context, id string, logs io.Writer) error
20-
// CollectableFn is optional if byte transfer tracking is required.
21-
CollectableFn func() (int64, int64)
20+
// getBytesTransferred is optional if byte transfer tracking is required.
21+
getBytesTransferred func() (int64, int64)
2222
}
2323

2424
// Run implements Runnable.
@@ -28,11 +28,11 @@ func (fns testFns) Run(ctx context.Context, id string, logs io.Writer) error {
2828

2929
// GetBytesTransferred implements Collectable.
3030
func (fns testFns) GetBytesTransferred() (bytesRead int64, bytesWritten int64) {
31-
if fns.CollectableFn == nil {
31+
if fns.getBytesTransferred == nil {
3232
return 0, 0
3333
}
3434

35-
return fns.CollectableFn()
35+
return fns.getBytesTransferred()
3636
}
3737

3838
// Cleanup implements Cleanable.
@@ -65,7 +65,7 @@ func Test_TestRun(t *testing.T) {
6565
atomic.AddInt64(&cleanupCalled, 1)
6666
return nil
6767
},
68-
CollectableFn: func() (int64, int64) {
68+
getBytesTransferred: func() (int64, int64) {
6969
atomic.AddInt64(&collectableCalled, 1)
7070
return 0, 0
7171
},
@@ -132,7 +132,7 @@ func Test_TestRun(t *testing.T) {
132132
RunFn: func(ctx context.Context, id string, logs io.Writer) error {
133133
return nil
134134
},
135-
CollectableFn: nil,
135+
getBytesTransferred: nil,
136136
})
137137

138138
err := run.Run(context.Background())

0 commit comments

Comments
 (0)
0