Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Nov 22, 2024
1 parent ee876b8 commit aa69de7
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions api/applications/applications_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,12 @@ func TestSearchApplicationsPost_WithJobs_ShouldOnlyHaveLatest(t *testing.T) {
commonTestUtils, controllerTestUtils, kubeclient, _, _, _, _, _ := setupTest(t, true, true)
apps := []applicationModels.Application{
{Name: "app-1", Jobs: []*jobModels.JobSummary{
{Name: "app-1-job-1", Started: createTimePtr("2018-11-12T11:45:26Z")},
{Name: "app-1-job-1", Started: createTime("2018-11-12T11:45:26Z")},
}},
{Name: "app-2", Jobs: []*jobModels.JobSummary{
{Name: "app-2-job-1", Started: createTimePtr("2018-11-12T12:30:14Z")},
{Name: "app-2-job-2", Started: createTimePtr("2018-11-20T09:00:00Z")},
{Name: "app-2-job-3", Started: createTimePtr("2018-11-20T09:00:01Z")},
{Name: "app-2-job-1", Started: createTime("2018-11-12T12:30:14Z")},
{Name: "app-2-job-2", Started: createTime("2018-11-20T09:00:00Z")},
{Name: "app-2-job-3", Started: createTime("2018-11-20T09:00:01Z")},
}},
{Name: "app-3"},
}
Expand Down Expand Up @@ -535,12 +535,12 @@ func TestSearchApplicationsGet_WithJobs_ShouldOnlyHaveLatest(t *testing.T) {
commonTestUtils, controllerTestUtils, kubeclient, _, _, _, _, _ := setupTest(t, true, true)
apps := []applicationModels.Application{
{Name: "app-1", Jobs: []*jobModels.JobSummary{
{Name: "app-1-job-1", Started: createTimePtr("2018-11-12T11:45:26Z")},
{Name: "app-1-job-1", Started: createTime("2018-11-12T11:45:26Z")},
}},
{Name: "app-2", Jobs: []*jobModels.JobSummary{
{Name: "app-2-job-1", Started: createTimePtr("2018-11-12T12:30:14Z")},
{Name: "app-2-job-2", Started: createTimePtr("2018-11-20T09:00:00Z")},
{Name: "app-2-job-3", Started: createTimePtr("2018-11-20T09:00:01Z")},
{Name: "app-2-job-1", Started: createTime("2018-11-12T12:30:14Z")},
{Name: "app-2-job-2", Started: createTime("2018-11-20T09:00:00Z")},
{Name: "app-2-job-3", Started: createTime("2018-11-20T09:00:01Z")},
}},
{Name: "app-3"},
}
Expand Down Expand Up @@ -2137,16 +2137,7 @@ func (f *testApplicationHandlerFactory) Create(accounts models.Accounts) Applica
return NewApplicationHandler(accounts, f.config, f.hasAccessToGetConfigMap)
}

func createTime(timestamp string) time.Time {
if timestamp == "" {
return time.Time{}
}

t, _ := time.Parse(time.RFC3339, timestamp)
return t
}

func createTimePtr(timestamp string) *time.Time {
func createTime(timestamp string) *time.Time {
if timestamp == "" {
return &time.Time{}
}
Expand Down

0 comments on commit aa69de7

Please sign in to comment.