Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zwj committed Nov 17, 2024
1 parent 1586ba4 commit d561dae
Show file tree
Hide file tree
Showing 71 changed files with 149 additions and 148 deletions.
25 changes: 8 additions & 17 deletions pipeline/manager/msgstatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestStatus(t *testing.T) {
FieldStatus: k,
},
}
pt := ptinput.NewPlPoint(point.Logging, "", nil, outp.Fields, time.Now())
pt := ptinput.NewPlPt(point.Logging, "", nil, outp.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, v, pt.Fields()[FieldStatus])
}
Expand All @@ -70,7 +70,7 @@ func TestStatus(t *testing.T) {
FieldMessage: "1234567891011",
},
}
pt := ptinput.NewPlPoint(point.Logging, "", nil, outp.Fields, time.Now())
pt := ptinput.NewPlPt(point.Logging, "", nil, outp.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, "x", pt.Fields()[FieldStatus])
assert.Equal(t, "1234567891011", pt.Fields()[FieldMessage])
Expand All @@ -86,7 +86,7 @@ func TestStatus(t *testing.T) {
"xxxqqqddd": "1234567891011",
},
}
pt := ptinput.NewPlPoint(point.Logging, "", outp.Tags, outp.Fields, time.Now())
pt := ptinput.NewPlPt(point.Logging, "", outp.Tags, outp.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, map[string]interface{}{
FieldStatus: "x",
Expand All @@ -107,7 +107,7 @@ func TestStatus(t *testing.T) {
"xxxqqqddd": "1234567891011",
},
}
pt := ptinput.NewPlPoint(point.Logging, "", outp.Tags, outp.Fields, time.Now())
pt := ptinput.NewPlPt(point.Logging, "", outp.Tags, outp.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, map[string]interface{}{
FieldStatus: "notice",
Expand All @@ -127,7 +127,7 @@ func TestGetSetStatus(t *testing.T) {
Fields: make(map[string]interface{}),
}

pt := ptinput.NewPlPoint(point.Logging, "", out.Tags, out.Fields, time.Now())
pt := ptinput.NewPlPt(point.Logging, "", out.Tags, out.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, map[string]string{
"status": "notice",
Expand All @@ -138,36 +138,27 @@ func TestGetSetStatus(t *testing.T) {
"status": "n",
}
out.Tags = make(map[string]string)
pt = ptinput.NewPlPoint(point.Logging, "", out.Tags, out.Fields, time.Now())
pt = ptinput.NewPlPt(point.Logging, "", out.Tags, out.Fields, time.Now())

ProcLoggingStatus(pt, false, nil)
assert.Equal(t, map[string]interface{}{
"status": "notice",
}, pt.Fields())
assert.Equal(t, make(map[string]string), pt.Tags())

out.Fields = map[string]interface{}{
"status": "n",
}
out.Tags = map[string]string{
"status": "n",
}

pt = ptinput.NewPlPoint(point.Logging, "", out.Tags, out.Fields, time.Now())
pt = ptinput.NewPlPt(point.Logging, "", out.Tags, out.Fields, time.Now())
ProcLoggingStatus(pt, false, nil)
assert.Equal(t, map[string]string{
"status": "notice",
}, pt.Tags())
assert.Equal(t, map[string]interface{}{
"status": "n",
}, pt.Fields())

pt = ptinput.NewPlPoint(point.Logging, "", out.Tags, out.Fields, time.Now())
pt = ptinput.NewPlPt(point.Logging, "", out.Tags, out.Fields, time.Now())
ProcLoggingStatus(pt, false, []string{"notice"})
assert.Equal(t, map[string]string{
"status": "notice",
}, pt.Tags())
assert.Equal(t, map[string]interface{}{
"status": "n",
}, pt.Fields())
}
8 changes: 4 additions & 4 deletions pipeline/manager/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestScript(t *testing.T) {
if ng := s.Engine(); ng == nil {
t.Fatalf("no engine")
}
plpt := ptinput.NewPlPoint(point.Logging, "ng", nil, nil, time.Now())
plpt := ptinput.NewPlPt(point.Logging, "ng", nil, nil, time.Now())
err := s.Run(plpt, nil, nil)
if err != nil {
t.Fatal(err)
Expand All @@ -40,7 +40,7 @@ func TestScript(t *testing.T) {
assert.Equal(t, s.NS(), NSGitRepo)

//nolint:dogsled
plpt = ptinput.NewPlPoint(point.Logging, "ng", nil, nil, time.Now())
plpt = ptinput.NewPlPt(point.Logging, "ng", nil, nil, time.Now())
err = s.Run(plpt, nil, &Option{DisableAddStatusField: true})
if err != nil {
t.Fatal(err)
Expand All @@ -51,7 +51,7 @@ func TestScript(t *testing.T) {
}

//nolint:dogsled
plpt = ptinput.NewPlPoint(point.Logging, "ng", nil, nil, time.Now())
plpt = ptinput.NewPlPt(point.Logging, "ng", nil, nil, time.Now())
err = s.Run(plpt, nil, &Option{
DisableAddStatusField: false,
IgnoreStatus: []string{DefaultStatus},
Expand All @@ -73,7 +73,7 @@ func TestDrop(t *testing.T) {

s := ret["abc.p"]

plpt := ptinput.NewPlPoint(point.Logging, "ng", nil, nil, time.Now())
plpt := ptinput.NewPlPt(point.Logging, "ng", nil, nil, time.Now())
if err := s.Run(plpt, nil, nil); err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_addkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ add_key(add_new_key, "shanghai")
}
return
}
pt := ptinput.NewPlPoint(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
pt := ptinput.NewPlPt(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())

errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_addpattern_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestAddPattern(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
pt := ptinput.NewPlPt(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)
if errR != nil {
t.Fatal(errR)
Expand Down
4 changes: 2 additions & 2 deletions pipeline/ptinput/funcs/fn_adjust_timezone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestAdjustTimezone(t *testing.T) {
return
}
{
plpt := ptinput.NewPlPoint(
plpt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, plpt)
if errR != nil {
Expand All @@ -86,7 +86,7 @@ func TestAdjustTimezone(t *testing.T) {
}

{
plpt := ptinput.NewPlPoint(point.Logging,
plpt := ptinput.NewPlPt(point.Logging,
"test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, plpt)
if errR != nil {
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_agg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAgg(t *testing.T) {

buks := plmap.NewAggBuks(fn, nil)
for _, tcIn := range tc.in {
pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tcIn}, time.Now())
pt.SetAggBuckets(buks)
errR := runScript(runner, pt)
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_append_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestAppend(t *testing.T) {
}
return
}
pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)
if errR != nil {
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_b64dec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestB64dec(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_b64enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestB64enc(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)
if errR != nil {
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestCache(t *testing.T) {
return
}
cache, _ := plcache.NewCache(time.Second, 100)
pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
pt.SetCache(cache)
errR := runScript(runner, pt)
Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestCast(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_cidr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestCIDR(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_conv_traceid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestConvW3CTraceID(t *testing.T) {
}
return
}
pt := ptinput.NewPlPoint(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
pt := ptinput.NewPlPt(point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())

errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_cover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestDz(t *testing.T) {
return
}

pt := ptinput.NewPlPoint(
pt := ptinput.NewPlPt(
point.Logging, "test", nil, map[string]any{"message": tc.in}, time.Now())
errR := runScript(runner, pt)

Expand Down
2 changes: 1 addition & 1 deletion pipeline/ptinput/funcs/fn_create_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func CreatePoint(ctx *runtime.Task, funcExpr *ast.CallExpr) *errchain.PlError {
}
}

plpt := ptinput.NewPlPoint(ptCat, ptName, ptTags, ptFields, ptTime)
plpt := ptinput.NewPlPt(ptCat, ptName, ptTags, ptFields, ptTime)
if arg := funcExpr.Param[5]; arg != nil {
if refCall, ok := funcExpr.PrivateData.(*ast.CallExpr); ok {
if srcipt, ok := refCall.PrivateData.(*runtime.Script); ok {
Expand Down
Loading

0 comments on commit d561dae

Please sign in to comment.