@@ -226,6 +226,110 @@ func TestGather(t *testing.T) {
226226 for _ , test := range testsWithoutServer {
227227 acc .AssertContainsTaggedFields (t , "ipmi_sensor" , test .fields , test .tags )
228228 }
229+
230+ i = & Ipmi {
231+ Servers : []string {"USERID:PASSW0,RD@lan(192.168.1.1) " },
232+ Path : "ipmitool" ,
233+ Privilege : "USER" ,
234+ Timeout : config .Duration (time .Second * 5 ),
235+ HexKey : "1234567F" ,
236+ Log : testutil.Logger {},
237+ }
238+
239+ require .NoError (t , i .Init ())
240+ require .NoError (t , acc .GatherError (i .Gather ))
241+
242+ conn = NewConnection (i .Servers [0 ], i .Privilege , i .HexKey )
243+ require .EqualValues (t , "USERID" , conn .Username )
244+ require .EqualValues (t , "lan" , conn .Interface )
245+ require .EqualValues (t , "1234567F" , conn .HexKey )
246+
247+ var testsWithoutCutsomTagServer = []struct {
248+ fields map [string ]interface {}
249+ tags map [string ]string
250+ }{
251+ {
252+ map [string ]interface {}{
253+ "value" : float64 (20 ),
254+ "status" : 1 ,
255+ },
256+ map [string ]string {
257+ "name" : "ambient_temp" ,
258+ "server" : "192.168.1.1" ,
259+ "unit" : "degrees_c" ,
260+ },
261+ },
262+ {
263+ map [string ]interface {}{
264+ "value" : float64 (80 ),
265+ "status" : 1 ,
266+ },
267+ map [string ]string {
268+ "name" : "altitude" ,
269+ "server" : "192.168.1.1" ,
270+ "unit" : "feet" ,
271+ },
272+ },
273+ {
274+ map [string ]interface {}{
275+ "value" : float64 (210 ),
276+ "status" : 1 ,
277+ },
278+ map [string ]string {
279+ "name" : "avg_power" ,
280+ "server" : "192.168.1.1" ,
281+ "unit" : "watts" ,
282+ },
283+ },
284+ {
285+ map [string ]interface {}{
286+ "value" : float64 (4.9 ),
287+ "status" : 1 ,
288+ },
289+ map [string ]string {
290+ "name" : "planar_5v" ,
291+ "server" : "192.168.1.1" ,
292+ "unit" : "volts" ,
293+ },
294+ },
295+ {
296+ map [string ]interface {}{
297+ "value" : float64 (3.05 ),
298+ "status" : 1 ,
299+ },
300+ map [string ]string {
301+ "name" : "planar_vbat" ,
302+ "server" : "192.168.1.1" ,
303+ "unit" : "volts" ,
304+ },
305+ },
306+ {
307+ map [string ]interface {}{
308+ "value" : float64 (2610 ),
309+ "status" : 1 ,
310+ },
311+ map [string ]string {
312+ "name" : "fan_1a_tach" ,
313+ "server" : "192.168.1.1" ,
314+ "unit" : "rpm" ,
315+ },
316+ },
317+ {
318+ map [string ]interface {}{
319+ "value" : float64 (1775 ),
320+ "status" : 1 ,
321+ },
322+ map [string ]string {
323+ "name" : "fan_1b_tach" ,
324+ "server" : "192.168.1.1" ,
325+ "unit" : "rpm" ,
326+ },
327+ },
328+ }
329+
330+ for _ , test := range testsWithoutCutsomTagServer {
331+ acc .AssertContainsTaggedFields (t , "ipmi_sensor" , test .fields , test .tags )
332+ }
229333}
230334
231335// fackeExecCommand is a helper function that mock
0 commit comments