mirror of
https://github.com/talent-plan/tinykv.git
synced 2025-04-06 01:20:51 +08:00
test(project1): call StandAloneStorage.Start before test code run (#197)
close #195
This commit is contained in:
parent
c7fa725b05
commit
d13ccb8785
@ -50,8 +50,10 @@ func cleanUpTestData(conf *config.Config) error {
|
|||||||
func TestRawGet1(t *testing.T) {
|
func TestRawGet1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
Set(s, cf, []byte{99}, []byte{42})
|
Set(s, cf, []byte{99}, []byte{42})
|
||||||
@ -68,8 +70,10 @@ func TestRawGet1(t *testing.T) {
|
|||||||
func TestRawGetNotFound1(t *testing.T) {
|
func TestRawGetNotFound1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
req := &kvrpcpb.RawGetRequest{
|
req := &kvrpcpb.RawGetRequest{
|
||||||
@ -84,8 +88,10 @@ func TestRawGetNotFound1(t *testing.T) {
|
|||||||
func TestRawPut1(t *testing.T) {
|
func TestRawPut1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
req := &kvrpcpb.RawPutRequest{
|
req := &kvrpcpb.RawPutRequest{
|
||||||
@ -104,8 +110,10 @@ func TestRawPut1(t *testing.T) {
|
|||||||
func TestRawGetAfterRawPut1(t *testing.T) {
|
func TestRawGetAfterRawPut1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
put1 := &kvrpcpb.RawPutRequest{
|
put1 := &kvrpcpb.RawPutRequest{
|
||||||
Key: []byte{99},
|
Key: []byte{99},
|
||||||
@ -143,8 +151,10 @@ func TestRawGetAfterRawPut1(t *testing.T) {
|
|||||||
func TestRawGetAfterRawDelete1(t *testing.T) {
|
func TestRawGetAfterRawDelete1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
assert.Nil(t, Set(s, cf, []byte{99}, []byte{42}))
|
assert.Nil(t, Set(s, cf, []byte{99}, []byte{42}))
|
||||||
@ -169,8 +179,10 @@ func TestRawGetAfterRawDelete1(t *testing.T) {
|
|||||||
func TestRawDelete1(t *testing.T) {
|
func TestRawDelete1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
assert.Nil(t, Set(s, cf, []byte{99}, []byte{42}))
|
assert.Nil(t, Set(s, cf, []byte{99}, []byte{42}))
|
||||||
@ -191,8 +203,10 @@ func TestRawDelete1(t *testing.T) {
|
|||||||
func TestRawScan1(t *testing.T) {
|
func TestRawScan1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
|
|
||||||
@ -222,8 +236,10 @@ func TestRawScan1(t *testing.T) {
|
|||||||
func TestRawScanAfterRawPut1(t *testing.T) {
|
func TestRawScanAfterRawPut1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
||||||
@ -260,8 +276,10 @@ func TestRawScanAfterRawPut1(t *testing.T) {
|
|||||||
func TestRawScanAfterRawDelete1(t *testing.T) {
|
func TestRawScanAfterRawDelete1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
||||||
@ -297,8 +315,10 @@ func TestRawScanAfterRawDelete1(t *testing.T) {
|
|||||||
func TestIterWithRawDelete1(t *testing.T) {
|
func TestIterWithRawDelete1(t *testing.T) {
|
||||||
conf := config.NewTestConfig()
|
conf := config.NewTestConfig()
|
||||||
s := standalone_storage.NewStandAloneStorage(conf)
|
s := standalone_storage.NewStandAloneStorage(conf)
|
||||||
|
s.Start()
|
||||||
server := NewServer(s)
|
server := NewServer(s)
|
||||||
defer cleanUpTestData(conf)
|
defer cleanUpTestData(conf)
|
||||||
|
defer s.Stop()
|
||||||
|
|
||||||
cf := engine_util.CfDefault
|
cf := engine_util.CfDefault
|
||||||
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
assert.Nil(t, Set(s, cf, []byte{1}, []byte{233, 1}))
|
||||||
|
Loading…
Reference in New Issue
Block a user