Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
  • Loading branch information
Nexucis committed May 15, 2024
1 parent 6c04bdf commit 405758d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions internal/api/e2e/api/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,27 @@ func TestListDashboardInEmptyProject(t *testing.T) {
})
}

func TestListDashboardWithOnlyMetadata(t *testing.T) {
e2eframework.WithServer(t, func(expect *httpexpect.Expect, manager dependency.PersistenceManager) []api.Entity {
demoDashboard := e2eframework.NewDashboard(t, "perses", "Demo")
persesProject := e2eframework.NewProject("perses")
e2eframework.CreateAndWaitUntilEntitiesExist(t, manager, persesProject, demoDashboard)

response := expect.GET(fmt.Sprintf("%s/%s/%s/%s?metadata_only=true", utils.APIV1Prefix, utils.PathProject, persesProject.GetMetadata().GetName(), utils.PathDashboard)).
Expect().
Status(http.StatusOK)

response.JSON().Array().Length().IsEqual(1)
response.JSON().Array().Value(0).Object().IsEqual(modelV1.PartialProjectEntity{
Kind: demoDashboard.Kind,
Metadata: demoDashboard.Metadata,
Spec: struct{}{},
})

return []api.Entity{persesProject, demoDashboard}
})
}

func extractDashboardFromHTTPBody(body interface{}, t *testing.T) *modelV1.Dashboard {
b := testUtils.JSONMarshalStrict(body)
dashboard := &modelV1.Dashboard{}
Expand Down

0 comments on commit 405758d

Please sign in to comment.