tianxiaoliang commented on a change in pull request #695: URL: https://github.com/apache/servicecomb-service-center/pull/695#discussion_r493274144
########## File path: server/storage/options.go ########## @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +//Options contains configuration for plugins +type Options struct { + Endpoint string Review comment: Endpoint is not enough, plz add more options in net PR, like TLSconfig, ########## File path: server/storage/manager_test.go ########## @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + pb "github.com/apache/servicecomb-service-center/pkg/registry" + "github.com/apache/servicecomb-service-center/pkg/util" + scerr "github.com/apache/servicecomb-service-center/server/scerror" + "github.com/apache/servicecomb-service-center/server/storage/etcd" + "github.com/go-chassis/go-archaius" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestInit(t *testing.T) { + _ = archaius.Init(archaius.WithMemorySource()) + _ = archaius.Set("servicecomb.plugin.storage", "servicecomb.plugin.storage.etcd") Review comment: servicecomb.plugin.storage.etcd is too complicated for a pulgin name, use servicecomb.storage.name as config key, etcd as config value ########## File path: server/service/microservice_test.go ########## @@ -49,6 +52,23 @@ var _ = Describe("'Micro-service' service", func() { Expect(err).To(BeNil()) Expect(resp.Response.GetCode()).To(Equal(scerr.ErrInvalidParams)) }) + + It("should not be passed", func() { + storage.Install("servicecomb.plugin.storage.etcd", + func(opts storage.Options) (storage.Shimmer, error) { + return etcd.NewStorageShim(), nil + }) + + // sc main function initialize step + err := storage.Init(storage.Options{ + Endpoint: "", + PluginImplName: storage.ImplName(archaius.GetString("servicecomb.plugin.storage", Review comment: naming convention should be more simple "servicecomb.storage" ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
