Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: watcher's /status.get cabbage test #1508

Merged
merged 7 commits into from
May 15, 2020

Conversation

unnawut
Copy link
Contributor

@unnawut unnawut commented May 13, 2020

Overview

Script kiddie trying to move the simplest integration test (/status.get) into cabbage.

Changes

  • Remove OMG.Watcher.Integration.StatusTest
  • Add WatcherStatus cabbage test

Testing

cd priv/cabbage && mix test test/itest/watcher_status_test.exs

@unnawut unnawut self-assigned this May 13, 2020
@coveralls
Copy link

coveralls commented May 13, 2020

Coverage Status

Coverage remained the same at 78.167% when pulling 65c528e on unnawut/cabbage-watcher-status-get into d118f21 on master.

Copy link
Contributor

@achiurizo achiurizo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 moar cabbages

Comment on lines +33 to +76
defthen ~r/^Operator can read byzantine_events$/, %{}, state do
assert is_list(state.service_response["data"]["byzantine_events"])
{:ok, state}
end

defthen ~r/^Operator can read eth_syncing$/, %{}, state do
assert is_boolean(state.service_response["data"]["eth_syncing"])
{:ok, state}
end

defthen ~r/^Operator can read in_flight_exits$/, %{}, state do
assert is_list(state.service_response["data"]["in_flight_exits"])
{:ok, state}
end

defthen ~r/^Operator can read last_mined_child_block_number$/, %{}, state do
assert is_integer(state.service_response["data"]["last_mined_child_block_number"])
{:ok, state}
end

defthen ~r/^Operator can read last_mined_child_block_timestamp$/, %{}, state do
assert is_integer(state.service_response["data"]["last_mined_child_block_timestamp"])
{:ok, state}
end

defthen ~r/^Operator can read last_seen_eth_block_number$/, %{}, state do
assert is_integer(state.service_response["data"]["last_seen_eth_block_number"])
{:ok, state}
end

defthen ~r/^Operator can read last_seen_eth_block_timestamp$/, %{}, state do
assert is_integer(state.service_response["data"]["last_seen_eth_block_timestamp"])
{:ok, state}
end

defthen ~r/^Operator can read last_validated_child_block_number$/, %{}, state do
assert is_integer(state.service_response["data"]["last_validated_child_block_number"])
{:ok, state}
end

defthen ~r/^Operator can read last_validated_child_block_timestamp$/, %{}, state do
assert is_integer(state.service_response["data"]["last_validated_child_block_timestamp"])
{:ok, state}
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like we could probably DRY this up a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm do you have an example? These are specific to this test file so I didn't DRY them up so to keep them straight forward

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I see the word DRY in elixir-omg repo being brought up I get triggered. :))))

@unnawut unnawut merged commit ff4977f into master May 15, 2020
@unnawut unnawut deleted the unnawut/cabbage-watcher-status-get branch May 15, 2020 05:58
@unnawut unnawut added the chore Technical work that does not affect service behaviour label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Technical work that does not affect service behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants