aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-13 09:38:19 +0100
committerChocobozzz <me@florianbigard.com>2021-01-13 09:38:19 +0100
commit78d62f4d182be2f72f4901c38a0d10bb147896e8 (patch)
treed68b591387a526b235311fc5ec3a2d6f871a071b /server/tests
parent9bb720f3f96d781d5e132220ace4515e779cea3c (diff)
downloadPeerTube-78d62f4d182be2f72f4901c38a0d10bb147896e8.tar.gz
PeerTube-78d62f4d182be2f72f4901c38a0d10bb147896e8.tar.zst
PeerTube-78d62f4d182be2f72f4901c38a0d10bb147896e8.zip
Fix and add skipping ping log tests
Diffstat (limited to 'server/tests')
-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 () {