File: lua_validation.vtc

package info (click to toggle)
haproxy 3.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,880 kB
  • sloc: ansic: 267,692; sh: 3,277; xml: 1,756; python: 1,345; makefile: 1,155; perl: 168; cpp: 21
file content (60 lines) | stat: -rw-r--r-- 1,460 bytes parent folder | download
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
# Checks that compression doesn't cause corruption..

varnishtest "Compression validation"
#REQUIRE_OPTIONS=ZLIB|SLZ,LUA,OPENSSL
#REGTEST_TYPE=slow

feature ignore_unknown_macro

haproxy h1 -conf {
global
	tune.lua.bool-sample-conversion normal
	lua-load		${testdir}/lua_validation.lua

defaults
	timeout client 30s
	timeout server 30s
	timeout connect 30s
	mode			http

frontend main-https
	bind			"fd@${fe1}" ssl crt ${testdir}/common.pem
	compression algo gzip
	compression type text/html text/plain application/json application/javascript
	compression offload
	use_backend TestBack  if  TRUE

backend TestBack
	server	LocalSrv ${h1_fe2_addr}:${h1_fe2_port}

listen fileloader
	mode http
	bind "fd@${fe2}"
	http-request use-service lua.fileloader-http01
} -start

shell {
    HOST=${h1_fe1_addr}
    if [ "${h1_fe1_addr}" = "::1" ] ; then
        HOST="\[::1\]"
    fi

    md5=$(command -v md5 || command -v md5sum)

    if [ -z $md5 ] ; then
        echo "MD5 checksum utility not found"
        exit 1
    fi

    expectchecksum="4d9c62aa5370b8d5f84f17ec2e78f483"

    for opt in "" "--limit-rate 300K" "--limit-rate 500K" ; do
        checksum=$(curl --max-time 15 --compressed -k "https://$HOST:${h1_fe1_port}" $opt | $md5 | cut -d ' ' -f1)
        if [ "$checksum" != "$expectchecksum" ] ; then
              echo "Expecting checksum $expectchecksum"
              echo "Received checksum: $checksum"
              exit 1;
        fi
    done

} -run