@@ -28,13 +28,13 @@ setup() {
2828@test " high-load-messages: _tg_escape escapes underscores" {
2929 run _tg_escape " my_server_name"
3030 [ " $status " -eq 0 ]
31- [[ " $output " == * " my\_server\_name" * ]]
31+ [[ $output == * " my\_server\_name" * ]]
3232}
3333
3434@test " high-load-messages: _tg_escape escapes asterisks and backticks" {
35- run _tg_escape " test*bold*and\ ` code\` "
35+ run _tg_escape ' test*bold*and`code` '
3636 [ " $status " -eq 0 ]
37- [[ " $output " != * ' *bold*' * ]] || [[ " $output " == * ' \*' * ]]
37+ [[ $output != * ' *bold*' * ]] || [[ $output == * ' \*' * ]]
3838}
3939
4040@test " high-load-messages: _tg_escape preserves plain text" {
@@ -47,140 +47,140 @@ setup() {
4747 PSI_AVAILABLE=1
4848 run _tg_psi_section
4949 [ " $status " -eq 0 ]
50- [[ " $output " == * " PSI" * ]]
51- [[ " $output " == * " CPU some" * ]]
52- [[ " $output " == * " IO some" * ]]
53- [[ " $output " == * " Mem some" * ]]
54- [[ " $output " == * " 25.50" * ]]
50+ [[ $output == * " PSI" * ]]
51+ [[ $output == * " CPU some" * ]]
52+ [[ $output == * " IO some" * ]]
53+ [[ $output == * " Mem some" * ]]
54+ [[ $output == * " 25.50" * ]]
5555}
5656
5757@test " high-load-messages: _tg_psi_section shows unavailable when PSI off" {
5858 PSI_AVAILABLE=0
5959 run _tg_psi_section
6060 [ " $status " -eq 0 ]
61- [[ " $output " == * " unavailable" * ]]
61+ [[ $output == * " unavailable" * ]]
6262}
6363
6464@test " high-load-messages: telegram message contains all metric fields" {
6565 run high_load_message_telegram
6666 [ " $status " -eq 0 ]
67- [[ " $output " == * " High Load" * ]]
68- [[ " $output " == * " 12.50" * ]]
69- [[ " $output " == * " 92.5" * ]]
70- [[ " $output " == * " 14.20" * ]]
71- [[ " $output " == * " 16.00" * ]]
72- [[ " $output " == * " 25.30" * ]]
73- [[ " $output " == * " 150.20" * ]]
74- [[ " $output " == * " 18.50" * ]]
67+ [[ $output == * " High Load" * ]]
68+ [[ $output == * " 12.50" * ]]
69+ [[ $output == * " 92.5" * ]]
70+ [[ $output == * " 14.20" * ]]
71+ [[ $output == * " 16.00" * ]]
72+ [[ $output == * " 25.30" * ]]
73+ [[ $output == * " 150.20" * ]]
74+ [[ $output == * " 18.50" * ]]
7575}
7676
7777@test " high-load-messages: telegram message includes failed services when set" {
7878 FAILED_SERVICES=" nginx.service, mysql.service"
7979 run high_load_message_telegram
8080 [ " $status " -eq 0 ]
81- [[ " $output " == * " Failed Services" * ]]
82- [[ " $output " == * " nginx" * ]]
81+ [[ $output == * " Failed Services" * ]]
82+ [[ $output == * " nginx" * ]]
8383}
8484
8585@test " high-load-messages: telegram message omits failed services when empty" {
8686 FAILED_SERVICES=" "
8787 run high_load_message_telegram
8888 [ " $status " -eq 0 ]
89- [[ " $output " != * " Failed Services" * ]]
89+ [[ $output != * " Failed Services" * ]]
9090}
9191
9292@test " high-load-messages: _mx_psi_html contains HTML tags when PSI available" {
9393 PSI_AVAILABLE=1
9494 run _mx_psi_html
9595 [ " $status " -eq 0 ]
96- [[ " $output " == * " <strong>" * ]]
97- [[ " $output " == * " <br>" * ]]
98- [[ " $output " == * " CPU some" * ]]
96+ [[ $output == * " <strong>" * ]]
97+ [[ $output == * " <br>" * ]]
98+ [[ $output == * " CPU some" * ]]
9999}
100100
101101@test " high-load-messages: _mx_psi_html shows unavailable when PSI off" {
102102 PSI_AVAILABLE=0
103103 run _mx_psi_html
104104 [ " $status " -eq 0 ]
105- [[ " $output " == * " <em>" * ]]
106- [[ " $output " == * " unavailable" * ]]
105+ [[ $output == * " <em>" * ]]
106+ [[ $output == * " unavailable" * ]]
107107}
108108
109109@test " high-load-messages: _mx_psi_plain shows plain text when PSI available" {
110110 PSI_AVAILABLE=1
111111 run _mx_psi_plain
112112 [ " $status " -eq 0 ]
113- [[ " $output " == * " CPU some" * ]]
114- [[ " $output " == * " IO full" * ]]
115- [[ " $output " == * " Mem full" * ]]
113+ [[ $output == * " CPU some" * ]]
114+ [[ $output == * " IO full" * ]]
115+ [[ $output == * " Mem full" * ]]
116116}
117117
118118@test " high-load-messages: _mx_psi_plain shows unavailable when PSI off" {
119119 PSI_AVAILABLE=0
120120 run _mx_psi_plain
121121 [ " $status " -eq 0 ]
122- [[ " $output " == * " unavailable" * ]]
122+ [[ $output == * " unavailable" * ]]
123123}
124124
125125@test " high-load-messages: matrix plain contains all fields" {
126126 run high_load_message_matrix_plain
127127 [ " $status " -eq 0 ]
128- [[ " $output " == * " prod-server-01" * ]]
129- [[ " $output " == * " 12.50" * ]]
130- [[ " $output " == * " 92.5" * ]]
131- [[ " $output " == * " Root FS" * ]]
128+ [[ $output == * " prod-server-01" * ]]
129+ [[ $output == * " 12.50" * ]]
130+ [[ $output == * " 92.5" * ]]
131+ [[ $output == * " Root FS" * ]]
132132}
133133
134134@test " high-load-messages: matrix html contains HTML markup" {
135135 run high_load_message_matrix_html
136136 [ " $status " -eq 0 ]
137- [[ " $output " == * " <strong>" * ]]
138- [[ " $output " == * " <br>" * ]]
139- [[ " $output " == * " prod-server-01" * ]]
140- [[ " $output " == * " CPU" * ]]
137+ [[ $output == * " <strong>" * ]]
138+ [[ $output == * " <br>" * ]]
139+ [[ $output == * " prod-server-01" * ]]
140+ [[ $output == * " CPU" * ]]
141141}
142142
143143@test " high-load-messages: matrix plain includes failed services when set" {
144144 FAILED_SERVICES=" redis.service"
145145 run high_load_message_matrix_plain
146- [[ " $output " == * " Failed Services" * ]]
147- [[ " $output " == * " redis" * ]]
146+ [[ $output == * " Failed Services" * ]]
147+ [[ $output == * " redis" * ]]
148148}
149149
150150@test " high-load-messages: _ntfy_psi_section shows data when PSI available" {
151151 PSI_AVAILABLE=1
152152 run _ntfy_psi_section
153153 [ " $status " -eq 0 ]
154- [[ " $output " == * " CPU some" * ]]
155- [[ " $output " == * " IO full" * ]]
154+ [[ $output == * " CPU some" * ]]
155+ [[ $output == * " IO full" * ]]
156156}
157157
158158@test " high-load-messages: _ntfy_psi_section shows unavailable when PSI off" {
159159 PSI_AVAILABLE=0
160160 run _ntfy_psi_section
161161 [ " $status " -eq 0 ]
162- [[ " $output " == * " unavailable" * ]]
162+ [[ $output == * " unavailable" * ]]
163163}
164164
165165@test " high-load-messages: ntfy message contains all fields" {
166166 run high_load_message_ntfy
167167 [ " $status " -eq 0 ]
168- [[ " $output " == * " 12.50" * ]]
169- [[ " $output " == * " 92.5" * ]]
170- [[ " $output " == * " 14.20" * ]]
171- [[ " $output " == * " Root FS" * ]]
168+ [[ $output == * " 12.50" * ]]
169+ [[ $output == * " 92.5" * ]]
170+ [[ $output == * " 14.20" * ]]
171+ [[ $output == * " Root FS" * ]]
172172}
173173
174174@test " high-load-messages: ntfy title contains server name" {
175175 run high_load_title_ntfy
176176 [ " $status " -eq 0 ]
177- [[ " $output " == * " High Load" * ]]
178- [[ " $output " == * " prod-server-01" * ]]
177+ [[ $output == * " High Load" * ]]
178+ [[ $output == * " prod-server-01" * ]]
179179}
180180
181181@test " high-load-messages: ntfy message includes failed services" {
182182 FAILED_SERVICES=" postgres.service"
183183 run high_load_message_ntfy
184- [[ " $output " == * " Failed Services" * ]]
185- [[ " $output " == * " postgres" * ]]
184+ [[ $output == * " Failed Services" * ]]
185+ [[ $output == * " postgres" * ]]
186186}
0 commit comments