Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Change build duration type from uint to int64
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuhei Kitagawa committed Apr 26, 2020
1 parent 22e0b37 commit 185bdbc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions active_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestActiveService_FindByOwner(t *testing.T) {
t.Errorf("Active.FindByOwner returned error: %v", err)
}

want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}}
want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}}
if !reflect.DeepEqual(builds, want) {
t.Errorf("Active.FindByOwner returned %+v, want %+v", builds, want)
}
Expand All @@ -56,7 +56,7 @@ func TestActiveService_FindByGitHubId(t *testing.T) {
t.Errorf("Active.FindByGitHubId returned error: %v", err)
}

want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}}
want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}}
if !reflect.DeepEqual(builds, want) {
t.Errorf("Active.FindByGitHubId returned %+v, want %+v", builds, want)
}
Expand Down
2 changes: 1 addition & 1 deletion builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Build struct {
// Current state of the build
State *string `json:"state,omitempty"`
// Wall clock time in seconds
Duration *uint `json:"duration,omitempty"`
Duration *int64 `json:"duration,omitempty"`
// Event that triggered the build
EventType *string `json:"event_type,omitempty"`
// State of the previous build (useful to see if state changed)
Expand Down
12 changes: 6 additions & 6 deletions builds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestBuildsService_Find(t *testing.T) {
t.Errorf("Build.Find returned error: %v", err)
}

want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}
want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}
if !reflect.DeepEqual(build, want) {
t.Errorf("Build.Find returned %+v, want %+v", build, want)
}
Expand All @@ -53,7 +53,7 @@ func TestBuildsService_List(t *testing.T) {
t.Errorf("Builds.Find returned error: %v", err)
}

want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}}
want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}}
if !reflect.DeepEqual(builds, want) {
t.Errorf("Builds.Find returned %+v, want %+v", builds, want)
}
Expand All @@ -75,7 +75,7 @@ func TestBuildsService_ListByRepoId(t *testing.T) {
t.Errorf("Builds.FindByRepoId returned error: %v", err)
}

want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}}
want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}}
if !reflect.DeepEqual(builds, want) {
t.Errorf("Builds.FindByRepoId returned %+v, want %+v", builds, want)
}
Expand All @@ -97,7 +97,7 @@ func TestBuildsService_ListByRepoSlug(t *testing.T) {
t.Errorf("Builds.FindByRepoSlug returned error: %v", err)
}

want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}}
want := []*Build{{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}}
if !reflect.DeepEqual(builds, want) {
t.Errorf("Builds.FindByRepoSlug returned %+v, want %+v", builds, want)
}
Expand All @@ -118,7 +118,7 @@ func TestBuildsService_Cancel(t *testing.T) {
t.Errorf("Build.Cancel returned error: %v", err)
}

want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}
want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}
if !reflect.DeepEqual(build, want) {
t.Errorf("Build.Cancel returned %+v, want %+v", build, want)
}
Expand All @@ -139,7 +139,7 @@ func TestBuildsService_Restart(t *testing.T) {
t.Errorf("Build.Restart returned error: %v", err)
}

want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Uint(10)}
want := &Build{Id: Uint(testBuildId), Number: String("1"), State: String(BuildStateCreated), Duration: Int64(10)}
if !reflect.DeepEqual(build, want) {
t.Errorf("Build.Restart returned %+v, want %+v", build, want)
}
Expand Down
4 changes: 4 additions & 0 deletions travis.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ func Bool(v bool) *bool { return &v }
// to store v and returns a pointer to it.
func Uint(v uint) *uint { return &v }

// Int64 is a helper routine that allocates a new Int64 value
// to store v and returns a pointer to it.
func Int64(v int64) *int64 { return &v }

// String is a helper routine that allocates a new string value
// to store v and returns a pointer to it.
func String(v string) *string { return &v }

0 comments on commit 185bdbc

Please sign in to comment.