internal/storage: fix options test

An assert created in the parent was being used in subtests,
which will attribute test failures incorrectly.
Also run tests in parallel.
pull/4202/head
Johan Brandhorst-Satzkorn 2 years ago
parent 16eab12458
commit 1a6e2fc5b1

@ -12,8 +12,9 @@ import (
// Test_getOpts provides unit tests for GetOpts and all the options
func Test_getOpts(t *testing.T) {
t.Parallel()
assert := assert.New(t)
t.Run("WithCloseSyncMode", func(t *testing.T) {
t.Parallel()
assert := assert.New(t)
testOpts := getDefaultOptions()
opts := GetOpts(WithCloseSyncMode(Asynchronous))
assert.Equal(testOpts, opts)
@ -29,6 +30,8 @@ func Test_getOpts(t *testing.T) {
assert.Equal(opts, testOpts)
})
t.Run("WithFileAccessMode", func(t *testing.T) {
t.Parallel()
assert := assert.New(t)
testOpts := getDefaultOptions()
opts := GetOpts(WithFileAccessMode(ReadOnly))
assert.Equal(testOpts, opts)
@ -44,6 +47,8 @@ func Test_getOpts(t *testing.T) {
assert.Equal(opts, testOpts)
})
t.Run("WithCreateFile", func(t *testing.T) {
t.Parallel()
assert := assert.New(t)
testOpts := getDefaultOptions()
opts := GetOpts()
testOpts.WithCreateFile = false

Loading…
Cancel
Save