...

Source file src/github.com/go-kivik/kivik/v4/x/fsdb/test/fs_test.go

Documentation: github.com/go-kivik/kivik/v4/x/fsdb/test

     1  // Licensed under the Apache License, Version 2.0 (the "License"); you may not
     2  // use this file except in compliance with the License. You may obtain a copy of
     3  // the License at
     4  //
     5  //  http://www.apache.org/licenses/LICENSE-2.0
     6  //
     7  // Unless required by applicable law or agreed to in writing, software
     8  // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     9  // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    10  // License for the specific language governing permissions and limitations under
    11  // the License.
    12  
    13  //go:build !js
    14  
    15  package test
    16  
    17  import (
    18  	"os"
    19  	"testing"
    20  
    21  	"github.com/go-kivik/kivik/v4"
    22  	"github.com/go-kivik/kivik/v4/kiviktest"
    23  	"github.com/go-kivik/kivik/v4/kiviktest/kt"
    24  	_ "github.com/go-kivik/kivik/v4/x/fsdb" // The filesystem DB driver
    25  )
    26  
    27  func init() {
    28  	RegisterFSSuite()
    29  }
    30  
    31  func TestFS(t *testing.T) {
    32  	tempDir, err := os.MkdirTemp("", "kivik.test.")
    33  	if err != nil {
    34  		t.Errorf("Failed to create temp dir to test FS driver: %s\n", err)
    35  		return
    36  	}
    37  	t.Cleanup(func() {
    38  		_ = os.RemoveAll(tempDir)
    39  	})
    40  	client, err := kivik.New("fs", tempDir)
    41  	if err != nil {
    42  		t.Errorf("Failed to connect to FS driver: %s\n", err)
    43  		return
    44  	}
    45  	clients := &kt.Context{
    46  		RW:    true,
    47  		Admin: client,
    48  		T:     t,
    49  	}
    50  	kiviktest.RunTestsInternal(clients, kiviktest.SuiteKivikFS)
    51  }
    52  

View as plain text