github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/datastore/test/basic.go (about) 1 package test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 ) 9 10 func UseAfterCloseTest(t *testing.T, tester DatastoreTester) { 11 require := require.New(t) 12 13 // Create the datastore. 14 ds, err := tester.New(0, veryLargeGCInterval, veryLargeGCWindow, 1) 15 require.NoError(err) 16 17 // Immediately close it. 18 err = ds.Close() 19 require.NoError(err) 20 21 // Attempt to use and ensure an error is returned. 22 _, err = ds.HeadRevision(context.Background()) 23 require.Error(err) 24 }