From 61c3110cfe12597c3e1206a6ac34bfd8e00cdc59 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 17 Nov 2016 16:28:08 +0000 Subject: [PATCH] Fix travis-ci duration parsing The example from the docs was very clearly with spaces after hours and minutes: ``` "committed_at": "2011-11-11T11: 11: 11Z", ``` But in fact those spaces do not exist in the wild. Great. --- .../matrix-org/go-neb/services/travisci/travisci.go | 6 +++--- .../matrix-org/go-neb/services/travisci/travisci_test.go | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go index 5f2392d..716bcbd 100644 --- a/src/github.com/matrix-org/go-neb/services/travisci/travisci.go +++ b/src/github.com/matrix-org/go-neb/services/travisci/travisci.go @@ -133,9 +133,9 @@ func notifToTemplate(n webhookNotification) map[string]string { if n.StartedAt != nil && n.FinishedAt != nil { // duration: total duration of all builds in the matrix -- TODO // elapsed_time: time between build start and finish - // Example from docs: "2011-11-11T11: 11: 11Z" - start, err := time.Parse("2006-01-02T15: 04: 05Z", *n.StartedAt) - finish, err2 := time.Parse("2006-01-02T15: 04: 05Z", *n.FinishedAt) + // Example from docs: "2011-11-11T11:11:11Z" + start, err := time.Parse("2006-01-02T15:04:05Z", *n.StartedAt) + finish, err2 := time.Parse("2006-01-02T15:04:05Z", *n.FinishedAt) if err != nil || err2 != nil { log.WithFields(log.Fields{ "started_at": *n.StartedAt, diff --git a/src/github.com/matrix-org/go-neb/services/travisci/travisci_test.go b/src/github.com/matrix-org/go-neb/services/travisci/travisci_test.go index 81d17b7..f2527c3 100644 --- a/src/github.com/matrix-org/go-neb/services/travisci/travisci_test.go +++ b/src/github.com/matrix-org/go-neb/services/travisci/travisci_test.go @@ -84,6 +84,11 @@ var travisTests = []struct { "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}", "Kegsay/flow-jsdoc#18 (master - 3a092c3a6032ebb50384c99b445f947e9ce86e2a : Kegan Dougal): Passed", }, + { + exampleSignature, true, exampleBody, + "%{repository}#%{build_number} %{duration}", + "Kegsay/flow-jsdoc#18 32s", + }, } type MockTransport struct {