Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Тестирование распределенных систем или Jepsen это совсем не сложно

1,129 views

Published on

Доклад Ильи Сунцова на конференции SQA Days-21
www.sqadays.com

Published in: Education
  • Be the first to comment

  • Be the first to like this

Тестирование распределенных систем или Jepsen это совсем не сложно

  1. 1. Милая картинка
  2. 2. Read A, write B, read B Read A, read A, write B Read A, read B, write B Реальный мир
  3. 3. Нарушение целостности - Lost updates - Dirty read - Stale read . . . . .
  4. 4. Lost updates
  5. 5. Доступность
  6. 6. Partition tolerance
  7. 7. UNIT TESTS ALL THE STUFF
  8. 8. Тестирование производительности
  9. 9. Функциональное тестирование
  10. 10. https://aphyr.com Kyle Kingsbury Создатель Jepsen
  11. 11. https://github.com/jepsen-io/jepsen https://aphyr.com/tags/jepsen
  12. 12. Read-Eval-Print Loop (REPL) Leiningen wget https://raw.githubusercontent.com/techno mancy/leiningen/stable/bin/lein chmod +x lein sudo mv lein /usr/local/bin lein repl
  13. 13. Среда разработки https://www.jetbrains.com https://cursive-ide.com
  14. 14. Пример #1 (ns clojure.examples.hello (:gen-class)) (defn hello-world [nword] (println (format "Hello, %s" nword))) (hello-world "world") https://www.tutorialspoint.com/clojure/index.htm
  15. 15. Пример #2 (ns clojure.examples.hello (:gen-class)) ;; Just for loop (defn Example [] (loop [x 10] (when (> x 1) (println x) (recur (- x 2))))) (Example) https://www.tutorialspoint.com/clojure/index.htm
  16. 16. Пример #3 (ns Project (:gen-class)) ;; Clojure + Java (defn Example [] (def str1 (new String "Hello")) (println str1)) (Example) https://www.tutorialspoint.com/clojure/index.htm
  17. 17. Пример #4 (ns Project (:gen-class)) (import java.util.Stack) (defn Example [] (let [stack (Stack.)] (.push stack "First Element") (.push stack "Second Element") (println (first stack)))) (Example) https://www.tutorialspoint.com/clojure/index.htm
  18. 18. Пример #5 (ns clojure.examples.example (:gen-class)) (defn Example [] (try (aget (int-array [1 2 3]) 5) (catch Exception e (println (str "caught exception: " (.toString e)))) (finally (println "Blablabla"))) (println "Let's move on")) (Example)) https://www.tutorialspoint.com/clojure/index.htm
  19. 19. https://ignite.apache.org
  20. 20. Тестовое окружение
  21. 21. Salticid https://github.com/aphyr/salticid
  22. 22. gem install salticid # example.rb host '192.168.1.10' do user 'some_user' task :hello do exec! 'ls -la /', echo: true end end salticid -l example.rb -h 192.168.1.10 hello https://github.com/aphyr/salticid
  23. 23. Test part #1
  24. 24. Структура проекта
  25. 25. consul mongodb-smartos rabbitmq aerospike crate elasticsearch mysql-cluster rethinkdb postgres-rds zookeeper chronos disque etcd logcabin percona robustirc cockroachdb doc galera mongodb-rocks postgres-rds Примеры тестов
  26. 26. Test part #3 Установка AI (defn install! "Installs Apache Ignite on the given node." [node version] (c/sudo "ubuntu" (c/cd "/tmp" (c/exec :wget :-c (str "somelink")) (c/exec :unzip :-q (str "somezipfile")) (c/exec :mv :-f (str "dir1") "dir2") (c/exec :mkdir "/tmp/dir2/jepsen"))))
  27. 27. Test part #4 Старт AI (defn start! "Starts Apache Ignite." [node test] (info node "starting ignite") (c/sudo "ubuntu" (c/cd "/tmp/apache-ignite-fabric" (c/exec "bin/ignite.sh" "jepsen/config.xml" :-v (c/lit ">node.log") (c/lit "2>&1 &"))
  28. 28. Test part #5 Hardcore (defrecord IgniteСlient [client node cache] client/Client (setup! [this test node] (let [client (Ignition/start (str "/tmp/jepsen_config.client." (fixNodeId node) ".xml")) cache (.getOrCreateCache client "jepsen_cache")] (dotimes [i 100] (ignite-put cache i)) (assoc this :client client :cache cache))) (invoke! [this test op] (try (case (:f op) :read (assoc op :type :ok :value (ignite-get cache op)) :write (assoc op :type :ok :value (ignite-put cache op))))) (teardown! [_ test]))
  29. 29. Test part #5 Everything looks good! ヽ (‘ ー `) ノ https://aphyr.com/tags/jepsen
  30. 30. Итоги Один для всех Clojure
  31. 31. Ilya.suntsov suntsov.ilya@gmail.com

×