Fix panics after mock introduction #120

Merged
alexvanin merged 2 commits from alexvanin/frostfs-http-gw:fix/117 into master 2024-06-25 15:12:23 +00:00
Owner

Panic occurred after #117

goroutine 174 [running]:                                                                                   
git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.readContentType(0xc0003d6320?, 0xc001a87260)
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/reader.go:40 +0x5a                  
git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).receiveFile(0xc0002e1130, {0x1235
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/reader.go:118 +0xb5c                
git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).byAddress(0xc0002e1130, 0xc0003d6
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/handler.go:192 +0x827               
git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).DownloadByAddressOrBucketName(0xc
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/download.go:32 +0x157               
main.(*app).configureRouter.(*app).reqNamespace.func7(0xc0003d6008)                                        
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:600 +0xa2                         
main.(*app).configureRouter.(*app).tracer.func8(0xc0003d6008)                                              
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:588 +0x11f                        
main.(*app).configureRouter.(*app).tokenizer.func9(0xc0003d6008)                                           
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:571 +0x2ce                        
main.(*app).configureRouter.(*app).logger.func10(0xc0003d6008)                                             
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:558 +0x591                        
github.com/fasthttp/router.(*Router).Handler(0xc000123730, 0xc0003d6008)                                   
        github.com/fasthttp/router@v1.4.1/router.go:414 +0x44e                                             
github.com/valyala/fasthttp.(*Server).serveConn(0xc000480b48, {0x123bd98, 0xc0001305f8})                   
        github.com/valyala/fasthttp@v1.34.0/server.go:2341 +0xf3d                                          
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0004c0460, 0xc0019e88c0)                           
        github.com/valyala/fasthttp@v1.34.0/workerpool.go:224 +0xa4                                        
github.com/valyala/fasthttp.(*workerPool).getCh.func1()                                                    
        github.com/valyala/fasthttp@v1.34.0/workerpool.go:196 +0x32                                        
created by github.com/valyala/fasthttp.(*workerPool).getCh in goroutine 212                                
        github.com/valyala/fasthttp@v1.34.0/workerpool.go:195 +0x190                                       

Now integration tests passed correctly.

$ make integration-test 
?       git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/api      [no test files]
?       git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/api/layer        [no test files]
ok      git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw       (cached)        coverage: 53.7% of statements
?       git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/data     [no test files]
?       git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/logs     [no test files]
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/frostfs/services         coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/middleware               coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/frostfs          coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/multipart                coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/cache            coverage: 0.0% of statements
ok      git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler  (cached)        coverage: 49.7% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/resolver          coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/response          coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/metrics           coverage: 0.0% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/tokens            coverage: 0.0% of statements
ok      git.frostfs.info/TrueCloudLab/frostfs-http-gw/tree      (cached)        coverage: 30.2% of statements
        git.frostfs.info/TrueCloudLab/frostfs-http-gw/utils             coverage: 0.0% of statements
Panic occurred after #117 ``` goroutine 174 [running]: git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.readContentType(0xc0003d6320?, 0xc001a87260) git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/reader.go:40 +0x5a git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).receiveFile(0xc0002e1130, {0x1235 git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/reader.go:118 +0xb5c git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).byAddress(0xc0002e1130, 0xc0003d6 git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/handler.go:192 +0x827 git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler.(*Handler).DownloadByAddressOrBucketName(0xc git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/download.go:32 +0x157 main.(*app).configureRouter.(*app).reqNamespace.func7(0xc0003d6008) git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:600 +0xa2 main.(*app).configureRouter.(*app).tracer.func8(0xc0003d6008) git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:588 +0x11f main.(*app).configureRouter.(*app).tokenizer.func9(0xc0003d6008) git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:571 +0x2ce main.(*app).configureRouter.(*app).logger.func10(0xc0003d6008) git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw/app.go:558 +0x591 github.com/fasthttp/router.(*Router).Handler(0xc000123730, 0xc0003d6008) github.com/fasthttp/router@v1.4.1/router.go:414 +0x44e github.com/valyala/fasthttp.(*Server).serveConn(0xc000480b48, {0x123bd98, 0xc0001305f8}) github.com/valyala/fasthttp@v1.34.0/server.go:2341 +0xf3d github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0004c0460, 0xc0019e88c0) github.com/valyala/fasthttp@v1.34.0/workerpool.go:224 +0xa4 github.com/valyala/fasthttp.(*workerPool).getCh.func1() github.com/valyala/fasthttp@v1.34.0/workerpool.go:196 +0x32 created by github.com/valyala/fasthttp.(*workerPool).getCh in goroutine 212 github.com/valyala/fasthttp@v1.34.0/workerpool.go:195 +0x190 ``` Now integration tests passed correctly. ``` $ make integration-test ? git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/api [no test files] ? git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/api/layer [no test files] ok git.frostfs.info/TrueCloudLab/frostfs-http-gw/cmd/http-gw (cached) coverage: 53.7% of statements ? git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/data [no test files] ? git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/logs [no test files] git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/frostfs/services coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/middleware coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/frostfs coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler/multipart coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/cache coverage: 0.0% of statements ok git.frostfs.info/TrueCloudLab/frostfs-http-gw/internal/handler (cached) coverage: 49.7% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/resolver coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/response coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/metrics coverage: 0.0% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/tokens coverage: 0.0% of statements ok git.frostfs.info/TrueCloudLab/frostfs-http-gw/tree (cached) coverage: 30.2% of statements git.frostfs.info/TrueCloudLab/frostfs-http-gw/utils coverage: 0.0% of statements ```
alexvanin added this to the v0.30.0 milestone 2024-06-25 13:17:53 +00:00
alexvanin self-assigned this 2024-06-25 13:17:53 +00:00
alexvanin added 2 commits 2024-06-25 13:17:56 +00:00
HTTP Gateway expects io.Reader to work with
payload, however `WithPayload` flag reads whole
payload into header object.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
[#117] Update tests
All checks were successful
/ DCO (pull_request) Successful in 49s
/ Vulncheck (pull_request) Successful in 1m42s
/ Builds (1.21) (pull_request) Successful in 2m2s
/ Builds (1.22) (pull_request) Successful in 2m2s
/ Lint (pull_request) Successful in 3m40s
/ Tests (1.21) (pull_request) Successful in 2m22s
/ Tests (1.22) (pull_request) Successful in 1m6s
a62c8f0f5a
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
alexvanin requested review from dkirillov 2024-06-25 13:18:13 +00:00
alexvanin requested review from pogpp 2024-06-25 13:18:16 +00:00
alexvanin requested review from r.loginov 2024-06-25 13:18:18 +00:00
pogpp approved these changes 2024-06-25 13:24:44 +00:00
dkirillov approved these changes 2024-06-25 13:24:54 +00:00
r.loginov approved these changes 2024-06-25 13:55:50 +00:00
alexvanin merged commit 1737f1d95f into master 2024-06-25 15:12:23 +00:00
alexvanin deleted branch fix/117 2024-06-25 15:12:24 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#120
No description provided.