|
23 | 23 |
|
24 | 24 | set -ex
|
25 | 25 |
|
| 26 | +git checkout conf/config.yaml |
| 27 | + |
26 | 28 | # check whether the 'reuseport' is in nginx.conf .
|
27 | 29 | make init
|
28 | 30 |
|
|
72 | 74 |
|
73 | 75 | sed -i '/dns_resolver:/,+4s/^#//' conf/config.yaml
|
74 | 76 | echo "passed: system nameserver imported"
|
| 77 | + |
| 78 | +# enable enable_dev_mode |
| 79 | +sed -i 's/enable_dev_mode: false/enable_dev_mode: true/g' conf/config.yaml |
| 80 | + |
| 81 | +make init |
| 82 | + |
| 83 | +count=`grep -c "worker_processes 1;" conf/nginx.conf` |
| 84 | +if [ $count -ne 1 ]; then |
| 85 | + echo "failed: worker_processes is not 1 when enable enable_dev_mode" |
| 86 | + exit 1 |
| 87 | +fi |
| 88 | + |
| 89 | +count=`grep -c "listen 9080.*reuseport" conf/nginx.conf || true` |
| 90 | +if [ $count -ne 0 ]; then |
| 91 | + echo "failed: reuseport should be disabled when enable enable_dev_mode" |
| 92 | + exit 1 |
| 93 | +fi |
| 94 | + |
| 95 | +git checkout conf/config.yaml |
| 96 | + |
| 97 | +# check whether the 'worker_cpu_affinity' is in nginx.conf . |
| 98 | + |
| 99 | +make init |
| 100 | + |
| 101 | +grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null |
| 102 | +if [ ! $? -eq 0 ]; then |
| 103 | + echo "failed: nginx.conf file is missing worker_cpu_affinity configuration" |
| 104 | + exit 1 |
| 105 | +fi |
| 106 | + |
| 107 | +echo "passed: nginx.conf file contains worker_cpu_affinity configuration" |
| 108 | + |
| 109 | +# check admin https enabled |
| 110 | + |
| 111 | +sed -i 's/\# port_admin: 9180/port_admin: 9180/' conf/config.yaml |
| 112 | +sed -i 's/\# https_admin: true/https_admin: true/' conf/config.yaml |
| 113 | + |
| 114 | +make init |
| 115 | + |
| 116 | +grep "listen 9180 ssl" conf/nginx.conf > /dev/null |
| 117 | +if [ ! $? -eq 0 ]; then |
| 118 | + echo "failed: failed to enabled https for admin" |
| 119 | + exit 1 |
| 120 | +fi |
| 121 | + |
| 122 | +make run |
| 123 | + |
| 124 | +code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} https://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1') |
| 125 | +if [ ! $code -eq 200 ]; then |
| 126 | + echo "failed: failed to enabled https for admin" |
| 127 | + exit 1 |
| 128 | +fi |
| 129 | + |
| 130 | +echo "passed: admin https enabled" |
| 131 | + |
| 132 | +# rollback to the default |
| 133 | + |
| 134 | +make stop |
| 135 | + |
| 136 | +sed -i 's/port_admin: 9180/\# port_admin: 9180/' conf/config.yaml |
| 137 | +sed -i 's/https_admin: true/\# https_admin: true/' conf/config.yaml |
| 138 | + |
| 139 | +make init |
| 140 | + |
| 141 | +set +ex |
| 142 | + |
| 143 | +grep "listen 9180 ssl" conf/nginx.conf > /dev/null |
| 144 | +if [ ! $? -eq 1 ]; then |
| 145 | + echo "failed: failed to rollback to the default admin config" |
| 146 | + exit 1 |
| 147 | +fi |
| 148 | + |
| 149 | +set -ex |
| 150 | + |
| 151 | +echo "passed: rollback to the default admin config" |
0 commit comments