Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Mercari Summer Internship 2021 Final Presentation
Search
Yoshiki Nagasaki
December 01, 2021
Programming
3.7k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Mercari Summer Internship 2021 Final Presentation
Yoshiki Nagasaki
December 01, 2021
Other Decks in Programming
See All in Programming
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.4k
R8 の設定見直しでアプリサイズ削減
andpad
0
140
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
4k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
21k
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2.2k
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
450
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
Domain-Driven Transformation
hschwentner
2
2.3k
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
130
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
350
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
340
FreeBSDでZabbixを動かす
kenkino
0
360
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
270
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Technical Leadership for Architectural Decision Making
baasie
3
590
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
430
Why Our Code Smells
bkeepers
PRO
340
58k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Transcript
Yoshiki Nagasaki (champon) Summer Internship 2021 Results Presentation
@champon (ちゃんぽん) / Backend Engineer Internship PICTURE Picture which can
be identified your face is preferable 顔がわかる写真が好ましいです • Full Name : 長崎好輝 (Yoshiki Nagasaki) • GitHub : champon1020 • Twitter : champon1020 • Joining Time : 2021/08/01 • Career : M1 student (summer internship at Merpay) • Hobby : Anime, Comic, Programming • Strong : Go, Computer Vision • Weak : Careless mistakes • Message : Nice to meet you!
やったこと
やったこと 1. batchのsubcommand化 2. Outbox Patternの実装とテスト 3. Launchableからsubsetを取得するworkflow作成
batchのsubcommand化
batchのsubcommand化とは batch: 定期実行されるプログラム subcommand: あるコマンド下でさらに処理を分岐するコマンド (ex. git push,
git pull)
batchのsubcommand化 背景 • defpayのビルド時間を短縮したい • batchに共通化できそうな部分がたくさんあった 処理を共通化してソースコードを減らそう!
batchのsubcommand化 主に共通化できるコード • serviceやclientの初期化 ◦ cmd/batch/main.goにて共通化 • 環境変数 ◦
configに新たな環境変数として登録
batchのsubcommand化 進捗 計8個のbatchをsubcommand化した scheduled-repayment-v2 scheduled-repayment-result-checker payable-easypay debt-sync
reconcile-easypay-reviews overdue-easypay create-easypay-user-contract-record-v2 force-michael-sync (Released) (In Review) (Released) (Released) (Verified) (Verified) (Verified) (Approved)
batchのsubcommand化 学び • メルペイ(defpay)でのリリースフローを体験できた ◦ cronjobの更新 ◦ spinnakerを使ったリリース
• Goの使用に関して新たに学ぶことができた ◦ path.Joinとfilepath.Join ▪ WindowsではURLは”\”が必要なのでfilepath.Joinで はなくpath.Join ◦ io.NopCloser ▪ io.Readerを引数に取ることでio.ReaderCloserを返し てくれる Engineer Go
Outbox Patternの実装とテスト
Outbox Patternとは Outbox Pattern: マイクロサービス間の通信においてイベントが送信成功するまでリトライを継続して一 貫性を担保 サービスA サービスB 送信失敗 例
一貫性がサービスA内で完結してしまう
Outbox Patternとは Outbox Pattern: マイクロサービス間の通信においてイベントが送信成功するまでリトライを継続して一 貫性を担保 サービスA サービスB 成功するまでリトライ
例 一貫性をマイクロサービス間で担保
Outbox Patternとは publishworkerの概要図 Task Pub/Sub Spanner publishworker Retry until succeed
(check if error is retriable) Poll INSERT Send Task
Outbox Patternの実装とテスト TestNewWorker:workerの初期化 • Optionがちゃんと渡されているか確認 TestWorker_Start:workerをスタートする(taskをpollする状態に遷移する) •
既にworkerがRunningしている場合は何もしない • taskがあればpublishを開始 TestWorker_publish :taskをPubSubにpublishする • retriableか否かを判定できているか確認 進捗 計3つの単体テストを実装した (Merged) (In Review) (Merged)
Outbox Patternの実装とテスト 難しかったところ・工夫点 • gRPCのInterceptorを咬ますとDB Setupの時に”READY”状態で止まる ◦ Spanner Clientを2つ用意してDB名を共有
• CIがたまにDatabase not foundエラーを吐く ◦ 全テストでインスタンスは共通 ◦ TestMainでインスタンス内の全DBを消去している ◦ ➡ 必要無くなったデータベースをインメモリで保持
Outbox Patternの実装とテスト 学び • コードを読む力が付いた ◦ ライブラリやdefpayのコードを見ながら試行錯誤した
• spanner emulatorを触った ◦ 存在自体も初めて知った • for文の中でdeferしない ◦ forから抜けるまでdeferが積まれていく Spanner Engineer Go
Launchableからsubsetを取得するworkflow作 成
Launchableとは 背景 • Mercari / Merpayではシナリオテストにより実際にテスト環境にデプロイし た状態でAPIテストを行っている • 全テストを実行すると時間がかかるのでPRのdiffに影響のあるテストのみ
を実行したい Launchableを使う! ✓ 機械学習によりdiffに対応するテストファイルを学習 ✓ CLIベースで接続できるのでGitHub Actionsと連携可能 🚀
Launchable使用の流れ Defapy Repo Scenario Test Repo 🚀 Launchable Run Test
XML Diff All Tests Test Subset Test Report ① ② ③
Launchableのworkflow作成 現状 • とりあえずLaunchableにデータを送りまくってる状態 • シナリオテストは定期実行されている 今回やりたいこと subsetを取得してPRにコメントとして残す
• ちゃんと学習できているか確認 • QAにおいてどのようなテストを実行すれば良いかの参考になる
PRへのコメント 2回目以降のRunではコメントを 更新する PRへコメント
PRへのコメント Subset List merpay-scenario-testsの リポジトリへ飛べる
PRへのコメント Invalid Subset 試運用段階なのでfailさせ ずにリストに残してる
workflowの流れ defpayとscenario-testのコードを Launchableに登録 Launchableからsubsetを取得 subsetをmarkdownのテーブルに変換 PRにコメント
Launchableのworkflow作成 学び • 業務でのGitHub Actionsのworkflow作成を体験できた • 何のために使用するのかを意識して作成する
◦ QAの人が見て分かりやすいPRコメントを残す ▪ 何のシナリオテストなのか? ➡ Titleを表示 ▪ 実際のテストはどのような流れなのか? ➡ リンクを表示 Engineer CI
Thank you for your attention!