mirror of
https://github.com/OutlineFoundation/outline-server.git
synced 2026-08-27 03:42:01 +00:00
Remove old test
This commit is contained in:
parent
1c512e2df3
commit
f800ce6d28
1 changed files with 0 additions and 47 deletions
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright 2018 The Outline Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import {ManualClock} from '../infrastructure/clock';
|
||||
import {InMemoryConfig} from '../infrastructure/json_config';
|
||||
|
||||
import {LegacyManagerMetrics, LegacyManagerMetricsJson} from './manager_metrics';
|
||||
|
||||
describe('ManagerMetrics', () => {
|
||||
it('Saves traffic to config', async (done) => {
|
||||
const config = new InMemoryConfig({} as LegacyManagerMetricsJson);
|
||||
const clock = new ManualClock();
|
||||
const startTime = clock.now();
|
||||
const metrics = new LegacyManagerMetrics(clock, config);
|
||||
|
||||
let report = await metrics.get30DayByteTransfer();
|
||||
expect(report.bytesTransferredByUserId).toEqual({});
|
||||
|
||||
for (let di = 0; di < 40; di++) {
|
||||
clock.nowMs = startTime + di * 24 * 60 * 60 * 1000;
|
||||
metrics.writeBytesTransferred('user-0', 1);
|
||||
}
|
||||
report = await metrics.get30DayByteTransfer();
|
||||
// This is being dropped
|
||||
expect(report.bytesTransferredByUserId).toEqual({'user-0': 30});
|
||||
// We are not cleaning this from the config.
|
||||
expect(config.mostRecentWrite.userIdSet).toEqual(['user-0']);
|
||||
expect(Object.keys(config.mostRecentWrite.dailyUserBytesTransferred).length).toEqual(40);
|
||||
|
||||
expect(await new LegacyManagerMetrics(clock, new InMemoryConfig(config.mostRecentWrite))
|
||||
.get30DayByteTransfer())
|
||||
.toEqual(report);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue