From 720a7e5628346a90017f5b6898f7ed4a593ca231 Mon Sep 17 00:00:00 2001 From: niksis02 Date: Wed, 14 May 2025 00:08:40 +0400 Subject: [PATCH] fix: fixes the early context cancelation issue in GetObject_with_range integration test. `context` gets cancelled early before reading the full body in the `GetObject_with_range` integration test. This change defers the context cancelation to make sure the full body is ready and the context isn't canceled in the middle of the request body read. --- tests/integration/tests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/tests.go b/tests/integration/tests.go index 7c99f3d..f178915 100644 --- a/tests/integration/tests.go +++ b/tests/integration/tests.go @@ -4320,12 +4320,12 @@ func GetObject_with_range(s *S3Conf) error { testGetObjectRange := func(rng, contentRange string, cLength int64, expData []byte, expErr error) error { ctx, cancel := context.WithTimeout(context.Background(), shortTimeout) + defer cancel() out, err := s3client.GetObject(ctx, &s3.GetObjectInput{ Bucket: &bucket, Key: &obj, Range: &rng, }) - cancel() if err == nil && expErr != nil { return fmt.Errorf("expected err %w, instead got nil", expErr) }