Chore: Fix tests for Go 1.15 (#26957)

* Chore: Fix tests for Go 1.15
This commit is contained in:
Arve Knudsen
2020-08-12 17:45:03 +02:00
committed by GitHub
parent a8f57b2ffd
commit 1698c74ec1
4 changed files with 18 additions and 12 deletions
@@ -2,6 +2,7 @@ package sqlstore
import (
"context"
"regexp"
"testing"
"time"
@@ -168,7 +169,8 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
cmd.Frequency = "invalid duration"
err := CreateAlertNotificationCommand(cmd)
So(err.Error(), ShouldEqual, "time: invalid duration invalid duration")
So(regexp.MustCompile(`^time: invalid duration "?invalid duration"?$`).MatchString(
err.Error()), ShouldBeTrue)
})
})
@@ -199,7 +201,8 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
err := UpdateAlertNotification(updateCmd)
So(err, ShouldNotBeNil)
So(err.Error(), ShouldEqual, "time: invalid duration invalid duration")
So(regexp.MustCompile(`^time: invalid duration "?invalid duration"?$`).MatchString(
err.Error()), ShouldBeTrue)
})
})
+6 -5
View File
@@ -3,6 +3,7 @@ package sqlstore
import (
"context"
"math/rand"
"strconv"
"testing"
"time"
@@ -191,14 +192,14 @@ func test(t *testing.T, dashboardProps DashboardProps, dashboardPermission *Dash
}
func createDummyUser() (*models.User, error) {
uid := rand.Intn(9999999)
uid := strconv.Itoa(rand.Intn(9999999))
createUserCmd := &models.CreateUserCommand{
Email: string(uid) + "@example.com",
Login: string(uid),
Name: string(uid),
Email: uid + "@example.com",
Login: uid,
Name: uid,
Company: "",
OrgName: "",
Password: string(uid),
Password: uid,
EmailVerified: true,
IsAdmin: false,
SkipOrgSetup: false,