mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 19:57:40 +08:00
* feat:modify polaris log dir * modify polaris image docker * fix: modify polaris docker image
This commit is contained in:
parent
7753fc6fe1
commit
896b9fa105
2
.github/workflows/gf.yml
vendored
2
.github/workflows/gf.yml
vendored
@ -91,7 +91,7 @@ jobs:
|
||||
- 8123:8123
|
||||
- 9001:9001
|
||||
polaris:
|
||||
image: huyuanxin/polaris-server-with-config:latest
|
||||
image: houseme/polaris-server-with-config:latest
|
||||
ports:
|
||||
- 8090:8090
|
||||
- 8091:8091
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/polarismesh/polaris-go/api"
|
||||
"github.com/polarismesh/polaris-go/pkg/config"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@ -21,7 +22,11 @@ import (
|
||||
// TestRegistry TestRegistryManyService
|
||||
func TestRegistry(t *testing.T) {
|
||||
conf := config.NewDefaultConfiguration([]string{"127.0.0.1:8091"})
|
||||
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := NewWithConfig(
|
||||
conf,
|
||||
WithTimeout(time.Second*10),
|
||||
@ -38,7 +43,7 @@ func TestRegistry(t *testing.T) {
|
||||
Separator: instanceIDSeparator,
|
||||
}
|
||||
|
||||
err := r.Register(ctx, svc)
|
||||
err = r.Register(ctx, svc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -52,6 +57,12 @@ func TestRegistry(t *testing.T) {
|
||||
// TestRegistryMany TestRegistryManyService
|
||||
func TestRegistryMany(t *testing.T) {
|
||||
conf := config.NewDefaultConfiguration([]string{"127.0.0.1:8091"})
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
r := NewWithConfig(
|
||||
conf,
|
||||
@ -81,7 +92,7 @@ func TestRegistryMany(t *testing.T) {
|
||||
Separator: instanceIDSeparator,
|
||||
}
|
||||
|
||||
err := r.Register(context.Background(), svc)
|
||||
err = r.Register(context.Background(), svc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -115,6 +126,11 @@ func TestRegistryMany(t *testing.T) {
|
||||
// TestGetService Test GetService
|
||||
func TestGetService(t *testing.T) {
|
||||
conf := config.NewDefaultConfiguration([]string{"127.0.0.1:8091"})
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
r := NewWithConfig(
|
||||
conf,
|
||||
@ -132,7 +148,7 @@ func TestGetService(t *testing.T) {
|
||||
Separator: instanceIDSeparator,
|
||||
}
|
||||
|
||||
err := r.Register(ctx, svc)
|
||||
err = r.Register(ctx, svc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -161,7 +177,11 @@ func TestGetService(t *testing.T) {
|
||||
// TestWatch Test Watch
|
||||
func TestWatch(t *testing.T) {
|
||||
conf := config.NewDefaultConfiguration([]string{"127.0.0.1:8091"})
|
||||
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := NewWithConfig(
|
||||
conf,
|
||||
WithTimeout(time.Second*10),
|
||||
|
@ -1,13 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/polarismesh/polaris-go/api"
|
||||
"github.com/polarismesh/polaris-go/pkg/config"
|
||||
|
||||
"github.com/gogf/gf/contrib/registry/polaris/v2"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/gsvc"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
@ -15,6 +16,11 @@ import (
|
||||
|
||||
func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"192.168.100.222:8091"})
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
g.Log().Fatal(context.Background(), err)
|
||||
}
|
||||
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(100)))
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/polarismesh/polaris-go/api"
|
||||
"github.com/polarismesh/polaris-go/pkg/config"
|
||||
|
||||
"github.com/gogf/gf/contrib/registry/polaris/v2"
|
||||
@ -11,6 +14,11 @@ import (
|
||||
|
||||
func main() {
|
||||
conf := config.NewDefaultConfiguration([]string{"192.168.100.222:8091"})
|
||||
conf.Consumer.LocalCache.SetPersistDir("/tmp/polaris/backup")
|
||||
err := api.SetLoggersDir("/tmp/polaris/log")
|
||||
if err != nil {
|
||||
g.Log().Fatal(context.Background(), err)
|
||||
}
|
||||
|
||||
// TTL egt 2*time.Second
|
||||
gsvc.SetRegistry(polaris.NewWithConfig(conf, polaris.WithTTL(100)))
|
||||
|
Loading…
Reference in New Issue
Block a user