(t *testing.T)
| 20 | } |
| 21 | |
| 22 | func TestChart(t *testing.T) { |
| 23 | w := &bytes.Buffer{} |
| 24 | api := New(w) |
| 25 | |
| 26 | opts := ChartOpts{ |
| 27 | TypeID: "system", |
| 28 | ID: "cpu", |
| 29 | Name: "cpu_system", |
| 30 | Title: "CPU Usage", |
| 31 | Units: "percentage", |
| 32 | Family: "cpu", |
| 33 | Context: "system.cpu", |
| 34 | ChartType: "line", |
| 35 | Priority: 1000, |
| 36 | UpdateEvery: 1, |
| 37 | Options: "", |
| 38 | Plugin: "system", |
| 39 | Module: "cpu", |
| 40 | } |
| 41 | |
| 42 | api.CHART(opts) |
| 43 | |
| 44 | expected := "CHART 'system.cpu' 'cpu_system' 'CPU Usage' 'percentage' 'cpu' 'system.cpu' " + |
| 45 | "'line' '1000' '1' '' 'system' 'cpu'\n" |
| 46 | |
| 47 | require.Equal(t, expected, w.String()) |
| 48 | } |
| 49 | |
| 50 | func TestDimension(t *testing.T) { |
| 51 | w := &bytes.Buffer{} |