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
GitHub Flowでの高速なデリバリーをささえるテスト基盤について
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kimkiyong
December 15, 2022
Programming
750
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GitHub Flowでの高速なデリバリーをささえるテスト基盤について
kimkiyong
December 15, 2022
Other Decks in Programming
See All in Programming
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
130
【DroidKaigi 2026】「アクセシビリティを利用するとき、 アクセシビリティもまたこちらを利用している」 〜マルウェアによる攻撃と防衛について〜
halunoyo
0
110
プロポーザルを書いてもらう
pvcresin
0
590
ALB ログから Trace を気合で繋げる技術
fohte
7
820
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
190
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
110
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
550
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
280
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
270
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
170
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
48
30k
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
130
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
640
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
510
Amusing Abliteration
ianozsvald
1
280
Odyssey Design
rkendrick25
PRO
2
790
Designing for Performance
lara
611
70k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
Transcript
GitHub Flowでの高速なデリバ リーをささえるテスト基盤について
自己紹介 金 祺庸 ▪ 2022年2月 BuysellTechnologies入社 ▫ BE エンジニア ▪
Go歴 2 ~ 3年 ▫ BST.go (社内go community)の立ち上げ・運 営 ▪ 趣味 ▫ 読書 ▫ ジム ▫ 冷水シャワー
Agenda ▪ 開発環境・手法の紹介 ▫ テスト基盤にこだわる理由 ▪ テストへのこだわり ▫ テストケース毎にDBをRollback ▫
宣言的なFixture ▫ E2Eテスト
1 開発環境・手法の紹介
開発環境 ▪ Microservices
開発環境 ▪ Microservices この辺り開発 しています
開発環境 ▪ BEの構成 ▫ Hasura + Go API Server(Sidecar) ▪
主にGraphQLで通信 ▪ MSが提唱するSidecar Pattern ▪ Hasura(Primary Application) • DBのschemaからGraphQL APIを自動生成してくれる • 認可制御・基本的なCRUD操作が可能 ▪ Go API Server(Sidecar) • Hasura APIでは対応しきれない副作用的な処理を実行する • 他Serviceとの通信部分 • メインは99designs/gqlgen ◦ RESTも使う(Pub/Sub) • 複雑なLogicが集中しやすい
開発環境 ▪ ブランチ戦略 ▫ Github Flow ▪ 運用するbranchはmainブランチとfeatureブランチのみ • mainブランチへのPRがmergeされると即Production環境へDeploy
▫ Feature Flag ▪ コードを書き換えずフラグを使って機能の有効/無効を切り替える • Deploy後、Feature Flagを切り替えることで機能がReleaseされる ▪ ブランチの状態をRelease作業を切り離せる
Testを書きたい
2 テストへのこだわり
テストケース毎にDBをRollback ▪ DBはmockしない ▪ DATA-DOG/go-txdbを活用 ▫ テストケース毎に Transactionをはる ▫ CloseするだけでRollback
が可能
テストケース毎にDBをRollback ▪ DBはmockしない ▪ DATA-DOG/go-txdbを活用 ▫ テストケース毎に Transactionをはる ▫ CloseするだけでRollback
が可能 宣言したdriverを 使うことで transactionがは れる
宣言的なFixture ▪ kyong0612/polluterを使用 ▫ Mysql,PostgreSQL,Redisに対応 ▫ yaml形式でFixtureを用意できる ▪ 再利用性が高い ▪
パターンを用意することで面 倒なFixtureの挿入作業を簡 略化できる
宣言的なFixture ▪ kyong0612/polluterを使用 ▫ Mysql,PostgreSQL,Redisに対応 ▫ yaml形式でFixtureを用意できる ▪ 再利用性が高い ▪
パターンを用意することで面 倒なFixtureの挿入作業を簡 略化できる Fixtureを適用
E2Eテスト ▪ ClientからのRequestを再現できるE2E の機構を用意 ▫ 99design/gqlgenのclinet pkgを活用 ▫ http.Handlerを引数にE2E Serverを立てる
E2Eテスト ▪ ClientからのRequestを再現できるE2E の機構を用意 ▫ 99design/gqlgenのclinet pkgを活用 ▫ http.Handlerを引数にE2E Serverを立てる
Clientを生成
E2Eテスト ▪ ClientからのRequestを再現できるE2E の機構を用意 ▫ 99design/gqlgenのclinet pkgを活用 ▫ http.Handlerを引数にE2E Serverを立てる
Requestを実行
他にも 18 ▪ stretchr/testify ▫ Test関係のutilsを提供 ▫ Testing pkgの学習コスト軽減 ▪
gostaticanalysis/skeleton + gqlgo/gqlanalysisでの自作linter ▫ graphQL schemaに対して独自の静的解析を実行 攻めのための守りを改善しています