summaryrefslogtreecommitdiffstats
path: root/test/modules/http2/test_711_load_post_cgi.py
blob: 82529d17644bfc4a44301536b050f2455be030e1 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import pytest
import os

from .env import H2Conf, H2TestEnv


@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here")
class TestLoadCgi:

    @pytest.fixture(autouse=True, scope='class')
    def _class_scope(self, env):
        H2Conf(env).add_vhost_cgi(proxy_self=True, h2proxy_self=True).install()
        assert env.apache_restart() == 0

    def check_h2load_ok(self, env, r, n):
        assert 0 == r.exit_code
        r = env.h2load_status(r)
        assert n == r.results["h2load"]["requests"]["total"]
        assert n == r.results["h2load"]["requests"]["started"]
        assert n == r.results["h2load"]["requests"]["done"]
        assert n == r.results["h2load"]["requests"]["succeeded"]
        assert n == r.results["h2load"]["status"]["2xx"]
        assert 0 == r.results["h2load"]["status"]["3xx"]
        assert 0 == r.results["h2load"]["status"]["4xx"]
        assert 0 == r.results["h2load"]["status"]["5xx"]
    
    # test POST on cgi, where input is read
    def test_h2_711_10(self, env, repeat):
        assert env.is_live()
        url = env.mkurl("https", "test1", "/echo.py")
        n = 100
        m = 5
        conn = 1
        fname = "data-100k"
        args = [
            env.h2load, "-n", str(n), "-c", str(conn), "-m", str(m),
            f"--base-uri={env.https_base_url}",
            "-d", os.path.join(env.gen_dir, fname), url
        ]
        r = env.run(args)
        self.check_h2load_ok(env, r, n)

    # test POST on cgi via http/1.1 proxy, where input is read
    def test_h2_711_11(self, env, repeat):
        assert env.is_live()
        url = env.mkurl("https", "test1", "/proxy/echo.py")
        n = 100
        m = 5
        conn = 1
        fname = "data-100k"
        args = [
            env.h2load, "-n", str(n), "-c", str(conn), "-m", str(m),
            f"--base-uri={env.https_base_url}",
            "-d", os.path.join(env.gen_dir, fname), url
        ]
        r = env.run(args)
        self.check_h2load_ok(env, r, n)

    # test POST on cgi via h2proxy, where input is read
    def test_h2_711_12(self, env, repeat):
        assert env.is_live()
        url = env.mkurl("https", "test1", "/h2proxy/echo.py")
        n = 100
        m = 5
        conn = 1
        fname = "data-100k"
        args = [
            env.h2load, "-n", str(n), "-c", str(conn), "-m", str(m),
            f"--base-uri={env.https_base_url}",
            "-d", os.path.join(env.gen_dir, fname), url
        ]
        r = env.run(args)
        self.check_h2load_ok(env, r, n)