]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pytest: improve pytest_07_42a reliability
authorStefan Eissing <stefan@eissing.org>
Thu, 3 Oct 2024 09:10:29 +0000 (11:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Oct 2024 12:42:52 +0000 (14:42 +0200)
Due to timings on paused response receive, the error code may vary due
to the location where it is detected that the server closed the transfer
prematurely.

Be more lenient in always allowing PARTIAL_FILE as ok.

Closes #15138

tests/http/test_07_upload.py

index 21f18b3ebbf35956a251bc14bd1bf6bcf49e9009..6dbe0c55daf755ee15168ee660532ef7c89d140c 100644 (file)
@@ -544,12 +544,14 @@ class TestUpload:
             pytest.skip(f'example client not built: {client.name}')
         url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]&die_after=0'
         r = client.run(['-V', proto, url])
-        exp_code = 18  # PARTIAL_FILE
-        if proto == 'h2':
-            exp_code = 92  # CURLE_HTTP2_STREAM
+        if r.exit_code == 18: # PARTIAL_FILE is always ok
+            pass
+        elif proto == 'h2':
+            r.check_exit_code(92)  # CURLE_HTTP2_STREAM also ok
         elif proto == 'h3':
-            exp_code = 95  # CURLE_HTTP3
-        r.check_exit_code(exp_code)
+            r.check_exit_code(95)  # CURLE_HTTP3 also ok
+        else:
+            r.check_exit_code(18)  # will fail as it should
 
     # upload data, pause, let connection die without any response at all
     @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])