2018-03-14 14:12:26 +08:00
|
|
|
// Copyright (C) 2014-2018 Goodrain Co., Ltd.
|
2017-11-07 11:40:44 +08:00
|
|
|
// RAINBOND, Application Management Platform
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version. For any non-GPL usage of Rainbond,
|
|
|
|
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
|
|
|
|
// must be obtained first.
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2018-03-14 14:33:31 +08:00
|
|
|
|
2017-11-07 11:40:44 +08:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2017-12-22 16:45:21 +08:00
|
|
|
"strings"
|
2017-11-07 11:40:44 +08:00
|
|
|
"testing"
|
|
|
|
|
2018-04-24 16:44:59 +08:00
|
|
|
"github.com/goodrain/rainbond/node/api/model"
|
2017-11-07 11:40:44 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2018-05-14 19:00:22 +08:00
|
|
|
// err := store.NewClient(&option.Conf{Etcd: clientv3.Config{
|
|
|
|
// Endpoints: []string{"127.0.0.1:2379"},
|
|
|
|
// }})
|
|
|
|
// if err != nil {
|
|
|
|
// logrus.Error(err.Error())
|
|
|
|
// os.Exit(1)
|
|
|
|
// }
|
|
|
|
// option.Config = &option.Conf{
|
|
|
|
// ConfigStoragePath: "/rainbond/configs",
|
|
|
|
// }
|
2017-11-07 11:40:44 +08:00
|
|
|
}
|
|
|
|
func TestGetDataCenterConfig(t *testing.T) {
|
2017-12-24 00:46:24 +08:00
|
|
|
str := "asdadad,"
|
2017-12-22 16:45:21 +08:00
|
|
|
t.Log(strings.Index(str, ","))
|
|
|
|
c := GetDataCenterConfig()
|
|
|
|
c.PutConfig(&model.ConfigUnit{
|
|
|
|
Name: strings.ToUpper("ARRAY"),
|
2017-12-24 18:38:07 +08:00
|
|
|
Value: []string{"121211212", "", "sadasd"},
|
2017-12-22 16:45:21 +08:00
|
|
|
ValueType: "array",
|
|
|
|
IsConfigurable: false,
|
|
|
|
})
|
2017-11-07 11:40:44 +08:00
|
|
|
gc, err := c.GetDataCenterConfig()
|
2017-12-24 18:38:07 +08:00
|
|
|
t.Log(strings.Join(gc.Get("ARRAY").Value.([]string), ","))
|
2017-11-07 11:40:44 +08:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|