refactor: Update regular expression pattern for ARR body parsing

The code changes in `config.go` update the regular expression pattern for parsing ARR bodies. The previous pattern did not account for the optional time component in the body. The updated pattern now correctly captures the category, number, SSR, departure, arrival, and time components of the ARR body. This refactor ensures accurate parsing of ARR bodies and improves the overall functionality of the aviation parser.
This commit is contained in:
windyboy
2024-07-22 00:01:27 +08:00
parent 24c9beeb13
commit 497a33a99a
4 changed files with 586 additions and 17 deletions
+513
View File
@@ -0,0 +1,513 @@
[
{
"SuitePath": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers",
"SuiteDescription": "Parsers Suite",
"SuiteLabels": [],
"SuiteSucceeded": true,
"SuiteHasProgrammaticFocus": false,
"SpecialSuiteFailureReasons": null,
"PreRunStats": {
"TotalSpecs": 11,
"SpecsThatWillRun": 2
},
"StartTime": "2024-07-21T23:58:50.688933981+08:00",
"EndTime": "2024-07-21T23:58:50.689839193+08:00",
"RunTime": 905233,
"SuiteConfig": {
"RandomSeed": 1721577530,
"RandomizeAllSpecs": false,
"FocusStrings": [
"Aviation Parser ParseBody with ARR body"
],
"SkipStrings": null,
"FocusFiles": null,
"SkipFiles": null,
"LabelFilter": "",
"FailOnPending": false,
"FailOnEmpty": false,
"FailFast": false,
"FlakeAttempts": 0,
"MustPassRepeatedly": 0,
"DryRun": false,
"PollProgressAfter": 0,
"PollProgressInterval": 0,
"Timeout": 3599580726719,
"EmitSpecProgress": false,
"OutputInterceptorMode": "",
"SourceRoots": null,
"GracePeriod": 30000000000,
"ParallelProcess": 1,
"ParallelTotal": 1,
"ParallelHost": ""
},
"SpecReports": [
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseHeader"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 11
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 12
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the header correctly",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.689002996+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseHeader"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 11
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 42
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the header correctly with originator information",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.689020459+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"with NOTAM message"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 88
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 89
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the header correctly",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.68902758+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseBody",
"with ARR body (ARR-CES5470-ZBTJ-ZSHC1614)"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 126
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 128
}
],
"ContainerHierarchyLabels": [
[],
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 131
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the body correctly",
"State": "passed",
"StartTime": "2024-07-21T23:58:50.689043688+08:00",
"EndTime": "2024-07-21T23:58:50.689347442+08:00",
"RunTime": 303788,
"ParallelProcess": 1,
"NumAttempts": 1,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0,
"SpecEvents": [
{
"SpecEventType": "Node",
"CodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 131
},
"TimelineLocation": {
"Order": 1,
"Time": "2024-07-21T23:58:50.689047942+08:00"
},
"Message": "should parse the body correctly",
"NodeType": "It"
},
{
"SpecEventType": "Node (End)",
"CodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 131
},
"TimelineLocation": {
"Order": 3,
"Time": "2024-07-21T23:58:50.689341334+08:00"
},
"Message": "should parse the body correctly",
"Duration": 293422,
"NodeType": "It"
}
]
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseBody",
"with ARR body"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 126
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 146
}
],
"ContainerHierarchyLabels": [
[],
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 148
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the body (ARR-AB123-SSR1234-KJFK-KLAX1234) correctly",
"State": "passed",
"StartTime": "2024-07-21T23:58:50.689389033+08:00",
"EndTime": "2024-07-21T23:58:50.689700432+08:00",
"RunTime": 311406,
"ParallelProcess": 1,
"NumAttempts": 1,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0,
"SpecEvents": [
{
"SpecEventType": "Node",
"CodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 148
},
"TimelineLocation": {
"Order": 4,
"Time": "2024-07-21T23:58:50.689391975+08:00"
},
"Message": "should parse the body (ARR-AB123-SSR1234-KJFK-KLAX1234) correctly",
"NodeType": "It"
},
{
"SpecEventType": "Node (End)",
"CodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 148
},
"TimelineLocation": {
"Order": 6,
"Time": "2024-07-21T23:58:50.689696036+08:00"
},
"Message": "should parse the body (ARR-AB123-SSR1234-KJFK-KLAX1234) correctly",
"Duration": 304076,
"NodeType": "It"
}
]
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseBody",
"with DEP body"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 126
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 164
}
],
"ContainerHierarchyLabels": [
[],
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 166
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the body (DEP-AB123-SSR1234-KJFK-1500-KLAX) correctly",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.68974927+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Aviation Parser",
"ParseBody",
"with FPL body"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 10
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 126
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 182
}
],
"ContainerHierarchyLabels": [
[],
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/aviation_parser_test.go",
"LineNumber": 184
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the body correctly",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.689775128+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Pattern Parser",
"FindPatterns"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 8
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 10
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 11
},
"LeafNodeLabels": [],
"LeafNodeText": "should return the correct BodyConfig based on the message body",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.68978383+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Pattern Parser",
"FindPatterns"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 8
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 10
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 18
},
"LeafNodeLabels": [],
"LeafNodeText": "should return nil if no pattern matches",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.68978885+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Pattern Parser",
"ParseBody"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 8
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 25
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 26
},
"LeafNodeLabels": [],
"LeafNodeText": "should parse the message body and extract data based on patterns",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.689798097+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
},
{
"ContainerHierarchyTexts": [
"Pattern Parser",
"ParseBody"
],
"ContainerHierarchyLocations": [
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 8
},
{
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 25
}
],
"ContainerHierarchyLabels": [
[],
[]
],
"LeafNodeType": "It",
"LeafNodeLocation": {
"FileName": "/home/windy/project/airport/projects/new-telegram/caatsm/internal/parsers/pattern_test.go",
"LineNumber": 37
},
"LeafNodeLabels": [],
"LeafNodeText": "should return nil if no patterns match",
"State": "skipped",
"StartTime": "2024-07-21T23:58:50.689830232+08:00",
"EndTime": "0001-01-01T00:00:00Z",
"RunTime": 0,
"ParallelProcess": 1,
"NumAttempts": 0,
"MaxFlakeAttempts": 0,
"MaxMustPassRepeatedly": 0
}
]
}
]