aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/server/logs.ts31
1 files changed, 30 insertions, 1 deletions
diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.ts
index b8714c7a1..c458789b6 100644
--- a/server/tests/api/server/logs.ts
+++ b/server/tests/api/server/logs.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index' 5import { cleanupTests, flushAndRunServer, killallServers, makeGetRequest, makePingRequest, reRunServer, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'
6import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 6import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
7import { uploadVideo } from '../../../../shared/extra-utils/videos/videos' 7import { uploadVideo } from '../../../../shared/extra-utils/videos/videos'
8import { getAuditLogs, getLogs } from '../../../../shared/extra-utils/logs/logs' 8import { getAuditLogs, getLogs } from '../../../../shared/extra-utils/logs/logs'
@@ -20,6 +20,7 @@ describe('Test logs', function () {
20 }) 20 })
21 21
22 describe('With the standard log file', function () { 22 describe('With the standard log file', function () {
23
23 it('Should get logs with a start date', async function () { 24 it('Should get logs with a start date', async function () {
24 this.timeout(10000) 25 this.timeout(10000)
25 26
@@ -84,6 +85,34 @@ describe('Test logs', function () {
84 expect(logsString.includes('video 6')).to.be.false 85 expect(logsString.includes('video 6')).to.be.false
85 } 86 }
86 }) 87 })
88
89 it('Should log ping requests', async function () {
90 const now = new Date()
91
92 await makePingRequest(server)
93
94 const res = await getLogs(server.url, server.accessToken, now, undefined, 'info')
95 const logsString = JSON.stringify(res.body)
96
97 expect(logsString.includes('/api/v1/ping')).to.be.true
98 })
99
100 it('Should not log ping requests', async function () {
101 this.timeout(30000)
102
103 killallServers([ server ])
104
105 await reRunServer(server, { log: { log_ping_requests: false } })
106
107 const now = new Date()
108
109 await makePingRequest(server)
110
111 const res = await getLogs(server.url, server.accessToken, now, undefined, 'info')
112 const logsString = JSON.stringify(res.body)
113
114 expect(logsString.includes('/api/v1/ping')).to.be.false
115 })
87 }) 116 })
88 117
89 describe('With the audit log', function () { 118 describe('With the audit log', function () {