You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2022/01/17 09:31:20 UTC
[servicecomb-service-center] branch master updated: Upgrade etcdadpt version (#1224)
This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new d447cff Upgrade etcdadpt version (#1224)
d447cff is described below
commit d447cff919dc593d1984e8cc52b6a107668ca8c0
Author: little-cui <su...@qq.com>
AuthorDate: Mon Jan 17 17:31:13 2022 +0800
Upgrade etcdadpt version (#1224)
---
.gitignore | 19 ++++++-----------
datasource/etcd/sd/servicecenter/aggregate_test.go | 11 +---------
eventbase/README.md | 24 ++++++++++++----------
eventbase/go.mod | 2 +-
eventbase/go.sum | 2 ++
go.mod | 8 +++++---
go.sum | 2 ++
test/test.go | 18 ++++++----------
8 files changed, 36 insertions(+), 50 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9c1bd17..456ddd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,10 +4,10 @@ output
**/coverage.out
**/coverage.txt
**/*.log
-syncer/syncer
#binary
scserver
+scctl
main
*.iml
@@ -17,21 +17,13 @@ main
**/*.tgz
**/apache-servicecomb-service-center-*
-vendor/**
-!vendor/manifest
+vendor
# for local UT
**/conf/
-data
-syncer-data
!etc/conf/
-!cmd/syncer/conf/chassis.yaml
-!cmd/syncer/conf/microservice.yaml
-frontend/app/bower_components
-etc/data/
etc/ssl/
-frontend/bower_components/
-frontend/node_modules/
+data
tmp/
servicecomb-service-center
service-center
@@ -52,5 +44,6 @@ private.key
rbac.pub
# ux
-ux/node_modules
-ux/dist
\ No newline at end of file
+bower_components
+node_modules
+dist
diff --git a/datasource/etcd/sd/servicecenter/aggregate_test.go b/datasource/etcd/sd/servicecenter/aggregate_test.go
index 20b142e..a6f497b 100644
--- a/datasource/etcd/sd/servicecenter/aggregate_test.go
+++ b/datasource/etcd/sd/servicecenter/aggregate_test.go
@@ -18,8 +18,6 @@ package servicecenter_test
import (
"testing"
- "github.com/little-cui/etcdadpt"
-
_ "github.com/apache/servicecomb-service-center/test"
"github.com/apache/servicecomb-service-center/datasource/etcd/sd/servicecenter"
@@ -27,14 +25,7 @@ import (
)
func TestNewSCClientAggregate(t *testing.T) {
- err := etcdadpt.Init(etcdadpt.Config{
- Kind: "etcd",
- ClusterName: "sc-0",
- ClusterAddresses: "sc-0=http://127.0.0.1:2379",
- })
- assert.NoError(t, err)
-
c := servicecenter.GetOrCreateSCClient()
assert.NotNil(t, c)
- assert.NotEmpty(t, *c)
+ assert.Equal(t, 1, len(*c))
}
diff --git a/eventbase/README.md b/eventbase/README.md
index 93ddf88..f373314 100644
--- a/eventbase/README.md
+++ b/eventbase/README.md
@@ -20,18 +20,20 @@ eventbase provides the crud interface of task and tombstone.
import (
_ "github.com/apache/servicecomb-service-center/eventbase/bootstrap"
"github.com/apache/servicecomb-service-center/eventbase/datasource"
- )
+ tasksvc "github.com/apache/servicecomb-service-center/eventbase/service/task"
+ tombstonesvc "github.com/apache/servicecomb-service-center/eventbase/service/tombstone"
+)
func Init(){
- dbCfg := db.Config{
- Kind: "etcd",
- URI: "http://127.0.0.1:2379",
- Timeout: 10 * time.Second,
- }
- err := datasource.Init(dbCfg)
- ...
- datasource.GetDataSource().TaskDao()
- datasource.GetDataSource().TombstoneDao()
- ...
+ dbCfg := db.Config{
+ Kind: "etcd",
+ URI: "http://127.0.0.1:2379",
+ Timeout: 10 * time.Second,
+ }
+ err := datasource.Init(dbCfg)
+ ...
+ tasksvc.List(...)
+ tombstonesvc.List(...)
+ ...
}
```
\ No newline at end of file
diff --git a/eventbase/go.mod b/eventbase/go.mod
index 1604c3d..4fe13ce 100644
--- a/eventbase/go.mod
+++ b/eventbase/go.mod
@@ -6,7 +6,7 @@ require (
github.com/go-chassis/go-archaius v1.5.1
github.com/go-chassis/go-chassis/v2 v2.3.0
github.com/go-chassis/openlog v1.1.3
- github.com/little-cui/etcdadpt v0.2.1
+ github.com/little-cui/etcdadpt v0.3.2
github.com/stretchr/testify v1.7.0
go.mongodb.org/mongo-driver v1.4.2
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
diff --git a/eventbase/go.sum b/eventbase/go.sum
index baec718..c7f4404 100644
--- a/eventbase/go.sum
+++ b/eventbase/go.sum
@@ -315,6 +315,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/little-cui/etcdadpt v0.2.1 h1:eT1A+BV1/2/dmmZA2Nl+cc7uTMuwd6T6DD+JrXr8xcA=
github.com/little-cui/etcdadpt v0.2.1/go.mod h1:727wftF2FS4vfkgFLmIvQue1XH+9u4lK2/hd6L7OAC8=
+github.com/little-cui/etcdadpt v0.3.2 h1:EBXPBxddZXTgWvGsIdAqqG6JCu1TouPNUhVVj9swt/s=
+github.com/little-cui/etcdadpt v0.3.2/go.mod h1:HnRRpIrVEVNWobkiCvG2EHLWKKZ+L047EcI29ma2zA4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
diff --git a/go.mod b/go.mod
index 7b0ca3f..823b434 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,7 @@ require (
github.com/jinzhu/copier v0.3.0
github.com/karlseguin/ccache v2.0.3-0.20170217060820-3ba9789cfd2c+incompatible
github.com/labstack/echo/v4 v4.1.18-0.20201218141459-936c48a17e97
- github.com/little-cui/etcdadpt v0.3.1
+ github.com/little-cui/etcdadpt v0.3.2
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
@@ -60,7 +60,10 @@ require (
k8s.io/kube-openapi v0.0.0-20210527164424-3c818078ee3d
)
-require github.com/apache/servicecomb-service-center/eventbase v0.0.0-00010101000000-000000000000
+require (
+ github.com/apache/servicecomb-service-center/eventbase v0.0.0-00010101000000-000000000000
+ github.com/spf13/cast v1.3.0
+)
require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
@@ -136,7 +139,6 @@ require (
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
- github.com/spf13/cast v1.3.0 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
diff --git a/go.sum b/go.sum
index 272656a..26b68da 100644
--- a/go.sum
+++ b/go.sum
@@ -440,6 +440,8 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/little-cui/etcdadpt v0.2.1/go.mod h1:727wftF2FS4vfkgFLmIvQue1XH+9u4lK2/hd6L7OAC8=
github.com/little-cui/etcdadpt v0.3.1 h1:lAPIffcOR6jROu/mWf+zHscV8urIu1qbsJvwvziLWDY=
github.com/little-cui/etcdadpt v0.3.1/go.mod h1:HnRRpIrVEVNWobkiCvG2EHLWKKZ+L047EcI29ma2zA4=
+github.com/little-cui/etcdadpt v0.3.2 h1:EBXPBxddZXTgWvGsIdAqqG6JCu1TouPNUhVVj9swt/s=
+github.com/little-cui/etcdadpt v0.3.2/go.mod h1:HnRRpIrVEVNWobkiCvG2EHLWKKZ+L047EcI29ma2zA4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
diff --git a/test/test.go b/test/test.go
index 8b8fd3f..7a6fe44 100644
--- a/test/test.go
+++ b/test/test.go
@@ -47,10 +47,14 @@ func init() {
_ = archaius.Set("registry.cache.mode", 0)
_ = archaius.Set("discovery.kind", "etcd")
_ = archaius.Set("registry.kind", "etcd")
+ _ = archaius.Set("registry.etcd.cluster.name", "sc-0")
+ _ = archaius.Set("registry.etcd.cluster.endpoints", "sc-0="+uri+",sc-1=http://127.0.0.2:2379")
} else {
_ = archaius.Set("registry.heartbeat.kind", "checker")
kind = "mongo"
+ uri = "mongodb://127.0.0.1:27017"
}
+
_ = datasource.Init(datasource.Options{
Config: etcdadpt.Config{
Kind: kind,
@@ -58,23 +62,13 @@ func init() {
})
_ = metrics.Init(metrics.Options{})
- if kind == "mongo" {
- uri = "mongodb://127.0.0.1:27017"
- }
-
- err := edatasource.Init(db.Config{
+ _ = edatasource.Init(db.Config{
Kind: kind,
URI: uri,
Timeout: 10 * time.Second,
})
- if err != nil {
- panic(err)
- }
- err = registry.SelfRegister(context.Background())
- if err != nil {
- panic(err)
- }
+ _ = registry.SelfRegister(context.Background())
}
func IsETCD() bool {