-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea9abb2
commit 3e76b78
Showing
2 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/dpul_collections/indexing_pipeline/dashboard_page_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
defmodule DpuLCollections.IndexingPipeline.DashboardPageTest do | ||
alias DpulCollections.IndexingPipeline.Figgy.IndexingProducerSource | ||
alias DpulCollections.IndexingPipeline.Figgy.TransformationProducerSource | ||
alias DpulCollections.IndexingPipeline.Figgy.HydrationProducerSource | ||
alias DpulCollections.IndexingPipeline.Metrics | ||
use DpulCollectionsWeb.ConnCase | ||
import Phoenix.LiveViewTest | ||
@endpoint DpulCollectionsWeb.Endpoint | ||
|
||
test "GET /dev/dashboard/index_metrics", %{conn: conn} do | ||
Metrics.create_index_metric(%{ | ||
type: HydrationProducerSource.processor_marker_key(), | ||
measurement_type: "full_index", | ||
duration: 0, | ||
records_acked: 20 | ||
}) | ||
|
||
Metrics.create_index_metric(%{ | ||
type: TransformationProducerSource.processor_marker_key(), | ||
measurement_type: "full_index", | ||
duration: 10, | ||
records_acked: 20 | ||
}) | ||
|
||
Metrics.create_index_metric(%{ | ||
type: IndexingProducerSource.processor_marker_key(), | ||
measurement_type: "full_index", | ||
duration: 200, | ||
records_acked: 60 | ||
}) | ||
|
||
{:ok, view, html} = | ||
conn | ||
|> put_req_header("authorization", "Basic " <> Base.encode64("admin:test")) | ||
|> get(~p"/dev/dashboard/index_metrics") | ||
|> live | ||
|
||
assert html =~ "Hydration Metric Times" | ||
assert html =~ "Transformation Metric Times" | ||
assert html =~ "Indexing Metric Times" | ||
assert has_element?(view, "td.hydration-table-per_second", "20") | ||
assert has_element?(view, "td.hydration-table-duration", "00:00:00") | ||
assert has_element?(view, "td.transformation-table-per_second", "2") | ||
assert has_element?(view, "td.transformation-table-duration", "00:00:10") | ||
assert has_element?(view, "td.indexing-table-per_second", "0.3") | ||
assert has_element?(view, "td.indexing-table-duration", "00:03:20") | ||
end | ||
end |