Skip to content

Commit

Permalink
Merge branch 'master' of github.com:akoutmos/prom_ex
Browse files Browse the repository at this point in the history
  • Loading branch information
akoutmos committed May 28, 2021
2 parents 5d0172f + 0bc2863 commit 37e44c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mix/tasks/prom_ex.dashboard.export.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Mix.Tasks.PromEx.Dashboard.Export do
This is needed to fetch any relevant assigns from the
`c:PromEx.dashboard_assigns/0` callback
-s, --std_out A boolean flag denoting that the rendered dashboard should be output
-s, --stdout A boolean flag denoting that the rendered dashboard should be output
to STDOUT.
-f, --file_path If you would like the write the generated JSON dashboard definition
Expand Down
13 changes: 13 additions & 0 deletions test/mix/tasks/prom_ex.dashboard.export_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ defmodule Mix.Tasks.PromEx.Dashboard.ExportTest do
assert output =~ ~s("datasource": "an_id")
end

test "outputs to STDOUT if the --stdout flag is present", ctx do
output =
capture_io(fn ->
File.cd!(ctx.tmp_dir, fn ->
Config.run(~w(-d an_id -o sample))
Code.compile_file("lib/sample/prom_ex.ex")
Export.run(~w(-m Sample.PromEx -d phoenix.json --stdout))
end)
end)

assert output =~ ~s("datasource": "an_id")
end

test "outputs to STDOUT if the -s flag is present and there is an assign override", ctx do
output =
capture_io(fn ->
Expand Down

0 comments on commit 37e44c4

Please sign in to comment.