func TestLogfmt_moreField(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	for i := 0; i < MoreFieldTestNum;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Contains(t, r.Fields, "stream=stderr")
	assert.Contains(t,r.Fields,"type=hello")
	assert.Contains(t,r.Fields,"level=debug")
	assert.Contains(t,r.Fields,"time=2018-01-01T10:22:49.71369883Z")
	assert.NotContains(t,r.Fields,"date=08-12-2019")
}
/*
test case: there are more number of logfmt field in log field than specified in map; use record 6 in file
package parser
import (
	"context"
	"github.com/logrange/logrange/pkg/scanner/model"
	"github.com/stretchr/testify/assert"
	"io"
	"testing"
	"time"
)
const(
	EmptyLogTestNum int = 1;
	IllformatTestNum1 int = 2;
	IllformatTestNum2 int = 3;
	LessFieldTestNum int = 4;
	EqualFieldTestNum int = 5;
	MoreFieldTestNum int = 6;
	ReplaceTimeTestNum int = 7;
)
func TestLogfmt_EmptyLog(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	exp, err := time.Parse(time.RFC3339Nano, "2018-02-06T10:22:49.201168034Z")
	assert.NoError(t, err)
	for i := 0; i < EmptyLogTestNum;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Equal(t, exp, r.GetDate())
	assert.Equal(t, "stream=stderr", r.Fields)
	for key := range m{
		assert.NotContains(t,r.Fields,key)
	}
}
func TestLogfmt_illformatLog1(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	exp, err := time.Parse(time.RFC3339Nano, "2018-02-06T10:22:49.201168034Z")
	assert.NoError(t, err)
	for i := 0; i < IllformatTestNum1;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Equal(t, exp, r.GetDate())
	assert.Equal(t, "stream=stderr", r.Fields)
	for key := range m{
		assert.NotContains(t,r.Fields,key)  
	}
}
func TestLogfmt_illformatLog2(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	exp, err := time.Parse(time.RFC3339Nano, "2018-02-06T10:22:49.201168034Z")
	assert.NoError(t, err)
	for i := 0; i < IllformatTestNum2;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Equal(t, exp, r.GetDate())
	assert.Contains(t, r.Fields,"time=2018-01-01T10::49.71369883Z")
}
func TestLogfmt_lessField(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	for i := 0; i < LessFieldTestNum;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Contains(t, r.Fields, "stream=stderr")
	assert.Contains(t,r.Fields,"type=hello")
	assert.Contains(t,r.Fields,"level=debug")
	assert.NotContains(t,r.Fields,"time=2018-01-01T10:22:49.71369883Z")
}
func TestLogfmt_equalField(t *testing.T) {
	var r *model.Record
	var err error
	fn := absPath("../testdata/logs/k8s/var/log/containers/kube-dns-5c47645d88-p7fpl_kube-system_logfmt-74d2de2d0542c5b507e57d5077832b2400273554c3c16d674f1302bc010d5a0f.log")
	var m = map[string]string{
		"time":"time",
		"type": "type",
		"level": "level",
	};
	jp, err := NewLogfmtParser(fn, 4096,m)
	assert.NoError(t, err)
	for i := 0; i < EqualFieldTestNum;i++{
		r, err = jp.NextRecord(context.Background())
	}
	assert.NoError(t, err)
	assert.NotNil(t, r)
	assert.Contains(t, r.Fields, "stream=stderr")
	assert.Contains(t,r.Fields,"type=hello")
	assert.Contains(t,r.Fields,"level=debug")
	assert.Contains(t,r.Fields,"time=2018-01-01T10:22:49.71369883Z")
}