2024-02-18 13:23:11 +08:00
|
|
|
package tests
|
|
|
|
|
|
|
|
import (
|
2024-06-26 12:17:41 +08:00
|
|
|
"apigo.cc/apigo/gojs"
|
|
|
|
"apigo.cc/apigo/plugin"
|
|
|
|
_ "apigo.cc/apigo/plugins/redis"
|
2024-02-18 13:23:11 +08:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRedis(t *testing.T) {
|
2024-03-24 12:28:02 +08:00
|
|
|
rdServer := StartRedis("16378")
|
2024-02-18 13:23:11 +08:00
|
|
|
defer rdServer.Close()
|
|
|
|
|
|
|
|
gojs.SetPluginsConfig(map[string]plugin.Config{
|
2024-06-26 12:17:41 +08:00
|
|
|
"apigo.cc/apigo/plugins/redis": {
|
2024-03-24 12:28:02 +08:00
|
|
|
"default": "redis://localhost:16378",
|
|
|
|
"configs": map[string]string{
|
|
|
|
"bak": "redis://localhost:16378/2",
|
|
|
|
},
|
2024-02-18 13:23:11 +08:00
|
|
|
},
|
|
|
|
})
|
2024-03-24 12:28:02 +08:00
|
|
|
r, err := gojs.RunFile("redis_test.js", nil)
|
2024-02-18 13:23:11 +08:00
|
|
|
Test(t, "get", r == true && err == nil, r, err)
|
|
|
|
}
|