mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
refactor: pipeline edit view
This commit is contained in:
10
packages/core/pipeline/test/index.test.ts
Normal file
10
packages/core/pipeline/test/index.test.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { expect } from "chai";
|
||||
import "mocha";
|
||||
import { EchoPlugin } from "../src/plugin/plugins";
|
||||
describe("task_plugin", function () {
|
||||
it("#taskplugin", function () {
|
||||
const define = EchoPlugin.define;
|
||||
new EchoPlugin().execute({ context: {}, props: { test: 111 } });
|
||||
expect(define.name).eq("EchoPlugin");
|
||||
});
|
||||
});
|
||||
10
packages/core/pipeline/test/pipeline/access-service-test.ts
Normal file
10
packages/core/pipeline/test/pipeline/access-service-test.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { IAccessService } from "../../src/access/access-service";
|
||||
import { AbstractAccess, AliyunAccess } from "../../src";
|
||||
import { aliyunSecret } from "../user.secret";
|
||||
export class AccessServiceTest implements IAccessService {
|
||||
getById(id: any): AbstractAccess {
|
||||
return {
|
||||
...aliyunSecret,
|
||||
} as AliyunAccess;
|
||||
}
|
||||
}
|
||||
62
packages/core/pipeline/test/pipeline/pipeline.define.ts
Normal file
62
packages/core/pipeline/test/pipeline/pipeline.define.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { ConcurrencyStrategy, NextStrategy, Pipeline } from "../../src";
|
||||
|
||||
let idIndex = 0;
|
||||
function generateId() {
|
||||
idIndex++;
|
||||
return idIndex + "";
|
||||
}
|
||||
export const pipeline: Pipeline = {
|
||||
version: 1,
|
||||
id: generateId(),
|
||||
title: "测试管道",
|
||||
triggers: [],
|
||||
stages: [
|
||||
{
|
||||
id: generateId(),
|
||||
title: "证书申请阶段",
|
||||
concurrency: ConcurrencyStrategy.Serial,
|
||||
next: NextStrategy.AllSuccess,
|
||||
tasks: [
|
||||
{
|
||||
id: generateId(),
|
||||
title: "申请证书任务",
|
||||
steps: [
|
||||
{
|
||||
id: generateId(),
|
||||
title: "申请证书",
|
||||
type: "CertApply",
|
||||
input: {
|
||||
domains: ["*.docmirror.cn"],
|
||||
email: "xiaojunnuo@qq.com",
|
||||
dnsProviderType: "aliyun",
|
||||
accessId: "111",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: generateId(),
|
||||
title: "证书部署阶段",
|
||||
concurrency: ConcurrencyStrategy.Serial,
|
||||
next: NextStrategy.AllSuccess,
|
||||
tasks: [
|
||||
{
|
||||
id: generateId(),
|
||||
title: "测试输出参数",
|
||||
steps: [
|
||||
{
|
||||
id: generateId(),
|
||||
title: "输出参数",
|
||||
type: "EchoPlugin",
|
||||
input: {
|
||||
cert: "cert",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
18
packages/core/pipeline/test/pipeline/pipeline.test.ts
Normal file
18
packages/core/pipeline/test/pipeline/pipeline.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { expect } from "chai";
|
||||
import "mocha";
|
||||
import { Executor, RunHistory } from "../../src";
|
||||
import { pipeline } from "./pipeline.define";
|
||||
import { AccessServiceTest } from "./access-service-test";
|
||||
import { FileStorage } from "../../src/core/storage";
|
||||
describe("pipeline", function () {
|
||||
it("#pipeline", async function () {
|
||||
this.timeout(120000);
|
||||
function onChanged(history: RunHistory) {
|
||||
console.log("changed:");
|
||||
}
|
||||
|
||||
const executor = new Executor({ userId: 1, pipeline, onChanged, accessService: new AccessServiceTest(), storage: new FileStorage() });
|
||||
await executor.run();
|
||||
// expect(define.name).eq("EchoPlugin");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user