Ejemplo n.º 1
0
// Test that the proper values are ignored or collected
func TestHttpJsonMultiValueWithPass(t *testing.T) {

	jolokia := genJolokiaClientStub(validMultiValueJSON, 200, Servers, []Metric{UsedHeapMetric})

	var acc testutil.Accumulator
	err := jolokia.Gather(&acc)

	assert.Nil(t, err)
	assert.Equal(t, 1, len(acc.Points))

	assert.True(t, acc.CheckFieldsValue("heap_memory_usage", map[string]interface{}{"used": 203288528.0}))
}
Ejemplo n.º 2
0
// Test that the proper values are ignored or collected
func TestHttpJsonMultiValue(t *testing.T) {

	jolokia := genJolokiaClientStub(validMultiValueJSON, 200, Servers, []Metric{HeapMetric})

	var acc testutil.Accumulator
	err := jolokia.Gather(&acc)

	assert.Nil(t, err)
	assert.Equal(t, 1, len(acc.Points))

	assert.True(t, acc.CheckFieldsValue("heap_memory_usage", map[string]interface{}{"init": 67108864.0,
		"committed": 456130560.0,
		"max":       477626368.0,
		"used":      203288528.0}))
}
Ejemplo n.º 3
0
func TestTrig(t *testing.T) {
	s := &Trig{
		Amplitude: 10.0,
	}

	for i := 0.0; i < 10.0; i++ {

		var acc testutil.Accumulator

		sine := math.Sin((i*math.Pi)/5.0) * s.Amplitude
		cosine := math.Cos((i*math.Pi)/5.0) * s.Amplitude

		s.Gather(&acc)

		fields := make(map[string]interface{})
		fields["sine"] = sine
		fields["cosine"] = cosine

		assert.True(t, acc.CheckFieldsValue("trig", fields))

	}
}