mirror of https://github.com/tidwall/tile38.git
wip - Better AOFMIGRATE tests
This commit is contained in:
parent
46927b476f
commit
cfc9673957
|
@ -17,6 +17,7 @@ import (
|
||||||
|
|
||||||
func subTestAOF(g *testGroup) {
|
func subTestAOF(g *testGroup) {
|
||||||
g.regSubTest("loading", aof_loading_test)
|
g.regSubTest("loading", aof_loading_test)
|
||||||
|
g.regSubTest("migrate", aof_migrate_test)
|
||||||
g.regSubTest("AOF", aof_AOF_test)
|
g.regSubTest("AOF", aof_AOF_test)
|
||||||
g.regSubTest("AOFMD5", aof_AOFMD5_test)
|
g.regSubTest("AOFMD5", aof_AOFMD5_test)
|
||||||
g.regSubTest("AOFSHRINK", aof_AOFSHRINK_test)
|
g.regSubTest("AOFSHRINK", aof_AOFSHRINK_test)
|
||||||
|
@ -286,3 +287,21 @@ func aof_READONLY_test(mc *mockServer) error {
|
||||||
Do("READONLY", "maybe").Err("invalid argument 'maybe'"),
|
Do("READONLY", "maybe").Err("invalid argument 'maybe'"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func aof_migrate_test(mc *mockServer) error {
|
||||||
|
// var aof string
|
||||||
|
// aof += "set 1 2 point 10 10\r\n"
|
||||||
|
// aof += "set 2 3 point 30 30\r\n"
|
||||||
|
// mc2, err := mockOpenServer(MockServerOptions{
|
||||||
|
// AOFFileName: "aof",
|
||||||
|
// AOFData: []byte(aof),
|
||||||
|
// Silent: true,
|
||||||
|
// Metrics: true,
|
||||||
|
// })
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// defer mc2.Close()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -53,9 +53,10 @@ func (mc *mockServer) metricsPort() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MockServerOptions struct {
|
type MockServerOptions struct {
|
||||||
AOFData []byte
|
AOFFileName string
|
||||||
Silent bool
|
AOFData []byte
|
||||||
Metrics bool
|
Silent bool
|
||||||
|
Metrics bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextPort int32 = 10000
|
var nextPort int32 = 10000
|
||||||
|
@ -88,10 +89,13 @@ func mockOpenServer(opts MockServerOptions) (*mockServer, error) {
|
||||||
fmt.Printf("Starting test server at port %d\n", port)
|
fmt.Printf("Starting test server at port %d\n", port)
|
||||||
}
|
}
|
||||||
if len(opts.AOFData) > 0 {
|
if len(opts.AOFData) > 0 {
|
||||||
|
if opts.AOFFileName == "" {
|
||||||
|
opts.AOFFileName = "appendonly.aof"
|
||||||
|
}
|
||||||
if err := os.MkdirAll(dir, 0777); err != nil {
|
if err := os.MkdirAll(dir, 0777); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err := os.WriteFile(filepath.Join(dir, "appendonly.aof"),
|
err := os.WriteFile(filepath.Join(dir, opts.AOFFileName),
|
||||||
opts.AOFData, 0666)
|
opts.AOFData, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue