Skip to content

Commit

Permalink
fix(tests): Remove unnecessary duration conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
pdf committed Nov 16, 2021
1 parent bbd3d91 commit b6a29ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 3 additions & 7 deletions collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ func callCollector(ctx context.Context, collector prometheus.Collector, metricRe
}
}

func defaultConfig(z zfs.Client) (ZFSConfig, error) {
duration, err := time.ParseDuration(`5m`)
if err != nil {
return ZFSConfig{}, err
}
func defaultConfig(z zfs.Client) ZFSConfig {
return ZFSConfig{
DisableMetrics: true,
Deadline: duration,
Deadline: 5 * time.Minute,
Logger: logger,
ZFSClient: z,
}, nil
}
}

func stringPointer(s string) *string {
Expand Down
5 changes: 1 addition & 4 deletions collector/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ zfs_dataset_unsupported{name="testpool/test",pool="testpool",type="filesystem"}
t.Parallel()
ctrl, ctx := gomock.WithContext(context.Background(), t)
zfsClient := mock_zfs.NewMockClient(ctrl)
config, err := defaultConfig(zfsClient)
if err != nil {
t.Fatal(err)
}
config := defaultConfig(zfsClient)
if tc.explicitPools != nil {
config.Pools = tc.explicitPools
}
Expand Down
5 changes: 1 addition & 4 deletions collector/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ zfs_pool_unsupported{pool="testpool"} 1024
t.Parallel()
ctrl, ctx := gomock.WithContext(context.Background(), t)
zfsClient := mock_zfs.NewMockClient(ctrl)
config, err := defaultConfig(zfsClient)
if err != nil {
t.Fatal(err)
}
config := defaultConfig(zfsClient)
if tc.explicitPools != nil {
config.Pools = tc.explicitPools
}
Expand Down

0 comments on commit b6a29ab

Please sign in to comment.