Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tests API
Search
Yoshiki Nakagawa
August 30, 2016
Programming
74
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Tests API
Yoshiki Nakagawa
August 30, 2016
More Decks by Yoshiki Nakagawa
See All by Yoshiki Nakagawa
Amazon Bedrock で作る未来の開発サイクルと オペレーション戦略 / AWS Summit Japan 2025
yyoshiki41
0
1.3k
MCP Documentation Server @AI Coding Meetup #1
yyoshiki41
2
4.2k
Go API クライアントの実装 〜Go Conference に載せれなかったTIPS〜
yyoshiki41
0
760
マルチテナントのアプリケーション実装 〜実践編〜
yyoshiki41
5
3.1k
Canary Deployments
yyoshiki41
0
580
go-gmail-drafts
yyoshiki41
0
800
Graceful Upgrade for Go App
yyoshiki41
0
140
Other Decks in Programming
See All in Programming
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
9.2k
【やさしく解説 設計編 #1】「ドメイン駆動」と「実装駆動」ってなに? 〜設計の考え方を、たとえ話で学ぼう〜
panda728
PRO
1
120
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
340
1年で人数1.5倍、PR数5.5倍増。 品質とアウトカムはどうなったか、 何が効いたか
ike002jp
0
140
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
130
自作OSでスライド発表する
uyuki234
1
3.9k
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
270
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
150
act2-costs.pdf
sumedhbala
0
120
act1-costs.pdf
sumedhbala
0
240
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
530
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
230
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Everyday Curiosity
cassininazir
0
260
Accessibility Awareness
sabderemane
1
160
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.9k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
420
GraphQLとの向き合い方2022年版
quramy
50
15k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
290
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
410
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
220
Being A Developer After 40
akosma
91
590k
Transcript
Tests API Agora Tech Talk #5 Aug / 30 /
2016 @yyoshiki41 Yoshiki Nakagawa
Health Check API Runscope Blog Build a Health Check API
for Services Underneath Your API TL;DR • Create separate health check API endpoints for all services! • Set up notifications!
Health Check API How do we monitor them? • MySQL
• Redis • BIND • etc ... They don't come with (HTTP) RESTful APIs ! Communicate over lower-level protocols like TCP and UDP.
Good Example! ElasticSearch $ curl localhost:9200/_cluster/health { "cluster_name": "pairs-jp-es-cluster", "status":
"green", "timed_out": false, "number_of_nodes": 6, "number_of_data_nodes": 5, "active_primary_shards": 8, "active_shards": 32, "relocating_shards": 0, "initializing_shards": 0, "unassigned_shards": 0, "delayed_unassigned_shards": 0, "number_of_pending_tasks": 0, "number_of_in_flight_fetch": 0, "task_max_waiting_in_queue_millis": 0, "active_shards_percent_as_number": 100 }
Create Health Check API Endpoints! Check MySQL connection <?php $config
= [ "server" => "databaseserver:3306", "username" => "root", "password" => "password" ]; header('Content-type: application/json'); $link = new mysqli($config['server'],$config['username'],$config['password']); if ($link->connect_errno) { http_response_code(503); echo('{ "status": "Unable to connect" }'); } else { http_response_code(200); echo('{ "status": "Connection successful." }'); }
Caution Do not open to the public ! Access control
by ip address or authentication. nginx Advent Calendar 2015 Day21 nginx APIΤϯυϙΠϯτຖͷΞΫηε੍ޚ
Tests API Unit test $ go test -run TestHogehoge How
do we test API endpoints??
Runscope
Runscope • Monitor API perfomance • CI
Monitor API performance Set schedules for this test Demo
Ghost Inspector
Ghost Inspector Ghost InspectorΛࢼͯ͠Έ·ͨ͠ FYI (૿੮)·ͩࢹͰফͯ͠ΔͷʁϒϥβνΣοΫࣗಈԽͷ͢͢ Ί
Demo
Automate everything Commit => Unit Test => Deploy => API
Tests => !