예제 #1
0
func init() {
	srv.SetMockServices()
	setMockExpressions()
	storage.New("internal")
	constraints := map[string]float64{
		"C1": 1.0,
		"C2": 2.0,
	}
	for _, service := range srv.List() {
		srv.SetServiceConstraints(service, constraints)
	}
}
예제 #2
0
파일: data_test.go 프로젝트: elleFlorio/gru
func TestMergeInfo(t *testing.T) {
	defer service.ClearMockServices()
	var err error

	service.SetMockServices()
	shared1 := CreateMockShared()
	shared2 := CreateMockShared()
	shared3 := CreateMockShared()

	peers := []Shared{shared1, shared2, shared3}
	merged, err := MergeShared(peers)
	assert.NoError(t, err)
	assert.Equal(t, shared1.Service["service1"].Data.BaseShared[enum.METRIC_CPU_AVG.ToString()],
		merged.Service["service1"].Data.BaseShared[enum.METRIC_CPU_AVG.ToString()])
	assert.Equal(t, shared1.System.ActiveServices, merged.System.ActiveServices)

	empty := []Shared{}
	_, err = MergeShared(empty)
	assert.Error(t, err)

	one := []Shared{shared1}
	_, err = MergeShared(one)
	assert.NoError(t, err)
}
예제 #3
0
파일: eval_test.go 프로젝트: elleFlorio/gru
func init() {
	srv.SetMockServices()
	setMockExpressions()
}