integration/fixtures: Move the 'tests/integration/fixtures' directory up and update references.

I moved the files up as they are shared between e2e & integrational tests.
This commit is contained in:
Piotr Tabor 2020-10-07 15:38:28 +02:00
parent bb9703820c
commit be4e8b7013
76 changed files with 86 additions and 79 deletions

View File

@ -64,7 +64,7 @@ The command should show that the handshake succeed. Since we use self-signed cer
**OSX 10.9+ Users**: curl 7.30.0 on OSX 10.9+ doesn't understand certificates passed in on the command line. **OSX 10.9+ Users**: curl 7.30.0 on OSX 10.9+ doesn't understand certificates passed in on the command line.
Instead, import the dummy ca.crt directly into the keychain or add the `-k` flag to curl to ignore errors. Instead, import the dummy ca.crt directly into the keychain or add the `-k` flag to curl to ignore errors.
To test without the `-k` flag, run `open ./fixtures/ca/ca.crt` and follow the prompts. To test without the `-k` flag, run `open ./tests/fixtures/ca/ca.crt` and follow the prompts.
Please remove this certificate after testing! Please remove this certificate after testing!
If there is a workaround, let us know. If there is a workaround, let us know.

View File

@ -23,11 +23,11 @@ import (
) )
const ( const (
jwtRSAPubKey = "../integration/fixtures/server.crt" jwtRSAPubKey = "../tests/fixtures/server.crt"
jwtRSAPrivKey = "../integration/fixtures/server.key.insecure" jwtRSAPrivKey = "../tests/fixtures/server.key.insecure"
jwtECPubKey = "../integration/fixtures/server-ecdsa.crt" jwtECPubKey = "../tests/fixtures/server-ecdsa.crt"
jwtECPrivKey = "../integration/fixtures/server-ecdsa.key.insecure" jwtECPrivKey = "../tests/fixtures/server-ecdsa.key.insecure"
) )
func TestJWTInfo(t *testing.T) { func TestJWTInfo(t *testing.T) {

View File

@ -25,9 +25,9 @@ import (
) )
var ( var (
certPath = "../../tests/integration/fixtures/server.crt" certPath = "../../tests/fixtures/server.crt"
privateKeyPath = "../../tests/integration/fixtures/server.key.insecure" privateKeyPath = "../../tests/fixtures/server.key.insecure"
caPath = "../../tests/integration/fixtures/ca.crt" caPath = "../../tests/fixtures/ca.crt"
) )
func TestConfigFromFile(t *testing.T) { func TestConfigFromFile(t *testing.T) {

View File

@ -38,9 +38,9 @@ import (
var testLogger = zap.NewExample() var testLogger = zap.NewExample()
var testTLSInfo = transport.TLSInfo{ var testTLSInfo = transport.TLSInfo{
KeyFile: "./fixtures/server.key.insecure", KeyFile: "../../tests/fixtures/server.key.insecure",
CertFile: "./fixtures/server.crt", CertFile: "../../tests/fixtures/server.crt",
TrustedCAFile: "./fixtures/ca.crt", TrustedCAFile: "../../tests/fixtures/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }

View File

@ -267,10 +267,10 @@ func newProxyV3Proc(cfg *etcdServerProcessConfig) *proxyV3Proc {
// Configure certificates for connection proxy ---> server. // Configure certificates for connection proxy ---> server.
// This certificate must NOT have CN set. // This certificate must NOT have CN set.
tlsArgs = append(tlsArgs, tlsArgs = append(tlsArgs,
"--cert", "../../integration/fixtures/client-nocn.crt", "--cert", "../fixtures/client-nocn.crt",
"--key", "../../integration/fixtures/client-nocn.key.insecure", "--key", "../fixtures/client-nocn.key.insecure",
"--cacert", "../../integration/fixtures/ca.crt", "--cacert", "../fixtures/ca.crt",
"--client-crl-file", "../../integration/fixtures/revoke.crl") "--client-crl-file", "../fixtures/revoke.crl")
} }
return &proxyV3Proc{ return &proxyV3Proc{
proxyProc{ proxyProc{

View File

@ -90,7 +90,7 @@ var (
configJWT = etcdProcessClusterConfig{ configJWT = etcdProcessClusterConfig{
clusterSize: 1, clusterSize: 1,
initialToken: "new", initialToken: "new",
authTokenOpts: "jwt,pub-key=../../integration/fixtures/server.crt,priv-key=../../integration/fixtures/server.key.insecure,sign-method=RS256,ttl=1s", authTokenOpts: "jwt,pub-key=../fixtures/server.crt,priv-key=../fixtures/server.key.insecure,sign-method=RS256,ttl=1s",
} }
) )

View File

@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
os.Unsetenv("ETCDCTL_API") os.Unsetenv("ETCDCTL_API")
flag.StringVar(&binDir, "bin-dir", "../../bin", "The directory for store etcd and etcdctl binaries.") flag.StringVar(&binDir, "bin-dir", "../../bin", "The directory for store etcd and etcdctl binaries.")
flag.StringVar(&certDir, "cert-dir", "../../integration/fixtures", "The directory for store certificate files.") flag.StringVar(&certDir, "cert-dir", "../fixtures", "The directory for store certificate files.")
flag.Parse() flag.Parse()
binPath = binDir + "/etcd" binPath = binDir + "/etcd"

View File

@ -14,7 +14,7 @@
// +build !cluster_proxy // +build !cluster_proxy
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"
@ -31,16 +31,16 @@ import (
var ( var (
testTLSInfo = transport.TLSInfo{ testTLSInfo = transport.TLSInfo{
KeyFile: "../../integration/fixtures/server.key.insecure", KeyFile: "../../fixtures/server.key.insecure",
CertFile: "../../integration/fixtures/server.crt", CertFile: "../../fixtures/server.crt",
TrustedCAFile: "../../integration/fixtures/ca.crt", TrustedCAFile: "../../fixtures/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }
testTLSInfoExpired = transport.TLSInfo{ testTLSInfoExpired = transport.TLSInfo{
KeyFile: "../../integration/fixtures-expired/server.key.insecure", KeyFile: "../fixtures-expired/server.key.insecure",
CertFile: "../../integration/fixtures-expired/server.crt", CertFile: "../fixtures-expired/server.crt",
TrustedCAFile: "../../integration/fixtures-expired/ca.crt", TrustedCAFile: "../fixtures-expired/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }
) )

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package clientv3_test package clientv3test
import ( import (
"fmt" "fmt"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package naming_test package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"bytes" "bytes"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"io/ioutil" "io/ioutil"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package integration package clientv3test
import ( import (
"testing" "testing"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"bytes" "bytes"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"bufio" "bufio"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -14,7 +14,7 @@
// +build !cluster_proxy // +build !cluster_proxy
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package ordering package clientv3test
import ( import (
"context" "context"
@ -21,6 +21,7 @@ import (
"go.etcd.io/etcd/tests/v3/integration" "go.etcd.io/etcd/tests/v3/integration"
"go.etcd.io/etcd/v3/clientv3" "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/clientv3/ordering"
"go.etcd.io/etcd/v3/pkg/testutil" "go.etcd.io/etcd/v3/pkg/testutil"
) )
@ -38,6 +39,7 @@ func TestEndpointSwitchResolvesViolation(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer cli.Close()
ctx := context.TODO() ctx := context.TODO()
@ -64,7 +66,7 @@ func TestEndpointSwitchResolvesViolation(t *testing.T) {
// NewOrderViolationSwitchEndpointClosure will be able to // NewOrderViolationSwitchEndpointClosure will be able to
// access the full list of endpoints. // access the full list of endpoints.
cli.SetEndpoints(eps...) cli.SetEndpoints(eps...)
OrderingKv := NewKV(cli.KV, NewOrderViolationSwitchEndpointClosure(*cli)) OrderingKv := ordering.NewKV(cli.KV, ordering.NewOrderViolationSwitchEndpointClosure(*cli))
// set prevRev to the second member's revision of "foo" such that // set prevRev to the second member's revision of "foo" such that
// the revision is higher than the third member's revision of "foo" // the revision is higher than the third member's revision of "foo"
_, err = OrderingKv.Get(ctx, "foo") _, err = OrderingKv.Get(ctx, "foo")
@ -97,6 +99,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer cli.Close()
eps := cli.Endpoints() eps := cli.Endpoints()
ctx := context.TODO() ctx := context.TODO()
@ -123,7 +126,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
// access the full list of endpoints. // access the full list of endpoints.
cli.SetEndpoints(eps...) cli.SetEndpoints(eps...)
time.Sleep(1 * time.Second) // give enough time for operation time.Sleep(1 * time.Second) // give enough time for operation
OrderingKv := NewKV(cli.KV, NewOrderViolationSwitchEndpointClosure(*cli)) OrderingKv := ordering.NewKV(cli.KV, ordering.NewOrderViolationSwitchEndpointClosure(*cli))
// set prevRev to the first member's revision of "foo" such that // set prevRev to the first member's revision of "foo" such that
// the revision is higher than the fourth and fifth members' revision of "foo" // the revision is higher than the fourth and fifth members' revision of "foo"
_, err = OrderingKv.Get(ctx, "foo") _, err = OrderingKv.Get(ctx, "foo")
@ -147,7 +150,7 @@ func TestUnresolvableOrderViolation(t *testing.T) {
time.Sleep(5 * time.Second) // give enough time for operation time.Sleep(5 * time.Second) // give enough time for operation
_, err = OrderingKv.Get(ctx, "foo", clientv3.WithSerializable()) _, err = OrderingKv.Get(ctx, "foo", clientv3.WithSerializable())
if err != ErrNoGreaterRev { if err != ordering.ErrNoGreaterRev {
t.Fatalf("expected %v, got %v", ErrNoGreaterRev, err) t.Fatalf("expected %v, got %v", ordering.ErrNoGreaterRev, err)
} }
} }

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"bytes" "bytes"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -14,7 +14,7 @@
// +build !cluster_proxy // +build !cluster_proxy
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package integration package clientv3test
import ( import (
"context" "context"

View File

@ -81,16 +81,16 @@ var (
localListenCount = int64(0) localListenCount = int64(0)
testTLSInfo = transport.TLSInfo{ testTLSInfo = transport.TLSInfo{
KeyFile: "./fixtures/server.key.insecure", KeyFile: "../fixtures/server.key.insecure",
CertFile: "./fixtures/server.crt", CertFile: "../fixtures/server.crt",
TrustedCAFile: "./fixtures/ca.crt", TrustedCAFile: "../fixtures/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }
testTLSInfoIP = transport.TLSInfo{ testTLSInfoIP = transport.TLSInfo{
KeyFile: "./fixtures/server-ip.key.insecure", KeyFile: "../fixtures/server-ip.key.insecure",
CertFile: "./fixtures/server-ip.crt", CertFile: "../fixtures/server-ip.crt",
TrustedCAFile: "./fixtures/ca.crt", TrustedCAFile: "../fixtures/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }
@ -108,7 +108,7 @@ var (
ClientCertAuth: true, ClientCertAuth: true,
} }
defaultTokenJWT = "jwt,pub-key=./fixtures/server.crt,priv-key=./fixtures/server.key.insecure,sign-method=RS256,ttl=1s" defaultTokenJWT = "jwt,pub-key=../fixtures/server.crt,priv-key=../fixtures/server.key.insecure,sign-method=RS256,ttl=1s"
lg = zap.NewNop() lg = zap.NewNop()
) )

View File

@ -37,9 +37,9 @@ import (
var ( var (
testTLSInfo = transport.TLSInfo{ testTLSInfo = transport.TLSInfo{
KeyFile: "../fixtures/server.key.insecure", KeyFile: "../../fixtures/server.key.insecure",
CertFile: "../fixtures/server.crt", CertFile: "../../fixtures/server.crt",
TrustedCAFile: "../fixtures/ca.crt", TrustedCAFile: "../../fixtures/ca.crt",
ClientCertAuth: true, ClientCertAuth: true,
} }
) )

View File

@ -24,6 +24,7 @@ import (
"go.etcd.io/etcd/tests/v3/integration" "go.etcd.io/etcd/tests/v3/integration"
"go.etcd.io/etcd/v3/clientv3" "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/pkg/testutil" "go.etcd.io/etcd/v3/pkg/testutil"
"go.etcd.io/etcd/v3/proxy/grpcproxy"
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -114,8 +115,8 @@ func newClusterProxyServer(lg *zap.Logger, endpoints []string, t *testing.T) *cl
cts.server.Serve(cts.l) cts.server.Serve(cts.l)
}() }()
Register(lg, client, "test-prefix", cts.l.Addr().String(), 7) grpcproxy.Register(lg, client, "test-prefix", cts.l.Addr().String(), 7)
cts.cp, cts.donec = NewClusterProxy(lg, client, cts.l.Addr().String(), "test-prefix") cts.cp, cts.donec = grpcproxy.NewClusterProxy(lg, client, cts.l.Addr().String(), "test-prefix")
cts.caddr = cts.l.Addr().String() cts.caddr = cts.l.Addr().String()
pb.RegisterClusterServer(cts.server, cts.cp) pb.RegisterClusterServer(cts.server, cts.cp)
close(servec) close(servec)

View File

@ -24,6 +24,7 @@ import (
"go.etcd.io/etcd/tests/v3/integration" "go.etcd.io/etcd/tests/v3/integration"
"go.etcd.io/etcd/v3/clientv3" "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/pkg/testutil" "go.etcd.io/etcd/v3/pkg/testutil"
"go.etcd.io/etcd/v3/proxy/grpcproxy"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -76,7 +77,7 @@ func newKVProxyServer(endpoints []string, t *testing.T) *kvproxyTestServer {
t.Fatal(err) t.Fatal(err)
} }
kvp, _ := NewKvProxy(client) kvp, _ := grpcproxy.NewKvProxy(client)
kvts := &kvproxyTestServer{ kvts := &kvproxyTestServer{
kp: kvp, kp: kvp,

View File

@ -22,6 +22,7 @@ import (
"go.etcd.io/etcd/v3/clientv3" "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/clientv3/naming" "go.etcd.io/etcd/v3/clientv3/naming"
"go.etcd.io/etcd/v3/pkg/testutil" "go.etcd.io/etcd/v3/pkg/testutil"
"go.etcd.io/etcd/v3/proxy/grpcproxy"
"go.uber.org/zap" "go.uber.org/zap"
gnaming "google.golang.org/grpc/naming" gnaming "google.golang.org/grpc/naming"
@ -45,7 +46,7 @@ func TestRegister(t *testing.T) {
t.Fatalf("len(ups) expected 0, got %d (%v)", len(ups), ups) t.Fatalf("len(ups) expected 0, got %d (%v)", len(ups), ups)
} }
donec := Register(zap.NewExample(), cli, testPrefix, paddr, 5) donec := grpcproxy.Register(zap.NewExample(), cli, testPrefix, paddr, 5)
ups, err = wa.Next() ups, err = wa.Next()
if err != nil { if err != nil {

View File

@ -26,6 +26,7 @@ import (
"time" "time"
"go.etcd.io/etcd/v3/clientv3" "go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/clientv3/snapshot"
"go.etcd.io/etcd/v3/embed" "go.etcd.io/etcd/v3/embed"
"go.etcd.io/etcd/v3/pkg/fileutil" "go.etcd.io/etcd/v3/pkg/fileutil"
"go.etcd.io/etcd/v3/pkg/testutil" "go.etcd.io/etcd/v3/pkg/testutil"
@ -55,12 +56,12 @@ func TestSnapshotV3RestoreSingle(t *testing.T) {
cfg.InitialCluster = fmt.Sprintf("%s=%s", cfg.Name, pURLs[0].String()) cfg.InitialCluster = fmt.Sprintf("%s=%s", cfg.Name, pURLs[0].String())
cfg.Dir = filepath.Join(os.TempDir(), fmt.Sprint(time.Now().Nanosecond())) cfg.Dir = filepath.Join(os.TempDir(), fmt.Sprint(time.Now().Nanosecond()))
sp := NewV3(zap.NewExample()) sp := snapshot.NewV3(zap.NewExample())
pss := make([]string, 0, len(pURLs)) pss := make([]string, 0, len(pURLs))
for _, p := range pURLs { for _, p := range pURLs {
pss = append(pss, p.String()) pss = append(pss, p.String())
} }
if err := sp.Restore(RestoreConfig{ if err := sp.Restore(snapshot.RestoreConfig{
SnapshotPath: dbPath, SnapshotPath: dbPath,
Name: cfg.Name, Name: cfg.Name,
OutputDataDir: cfg.Dir, OutputDataDir: cfg.Dir,
@ -168,7 +169,7 @@ func TestCorruptedBackupFileCheck(t *testing.T) {
t.Fatalf("test file [%s] does not exist: %v", dbPath, err) t.Fatalf("test file [%s] does not exist: %v", dbPath, err)
} }
sp := NewV3(zap.NewExample()) sp := snapshot.NewV3(zap.NewExample())
_, err := sp.Status(dbPath) _, err := sp.Status(dbPath)
expectedErrKeywords := "snapshot file integrity check failed" expectedErrKeywords := "snapshot file integrity check failed"
/* example error message: /* example error message:
@ -236,7 +237,7 @@ func createSnapshotFile(t *testing.T, kvs []kv) string {
} }
} }
sp := NewV3(zap.NewExample()) sp := snapshot.NewV3(zap.NewExample())
dpPath := filepath.Join(os.TempDir(), fmt.Sprintf("snapshot%d.db", time.Now().Nanosecond())) dpPath := filepath.Join(os.TempDir(), fmt.Sprintf("snapshot%d.db", time.Now().Nanosecond()))
if err = sp.Save(context.Background(), ccfg, dpPath); err != nil { if err = sp.Save(context.Background(), ccfg, dpPath); err != nil {
t.Fatal(err) t.Fatal(err)
@ -275,8 +276,8 @@ func restoreCluster(t *testing.T, clusterN int, dbPath string) (
cfg.InitialCluster = ics cfg.InitialCluster = ics
cfg.Dir = filepath.Join(os.TempDir(), fmt.Sprint(time.Now().Nanosecond()+i)) cfg.Dir = filepath.Join(os.TempDir(), fmt.Sprint(time.Now().Nanosecond()+i))
sp := NewV3(zap.NewExample()) sp := snapshot.NewV3(zap.NewExample())
if err := sp.Restore(RestoreConfig{ if err := sp.Restore(snapshot.RestoreConfig{
SnapshotPath: dbPath, SnapshotPath: dbPath,
Name: cfg.Name, Name: cfg.Name,
OutputDataDir: cfg.Dir, OutputDataDir: cfg.Dir,