mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ci: add test & benchmark
This commit is contained in:
1 parent
5c1217dc60
commit
d589217a75
20 files changed
+155
-52
No files matched your search
@@ -39,7 +39,7 @@ export function registerResolver(
|
||||
registerValue(typeName, key, value, description);
|
||||
const wrappedFunc = async (arg, ctx, info) => {
|
||||
const res = await func(arg, ctx, info);
|
||||
if (typeof res !== 'object') return res;
|
||||
if (typeof res !== 'object' || res === null) return res;
|
||||
const node = value.includes('!') ? value.split('!')[0] : value;
|
||||
if (handlers[node]) Object.assign(res, handlers[node]);
|
||||
ctx.parent = res;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint-disable simple-import-sort/imports */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-eval */
|
||||
import 'reflect-metadata';
|
||||
import './init';
|
||||
import './interface';
|
||||
import path from 'path';
|
||||
|
||||
@@ -12,6 +12,7 @@ const coll = db.collection('task');
|
||||
const collEvent = db.collection('event');
|
||||
|
||||
async function getFirst(query: FilterQuery<Task>) {
|
||||
if (process.env.CI) return null;
|
||||
const q = { ...query };
|
||||
q.executeAfter = q.executeAfter || { $lt: new Date() };
|
||||
const res = await coll.findOneAndDelete(q, { sort: { priority: -1 } });
|
||||
|
||||
@@ -34,8 +34,13 @@ class MongoService implements BaseService {
|
||||
}
|
||||
|
||||
async start(opts: MongoConfig) {
|
||||
let mongourl = MongoService.buildUrl(opts);
|
||||
if (process.env.CI) {
|
||||
const { MongoMemoryServer } = require('mongodb-memory-server');
|
||||
const mongod = await MongoMemoryServer.create();
|
||||
mongourl = mongod.getUri();
|
||||
}
|
||||
this.opts = opts;
|
||||
const mongourl = MongoService.buildUrl(opts);
|
||||
this.client = await MongoClient.connect(mongourl, { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
this.db = this.client.db(opts.name);
|
||||
await bus.parallel('database/connect', this.db);
|
||||
|
||||
Reference in new issue
Block a user