diff --git a/internal/service/admin.go b/internal/service/admin.go index 6aa09c68..6c2310ca 100644 --- a/internal/service/admin.go +++ b/internal/service/admin.go @@ -188,7 +188,7 @@ func (s *Admin) GetRejectRulesReportContext(ctx context.Context, req types.Rejec for i, dropReport := range dropReports { var createdAt int64 if dropReport.CreatedAt != nil { - createdAt = dropReport.CreatedAt.Unix() + createdAt = dropReport.CreatedAt.UnixMicro() } originalReport := dropReport.DropReport diff --git a/test/reject_rule_test.go b/test/reject_rule_test.go new file mode 100644 index 00000000..2b78ca96 --- /dev/null +++ b/test/reject_rule_test.go @@ -0,0 +1,18 @@ +package test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "golang.org/x/mod/semver" +) + +func TestRejectRuleSemVer(t *testing.T) { + assert.True(t, semver.IsValid("v4.13.0-beta.4.3.gfe735461")) + assert.True(t, semver.Compare("v4.13.0-beta.4", "v4.13.0-rc.1") < 0, "v4.13.0-beta.4 < v4.13.0-rc.1") + assert.True(t, semver.Compare("v4.13.0-beta.4.3", "v4.13.0-rc.1") < 0, "v4.13.0-beta.4.3 < v4.13.0-rc.1") + assert.True(t, semver.Compare("v4.13.0-beta.4.3.gfe735461", "v4.13.0-rc.1") < 0, "v4.13.0-beta.4.3.gfe735461 < v4.13.0-rc.1") + assert.True(t, semver.Compare("v4.13.0-rc.1", "v4.13.0-rc.1") == 0, "v4.13.0-rc.1 == v4.13.0-rc.1") + assert.True(t, semver.Compare("v4.13.0-rc.1", "v4.13.0-rc.2") < 0, "v4.13.0-rc.1 < v4.13.0-rc.2") + assert.True(t, semver.Compare("v4.13.0-rc.1", "v4.13.0") < 0, "v4.13.0-rc.1 < v4.13.0") +}