@@ -10,12 +10,11 @@ class TestProxy:
10
10
11
11
@pytest .fixture (autouse = True , scope = 'class' )
12
12
def _class_scope (self , env ):
13
- TestProxy ._local_dir = os .path .dirname (inspect .getfile (TestProxy ))
14
13
H2Conf (env ).add_vhost_cgi (proxy_self = True ).install ()
15
14
assert env .apache_restart () == 0
16
15
17
16
def local_src (self , fname ):
18
- return os .path .join (TestProxy . _local_dir , fname )
17
+ return os .path .join (os . path . dirname ( inspect . getfile ( TestProxy )) , fname )
19
18
20
19
def setup_method (self , method ):
21
20
print ("setup_method: %s" % method .__name__ )
@@ -28,10 +27,10 @@ def test_h2_500_01(self, env):
28
27
r = env .curl_get (url , 5 )
29
28
assert r .response ["status" ] == 200
30
29
assert "HTTP/1.1" == r .response ["json" ]["protocol" ]
31
- assert "" == r .response ["json" ]["https" ]
32
- assert "" == r .response ["json" ]["ssl_protocol" ]
33
- assert "" == r .response ["json" ]["h2" ]
34
- assert "" == r .response ["json" ]["h2push" ]
30
+ assert r .response ["json" ]["https" ] == ""
31
+ assert r .response ["json" ]["ssl_protocol" ] == ""
32
+ assert r .response ["json" ]["h2" ] == ""
33
+ assert r .response ["json" ]["h2push" ] == ""
35
34
36
35
# upload and GET again using curl, compare to original content
37
36
def curl_upload_and_verify (self , env , fname , options = None ):
@@ -47,9 +46,9 @@ def curl_upload_and_verify(self, env, fname, options=None):
47
46
assert r2 .response ["status" ] == 200
48
47
with open (self .local_src (fpath ), mode = 'rb' ) as file :
49
48
src = file .read ()
50
- assert src == r2 .response ["body" ]
49
+ assert r2 .response ["body" ] == src
51
50
52
- def test_h2_500_10 (self , env ):
51
+ def test_h2_500_10 (self , env , repeat ):
53
52
self .curl_upload_and_verify (env , "data-1k" , ["--http2" ])
54
53
self .curl_upload_and_verify (env , "data-10k" , ["--http2" ])
55
54
self .curl_upload_and_verify (env , "data-100k" , ["--http2" ])
@@ -64,15 +63,20 @@ def nghttp_post_and_verify(self, env, fname, options=None):
64
63
assert 200 <= r .response ["status" ] < 300
65
64
with open (self .local_src (fpath ), mode = 'rb' ) as file :
66
65
src = file .read ()
67
- assert src == r .response ["body" ]
68
-
69
- def test_h2_500_20 (self , env ):
66
+ if r .response ["body" ] != src :
67
+ with open (os .path .join (env .gen_dir , "nghttp.out" ), 'w' ) as fd :
68
+ fd .write (r .outraw )
69
+ fd .write ("\n stderr:\n " )
70
+ fd .write (r .stderr )
71
+ assert r .response ["body" ] == src
72
+
73
+ def test_h2_500_20 (self , env , repeat ):
70
74
self .nghttp_post_and_verify (env , "data-1k" , [])
71
75
self .nghttp_post_and_verify (env , "data-10k" , [])
72
76
self .nghttp_post_and_verify (env , "data-100k" , [])
73
77
self .nghttp_post_and_verify (env , "data-1m" , [])
74
78
75
- def test_h2_500_21 (self , env ):
79
+ def test_h2_500_21 (self , env , repeat ):
76
80
self .nghttp_post_and_verify (env , "data-1k" , ["--no-content-length" ])
77
81
self .nghttp_post_and_verify (env , "data-10k" , ["--no-content-length" ])
78
82
self .nghttp_post_and_verify (env , "data-100k" , ["--no-content-length" ])
0 commit comments