You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fmt.Println("mismatch ip test is working fine for prefix:", prefix)
154
156
}
157
+
158
+
functestUnusedHbaLines(prefix, filestring) {
159
+
cmd:=exec.Command("ciscollector",
160
+
"-logparser", cons.LogParserCMD_HBAUnusedLines,
161
+
"-prefix", prefix,
162
+
"-file-path", file,
163
+
"-output-type", "json",
164
+
"-hba-file", "./pg_hba.conf",
165
+
)
166
+
167
+
// create io.Writer to store output and print it later
168
+
varbuf bytes.Buffer
169
+
170
+
cmd.Stdout=&buf
171
+
cmd.Stderr=os.Stderr
172
+
cmd.Stdin=os.Stdin
173
+
174
+
err:=cmd.Run()
175
+
iferr!=nil {
176
+
fmt.Println("Got error while parsing file:", err)
177
+
os.Exit(1)
178
+
}
179
+
180
+
out:=buf.String()
181
+
ifstrings.Contains(out, "In logline prefix, please set '%u' and '%d'") ||strings.Contains(out, "Please set log_line_prefix to '%h' or '%r' or enable log_connections") {
182
+
fmt.Println("skipping test for unused files as required details are not available in prefix:", prefix)
183
+
return
184
+
}
185
+
186
+
if!strings.Contains(out, "Successfully parsed all files") {
187
+
fmt.Println("Got error while parsing file:", out)
188
+
// fail the command
189
+
os.Exit(1)
190
+
}
191
+
192
+
ifstrings.Contains(out, `Unused lines found from given log file: [11 23 28]`) {
193
+
fmt.Println("unused lines test is working fine for prefix:", prefix)
0 commit comments