Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- k8s
- Golang
- loadbalance
- Elk
- Kafka
- gorm
- http
- go
- kibana
- Kubernetes
- create topic
- tls disable
- eck
- docker
- Kafka Connect
- gin
- Produce
- go test
- Consumer
- kafka-connect
- broker
- ElasticSearch
- Helm
- topic
- minikube
- 쿠버네티스
- kafka broker
- consumer group
- gortsplib
- Message
Archives
- Today
- Total
목록2025/06/01 (1)
개발자의 개발괴발
Handler test 작성
각각의 함수의 unit test도 필요하지만 http handler에도 test가 필요하다.각각의 함수가 잘 동작한다는 보장이 있어도 handler에서 에러가 날 수도 있기 때문이다.Handler test하기handler를 테스트 하는것도 handler 함수를 호출해주는 것처럼 테스트를 할 수 있다.func GetAllUsers(c *gin.Context) { // something}그러나 handler는 parameter로 *gin.Context를 받아야한다.어떻게해야할지 몰라 당황스러울 수도 있지만 다행히도 test context를 만들어서 집어넣어줄 수 있다.func GetTestGinContext() (*gin.Context, *httptest.ResponseRecorder) { w := http..
Home Cam Service 개발하기
2025. 6. 1. 21:32