Skip to content

Commit

Permalink
Fix broken test in go 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
albertteoh committed Aug 28, 2020
1 parent 9aada2c commit c3ad4f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/query/app/query_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
package app

import (
"fmt"
"net/http"
"strings"
"testing"
"time"

Expand All @@ -41,8 +43,8 @@ func TestParseTraceQuery(t *testing.T) {
{"x?service=service&start=string", errParseInt, nil},
{"x?service=service&end=string", errParseInt, nil},
{"x?service=service&limit=string", errParseInt, nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&minDuration=20", "cannot not parse minDuration: time: missing unit in duration 20", nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&minDuration=20s&maxDuration=30", "cannot not parse maxDuration: time: missing unit in duration 30", nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&minDuration=20", "cannot not parse minDuration: time: missing unit in duration", nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&minDuration=20s&maxDuration=30", "cannot not parse maxDuration: time: missing unit in duration", nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&tag=k:v&tag=x:y&tag=k&log=k:v&log=k", `malformed 'tag' parameter, expecting key:value, received: k`, nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&minDuration=25s&maxDuration=1s", `'maxDuration' should be greater than 'minDuration'`, nil},
{"x?service=service&start=0&end=0&operation=operation&limit=200&tag=k:v&tag=x:y", noErr,
Expand Down Expand Up @@ -161,7 +163,7 @@ func TestParseTraceQuery(t *testing.T) {
}
}
} else {
assert.EqualError(t, err, test.errMsg)
assert.True(t, strings.HasPrefix(err.Error(), test.errMsg), fmt.Sprintf("Error \"%s\" should start with \"%s\"", err.Error(), test.errMsg))
}
})
}
Expand Down

0 comments on commit c3ad4f8

Please sign in to comment.