diff --git a/docker-compose.yaml b/docker-compose.yaml index 8dd3ecc..e7821e2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,7 +2,11 @@ version: "3" services: bigtable-emulator: image: shopify/bigtable-emulator - command: ["-cf", "dev.test.cf1,dev.test.cf2,dev.test.otherFamily"] + command: + [ + "-cf", + "dev.test.cf1,dev.test.cf2,dev.test.otherFamily,dev.dev.cf1,dev.dev.cf2,dev.dev.otherFamily", + ] ports: - "9035:9035" expose: diff --git a/lib/operations/mutate_row.ex b/lib/operations/mutate_row.ex index dcf8b48..8cbc7d5 100644 --- a/lib/operations/mutate_row.ex +++ b/lib/operations/mutate_row.ex @@ -39,15 +39,22 @@ defmodule Bigtable.MutateRow do connection = Connection.get_connection() - {:ok, stream, _} = + result = connection |> Bigtable.Stub.mutate_row(request, metadata) - result = - stream - |> Utils.process_stream() + case result do + {:ok, stream, _} -> + stream + |> Utils.process_stream() + |> List.first() + + {:error, error} when is_map(error) -> + {:error, Map.get(error, :message, "unknown error")} - {:ok, result} + _ -> + {:error, "unknown error"} + end end @spec mutate(V2.MutateRowsRequest.Entry.t()) :: V2.MutateRowResponse.t() diff --git a/lib/operations/mutate_rows.ex b/lib/operations/mutate_rows.ex index fe4e7de..e3d8283 100644 --- a/lib/operations/mutate_rows.ex +++ b/lib/operations/mutate_rows.ex @@ -41,15 +41,22 @@ defmodule Bigtable.MutateRows do metadata = Connection.get_metadata() - {:ok, stream, _} = + result = connection |> Bigtable.Stub.mutate_rows(request, metadata) - result = - stream - |> Utils.process_stream() + case result do + {:ok, stream, _} -> + stream + |> Utils.process_stream() + |> List.first() + + {:error, error} when is_map(error) -> + {:error, Map.get(error, :message, "unknown error")} - {:ok, result} + _ -> + {:error, "unknown error"} + end end @spec mutate([Google.Bigtable.V2.MutateRowsRequest.Entry.t()]) :: {:ok, [any()]} diff --git a/test/row_filter/row_filter_integration_test.exs b/test/row_filter/row_filter_integration_test.exs index e68d8c4..24e2bd3 100644 --- a/test/row_filter/row_filter_integration_test.exs +++ b/test/row_filter/row_filter_integration_test.exs @@ -463,6 +463,8 @@ defmodule RowFilterIntegration do |> Mutations.set_cell("cf2", "column1", "value3", 4000) |> MutateRow.build() |> MutateRow.mutate() + + :ok end defp seed_range(row_key) do @@ -475,6 +477,8 @@ defmodule RowFilterIntegration do |> Mutations.set_cell("cf1", "column5", "value5") |> MutateRow.build() |> MutateRow.mutate() + + :ok end defp seed_values(context) do @@ -484,6 +488,8 @@ defmodule RowFilterIntegration do |> Mutations.set_cell("cf1", "column", "value") |> MutateRow.build() |> MutateRow.mutate() + + :ok end) end