Skip to content

Commit

Permalink
Refactor regex replacements in stages_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Apr 3, 2024
1 parent fddaddb commit c89a666
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions internal/stages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ func TestStages(t *testing.T) {

func normalizeTesterOutput(testerOutput []byte) []byte {
replacements := map[string][]*regexp.Regexp{
"tcp_port": {regexp.MustCompile(`read tcp 127.0.0.1:\d+->127.0.0.1:6379: read: connection reset by peer`)},
" tmp_dir ": {regexp.MustCompile(` /private/var/folders/[^ ]+ `), regexp.MustCompile(` /tmp/[^ ]+ `)},
"\\ntmp_dir\\r": {regexp.MustCompile(`\\n/private/var/folders/[^ ]+\\r`), regexp.MustCompile(`\\n/tmp/[^ ]+\\r`)},
"\"tmp_dir\"": {regexp.MustCompile(`"/private/var/folders/[^"]+"`), regexp.MustCompile(`"/tmp/[^"]+"`)},
"timestamp": {regexp.MustCompile(`\d{2}:\d{2}:\d{2}\.\d{3}`)},
"info_replication": {regexp.MustCompile(`"# Replication\\r\\n[^"]+"`)},
"replication_id": {regexp.MustCompile(`FULLRESYNC [A-Za-z0-9]+ 0`)},
"wait_timeout": {regexp.MustCompile(`WAIT command returned after [0-9]+ ms`)},
"xadd_id": {regexp.MustCompile(`\d{13}-\d+`)},
"rdb_bytes": {regexp.MustCompile(`"\$[0-9]+\\r\\nREDIS.*"`)},
"info_replication_bytes": {regexp.MustCompile(`"\$[0-9]+\\r\\n# Replication\\r\\n[^"]+"`)},
"tcp_port": {regexp.MustCompile(`read tcp 127.0.0.1:\d+->127.0.0.1:6379: read: connection reset by peer`)},
" tmp_dir ": {regexp.MustCompile(` /private/var/folders/[^ ]+ `), regexp.MustCompile(` /tmp/[^ ]+ `)},
"$length\\r\\ntmp_dir\\r": {regexp.MustCompile(`\$\d+\\r\\n/private/var/folders/[^ ]+\\r\\n`), regexp.MustCompile(`\$\d+\\r\\n/tmp/[^ ]+\\r\\n`)},
"\"tmp_dir\"": {regexp.MustCompile(`"/private/var/folders/[^"]+"`), regexp.MustCompile(`"/tmp/[^"]+"`)},
"timestamp": {regexp.MustCompile(`\d{2}:\d{2}:\d{2}\.\d{3}`)},
"info_replication": {regexp.MustCompile(`"# Replication\\r\\n[^"]+"`)},
"replication_id": {regexp.MustCompile(`FULLRESYNC [A-Za-z0-9]+ 0`)},
"wait_timeout": {regexp.MustCompile(`WAIT command returned after [0-9]+ ms`)},
"xadd_id": {regexp.MustCompile(`\d{13}-\d+`)},
"rdb_bytes": {regexp.MustCompile(`"\$[0-9]+\\r\\nREDIS.*"`)},
"info_replication_bytes": {regexp.MustCompile(`"\$[0-9]+\\r\\n# Replication\\r\\n[^"]+"`)},
}

for replacement, regexes := range replacements {
Expand Down

0 comments on commit c89a666

Please sign in to comment.