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.
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:21 -08:00
1 parent 16eab12458
commit 1a6e2fc5b1
1 file changed
+6 -1
+6 -1
View File
@@ -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