beating the no win scenario
play

Beating the No Win Scenario Joe DeVivo @joedevivo Tuesday, 26 - PowerPoint PPT Presentation

Beating the No Win Scenario Joe DeVivo @joedevivo Tuesday, 26 March 2013 Beating the No Win Scenario Joe DeVivo @joedevivo Maybe youve heard of me Tuesday, 26 March 2013 Things to know about Joe Tuesday, 26 March 2013 Things to know


  1. OldGroupLeader = group_leader(), OldGroupLeader = group_leader(), NewGroupLeader = NewGroupLeader = riak_test_group_leader:new_group_leader(self()), riak_test_group_leader:new_group_leader(self()), group_leader(NewGroupLeader, self()), group_leader(NewGroupLeader, self()), Pid = spawn_link(TestModule, confirm, []), Pid = spawn_link(TestModule, confirm, []), {Status, Reason} = {Status, Reason} = � rec_loop(Pid, TestModule, TestMetaData), � rec_loop(Pid, TestModule, TestMetaData), group_leader(OldGroupLeader, self()), group_leader(OldGroupLeader, self()), Tuesday, 26 March 2013

  2. OldGroupLeader = group_leader(), OldGroupLeader = group_leader(), NewGroupLeader = NewGroupLeader = riak_test_group_leader:new_group_leader(self()), riak_test_group_leader:new_group_leader(self()), group_leader(NewGroupLeader, self()), group_leader(NewGroupLeader, self()), Pid = spawn_link(TestModule, confirm, []), Pid = spawn_link(TestModule, confirm, []), {Status, Reason} = {Status, Reason} = � rec_loop(Pid, TestModule, TestMetaData), � rec_loop(Pid, TestModule, TestMetaData), group_leader(OldGroupLeader, self()), group_leader(OldGroupLeader, self()), Tuesday, 26 March 2013

  3. io:format group_leader custom group_leader Tuesday, 26 March 2013

  4. group_leader(NewGroupLeader, self()), io:format group_leader custom group_leader Tuesday, 26 March 2013

  5. group_leader(NewGroupLeader, self()), io:format group_leader custom group_leader Tuesday, 26 March 2013

  6. io:format group_leader custom group_leader Tuesday, 26 March 2013

  7. io:format group_leader custom group_leader group_leader(OldGroupLeader, self()), Tuesday, 26 March 2013

  8. io:format group_leader custom group_leader group_leader(OldGroupLeader, self()), Tuesday, 26 March 2013

  9. console interaction Tuesday, 26 March 2013

  10. Who is port_command and what does he do? Tuesday, 26 March 2013

  11. Port = open_port({spawn, Cmd}, � [stream, use_stdio, exit_status, binary, stderr_to_stdout]), port_command(Port, Msg), receive {Port, {data, Data}} -> � � � � %% do something end Tuesday, 26 March 2013

  12. Port = open_port({spawn, Cmd}, � [stream, use_stdio, exit_status, binary, stderr_to_stdout]), port_command(Port, Msg), receive {Port, {data, Data}} -> � � � � %% do something end Tuesday, 26 March 2013

  13. Port = open_port({spawn, Cmd}, � [stream, use_stdio, exit_status, binary, stderr_to_stdout]), port_command(Port, Msg), receive {Port, {data, Data}} -> � � � � %% do something end Tuesday, 26 March 2013

  14. Port = open_port({spawn, Cmd}, � [stream, use_stdio, exit_status, binary, stderr_to_stdout]), port_command(Port, Msg), receive {Port, {data, Data}} -> � � � � %% do something end Tuesday, 26 March 2013

  15. Port = open_port({spawn, Cmd}, � [stream, use_stdio, exit_status, binary, stderr_to_stdout]), port_command(Port, Msg), receive {Port, {data, Data}} -> � � � � %% do something end Tuesday, 26 March 2013

  16. rt:attach(Node, CommandExpectations), Tuesday, 26 March 2013

  17. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  18. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  19. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  20. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  21. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  22. rt:attach(Node, CommandExpectations), [{expect, "\(^D to exit\)"}, {send, "riak_core_ring_manager:get_my_ring()."}, {expect, "dict,"}, {send, [4]}] %% 4 = ^D Tuesday, 26 March 2013

  23. commands Tuesday, 26 March 2013

  24. 13:14:17.861 [info] Cmd: java -Dcom.basho.riak.host=127.0.0.1 - Dcom.basho.riak.http.port=10018 -Dcom.basho.riak.pbc.port=10017 -cp / tmp/riak_test_scratch/riak-client-1.1.0-SNAPSHOT-jar-with- dependencies-and-tests.jar:/tmp/riak_test_scratch/riak-client-1.1.0- SNAPSHOT-tests.jar org.junit.runner.JUnitCore com.basho.riak.client.AllTests 13:16:54.580 [info] JUnit version 4.4 ...................................................................... ..........I.................I......................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... .. Time: 153.93 OK (583 tests) Tuesday, 26 March 2013

  25. 13:14:17.861 [info] Cmd: java -Dcom.basho.riak.host=127.0.0.1 - Dcom.basho.riak.http.port=10018 -Dcom.basho.riak.pbc.port=10017 -cp / tmp/riak_test_scratch/riak-client-1.1.0-SNAPSHOT-jar-with- dependencies-and-tests.jar:/tmp/riak_test_scratch/riak-client-1.1.0- SNAPSHOT-tests.jar org.junit.runner.JUnitCore com.basho.riak.client.AllTests 13:16:54.580 [info] JUnit version 4.4 ...................................................................... ..........I.................I......................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... ...................................................................... .. Time: 153.93 OK (583 tests) Tuesday, 26 March 2013

  26. 11:29:38.463 [info] Cmd: java -Dcom.basho.riak.host=127.0.0.1 - Dcom.basho.riak.http.port=10018 -Dcom.basho.riak.pbc.port=10017 -cp / tmp/riak_test_scratch/riak-client-1.1.0-SNAPSHOT-jar-with- dependencies-and-tests.jar:/tmp/riak_test_scratch/riak-client-1.1.0- SNAPSHOT-tests.jar org.junit.runner.JUnitCore com.basho.riak.client.AllTests 11:29:38.865 [info] 11:29:38.865 [info] JUnit version 4.4 11:29:39.301 [info] 11:29:40.234 [info] .................................................. 11:29:41.049 [info] ........ 11:29:42.158 [info] . 11:29:43.303 [info] . 11:29:45.009 [info] ...... 11:29:46.328 [info] ...... 11:29:47.286 [info] ...... 11:29:49.044 [info] ...I. 11:29:50.333 [info] .... 11:29:51.190 [info] .. 11:29:52.070 [info] ...... 11:29:53.845 [info] ....I. 11:29:54.939 [info] .... 11:29:55.160 [info] . 11:29:56.939 [info] ....... 11:29:57.098 [info] ... Tuesday, 26 March 2013

  27. 11:29:38.463 [info] Cmd: java -Dcom.basho.riak.host=127.0.0.1 - Dcom.basho.riak.http.port=10018 -Dcom.basho.riak.pbc.port=10017 -cp / tmp/riak_test_scratch/riak-client-1.1.0-SNAPSHOT-jar-with- dependencies-and-tests.jar:/tmp/riak_test_scratch/riak-client-1.1.0- SNAPSHOT-tests.jar org.junit.runner.JUnitCore com.basho.riak.client.AllTests 11:29:38.865 [info] 11:29:38.865 [info] JUnit version 4.4 11:29:39.301 [info] 11:29:40.234 [info] .................................................. 11:29:41.049 [info] ........ 11:29:42.158 [info] . 11:29:43.303 [info] . 11:29:45.009 [info] ...... 11:29:46.328 [info] ...... 11:29:47.286 [info] ...... 11:29:49.044 [info] ...I. 11:29:50.333 [info] .... 11:29:51.190 [info] .. 11:29:52.070 [info] ...... 11:29:53.845 [info] ....I. 11:29:54.939 [info] .... 11:29:55.160 [info] . 11:29:56.939 [info] ....... 11:29:57.098 [info] ... Tuesday, 26 March 2013

  28. Prerequisites Tuesday, 26 March 2013

  29. -prereq("java"). -prereq("curl"). check_prereqs(Module) -> Prereqs = proplists:get_all_values(prereq, � � � Module:module_info(attributes)), P2 = [ {Prereq, rt:which(Prereq)} || Prereq <- Prereqs], lager:info("~s prereqs: ~p", [Module, P2]), [ lager:warning("~s prereq '~s' not installed.", [Module, P]) || {P, false} <- P2], GoodToGo = lists:all(fun({_, Present}) -> Present end, P2), ?assertEqual({all_prereqs_present, true}, � � � � � � {all_prereqs_present, GoodToGo}). Tuesday, 26 March 2013

  30. -prereq("java"). -prereq("java"). -prereq("curl"). -prereq("curl"). check_prereqs(Module) -> check_prereqs(Module) -> Prereqs = proplists:get_all_values(prereq, Prereqs = proplists:get_all_values(prereq, � � � � � � Module:module_info(attributes)), Module:module_info(attributes)), P2 = [ {Prereq, rt:which(Prereq)} || Prereq <- Prereqs], P2 = [ {Prereq, rt:which(Prereq)} || Prereq <- Prereqs], lager:info("~s prereqs: ~p", [Module, P2]), lager:info("~s prereqs: ~p", [Module, P2]), [ [ lager:warning("~s prereq '~s' not installed.", lager:warning("~s prereq '~s' not installed.", [Module, P]) [Module, P]) || {P, false} <- P2], || {P, false} <- P2], GoodToGo = lists:all(fun({_, Present}) -> Present end, P2), GoodToGo = lists:all(fun({_, Present}) -> Present end, P2), ?assertEqual({all_prereqs_present, true}, ?assertEqual({all_prereqs_present, true}, � � � � � � � � � � � � {all_prereqs_present, GoodToGo}). {all_prereqs_present, GoodToGo}). Tuesday, 26 March 2013

Recommend


More recommend